/* Generated by Cython 0.17.2 on Tue Jan 22 00:21:31 2013 */

#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 < 0x02040000
    #error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)
  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;
  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#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, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#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)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_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_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
  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) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__pandas__algos
#define __PYX_HAVE_API__pandas__algos
#include "stdio.h"
#include "stdlib.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "pythread.h"
#include "numpy_helper.h"
#include "src/headers/math.h"
#include "math.h"
#include "skiplist.h"
#include "headers/stdint.h"
#include "datetime.h"
#include "datetime_helper.h"
#include "numpy/ndarrayobject.h"
#include "numpy/npy_common.h"
#include "datetime/np_datetime.h"
#include "datetime/np_datetime_strings.h"
#include "khash_python.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

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


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

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

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

#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))

#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "algos.pyx",
  "skiplist.pyx",
  "join.pyx",
  "generated.pyx",
  "datetime.pxd",
  "numpy.pxd",
  "util.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name; /* for error messages only */
  struct __Pyx_StructField_* fields;
  size_t size;     /* sizeof(type) */
  size_t arraysize[8]; /* length of array in each dimension */
  int ndim;
  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "numpy.pxd":724
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "numpy.pxd":725
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "numpy.pxd":726
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "numpy.pxd":727
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "numpy.pxd":731
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "numpy.pxd":732
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "numpy.pxd":733
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "numpy.pxd":734
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "numpy.pxd":738
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "numpy.pxd":739
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "numpy.pxd":748
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "numpy.pxd":749
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "numpy.pxd":750
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "numpy.pxd":752
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "numpy.pxd":753
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "numpy.pxd":754
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "numpy.pxd":756
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "numpy.pxd":757
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "numpy.pxd":759
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "numpy.pxd":760
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "numpy.pxd":761
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;

/* "pandas/src/generated.pyx":25
 * from khash cimport *
 * 
 * ctypedef unsigned char UChar             # <<<<<<<<<<<<<<
 * 
 * cimport util
 */
typedef unsigned char __pyx_t_6pandas_5algos_UChar;
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif


/*--- Type declarations ---*/
struct __pyx_obj_6pandas_5algos_Node;
struct __pyx_obj_6pandas_5algos_IndexableSkiplist;

/* "numpy.pxd":763
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "numpy.pxd":764
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "numpy.pxd":765
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "numpy.pxd":767
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_t_6pandas_5algos_pairs;

/* "pandas/algos.pyx":1311
 * # Rolling median, min, max
 * 
 * ctypedef double_t (* skiplist_f)(object sl, int n, int p)             # <<<<<<<<<<<<<<
 * 
 * cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op):
 */
typedef __pyx_t_5numpy_double_t (*__pyx_t_6pandas_5algos_skiplist_f)(PyObject *, int, int);

/* "pandas/algos.pyx":1439
 * # https://github.com/kwgoodman/bottleneck
 * 
 * cdef struct pairs:             # <<<<<<<<<<<<<<
 *     double value
 *     int death
 */
struct __pyx_t_6pandas_5algos_pairs {
  double value;
  int death;
};

/* "pandas/src/skiplist.pyx":32
 * # TODO: optimize this, make less messy
 * 
 * cdef class Node:             # <<<<<<<<<<<<<<
 *     cdef public:
 *         double_t value
 */
struct __pyx_obj_6pandas_5algos_Node {
  PyObject_HEAD
  __pyx_t_5numpy_double_t value;
  PyObject *next;
  PyObject *width;
};


/* "pandas/src/skiplist.pyx":46
 * NIL = Node(np.inf, [], [])
 * 
 * cdef class IndexableSkiplist:             # <<<<<<<<<<<<<<
 *     '''
 *     Sorted collection supporting O(lg n) insertion, removal, and
 */
struct __pyx_obj_6pandas_5algos_IndexableSkiplist {
  PyObject_HEAD
  struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *__pyx_vtab;
  Py_ssize_t size;
  Py_ssize_t maxlevels;
  struct __pyx_obj_6pandas_5algos_Node *head;
};



struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist {
  PyObject *(*get)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, Py_ssize_t, int __pyx_skip_dispatch);
  PyObject *(*insert)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, double, int __pyx_skip_dispatch);
  PyObject *(*remove)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, double, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *__pyx_vtabptr_6pandas_5algos_IndexableSkiplist;
#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); /*proto*/
  #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 /* CYTHON_REFNANNY */
#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)

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

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

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

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

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

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (PyList_CheckExact(o)) {
        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if (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 = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {  /* inlined PySequence_GetItem() */
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (unlikely(l < 0)) return NULL;
                i += l;
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

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

#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_SetItemInt_Fast(o, i, v) : \
                                                    __Pyx_SetItemInt_Generic(o, to_py_func(i), v))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (PyList_CheckExact(o)) {
        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {  /* inlined PySequence_SetItem() */
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (unlikely(l < 0)) return -1;
                i += l;
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (PySequence_Check(o) && !PyDict_Check(o)) {
#else
    if (PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

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

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

static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

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

static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/

#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
  #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
  static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

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

static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */

static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */

static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) {
    int result = PyDict_Contains(dict, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


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

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

static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *);

static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject *);

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f) \
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
    int flags;
    PyObject *func_dict;
    PyObject *func_weakreflist;
    PyObject *func_name;
    PyObject *func_doc;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj; /* No-args super() class cell */
    void *defaults;
    int defaults_pyobjects;
    PyObject *defaults_tuple; /* Const defaults tuple */
    PyObject *(*defaults_getter)(PyObject *);
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
                                      PyMethodDef *ml, int flags,
                                      PyObject *self, PyObject *module,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static int __Pyx_CyFunction_init(void);

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64);

static CYTHON_INLINE npy_uint8 __Pyx_PyInt_from_py_npy_uint8(PyObject *);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint8(npy_uint8);

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eqf(a, b)   ((a)==(b))
    #define __Pyx_c_sumf(a, b)  ((a)+(b))
    #define __Pyx_c_difff(a, b) ((a)-(b))
    #define __Pyx_c_prodf(a, b) ((a)*(b))
    #define __Pyx_c_quotf(a, b) ((a)/(b))
    #define __Pyx_c_negf(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
    #define __Pyx_c_conjf(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_absf(z)     (::std::abs(z))
        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zerof(z) ((z)==0)
    #define __Pyx_c_conjf(z)    (conjf(z))
    #if 1
        #define __Pyx_c_absf(z)     (cabsf(z))
        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);

#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq(a, b)   ((a)==(b))
    #define __Pyx_c_sum(a, b)  ((a)+(b))
    #define __Pyx_c_diff(a, b) ((a)-(b))
    #define __Pyx_c_prod(a, b) ((a)*(b))
    #define __Pyx_c_quot(a, b) ((a)/(b))
    #define __Pyx_c_neg(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero(z) ((z)==(double)0)
    #define __Pyx_c_conj(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (::std::abs(z))
        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero(z) ((z)==0)
    #define __Pyx_c_conj(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs(z)     (cabs(z))
        #define __Pyx_c_pow(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

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

static int __Pyx_check_binary_version(void);

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

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

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

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

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

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

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


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

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

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

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

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

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'cython' */

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

/* Module declarations from 'util' */
static CYTHON_INLINE PyObject *__pyx_f_4util_get_value_at(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_4util_is_array(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4util__checknull(PyObject *); /*proto*/
static CYTHON_INLINE int __pyx_f_4util__checknan(PyObject *); /*proto*/

/* Module declarations from 'skiplist' */

/* Module declarations from 'libc' */

/* Module declarations from 'datetime' */

/* Module declarations from 'datetime' */
static PyTypeObject *__pyx_ptype_8datetime_date = 0;
static PyTypeObject *__pyx_ptype_8datetime_datetime = 0;
static PyTypeObject *__pyx_ptype_8datetime_timedelta = 0;
static CYTHON_INLINE int __pyx_f_8datetime__cstring_to_dts(char *, int, pandas_datetimestruct *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_8datetime__dts_to_pydatetime(pandas_datetimestruct *); /*proto*/

/* Module declarations from 'khash' */

/* Module declarations from 'pandas.algos' */
static PyTypeObject *__pyx_ptype_6pandas_5algos_Node = 0;
static PyTypeObject *__pyx_ptype_6pandas_5algos_IndexableSkiplist = 0;
static __pyx_t_5numpy_float64_t __pyx_v_6pandas_5algos_FP_ERR;
static __pyx_t_5numpy_int32_t __pyx_v_6pandas_5algos_MINint32;
static __pyx_t_5numpy_int64_t __pyx_v_6pandas_5algos_MINint64;
static __pyx_t_5numpy_float32_t __pyx_v_6pandas_5algos_MINfloat32;
static __pyx_t_5numpy_float64_t __pyx_v_6pandas_5algos_MINfloat64;
static __pyx_t_5numpy_int32_t __pyx_v_6pandas_5algos_MAXint32;
static __pyx_t_5numpy_int64_t __pyx_v_6pandas_5algos_MAXint64;
static __pyx_t_5numpy_float32_t __pyx_v_6pandas_5algos_MAXfloat32;
static __pyx_t_5numpy_float64_t __pyx_v_6pandas_5algos_MAXfloat64;
static double __pyx_v_6pandas_5algos_NaN;
static double __pyx_v_6pandas_5algos_nan;
static int __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE;
static int __pyx_v_6pandas_5algos_TIEBREAK_MIN;
static int __pyx_v_6pandas_5algos_TIEBREAK_MAX;
static int __pyx_v_6pandas_5algos_TIEBREAK_FIRST;
static int __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING;
static int __pyx_v_6pandas_5algos_PLATFORM_INT;
static CYTHON_INLINE int __pyx_f_6pandas_5algos_int_max(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_6pandas_5algos_int_min(int, int); /*proto*/
static double __pyx_f_6pandas_5algos_Log2(double); /*proto*/
static PyObject *__pyx_f_6pandas_5algos__take_2d_float64(PyArrayObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pandas_5algos__take_2d_int64(PyArrayObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_6pandas_5algos__take_2d_object(PyArrayObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_5algos_are_diff(PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_6pandas_5algos_kth_smallest_c(__pyx_t_5numpy_float64_t *, Py_ssize_t, Py_ssize_t); /*proto*/
static PyObject *__pyx_f_6pandas_5algos__roll_skiplist_op(PyArrayObject *, int, int, __pyx_t_6pandas_5algos_skiplist_f); /*proto*/
static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_median(PyObject *, int, int); /*proto*/
static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_max(PyObject *, int, int); /*proto*/
static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_min(PyObject *, int, int); /*proto*/
static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_5algos__median_linear(__pyx_t_5numpy_float64_t *, int); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_platform_int(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_float64(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_int32(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_int64(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_object(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_float64(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_object(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_int32(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_int64(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_bool(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_Py_ssize_t = { "Py_ssize_t", NULL, sizeof(Py_ssize_t), { 0 }, 0, IS_UNSIGNED(Py_ssize_t) ? 'U' : 'I', IS_UNSIGNED(Py_ssize_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_object = { "Python object", NULL, sizeof(PyObject *), { 0 }, 0, 'O', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "double_t", NULL, sizeof(__pyx_t_5numpy_double_t), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int32_t), 0 };
#define __Pyx_MODULE_NAME "pandas.algos"
int __pyx_module_is_main_pandas__algos = 0;

/* Implementation of 'pandas.algos' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_lambda_funcdef_6pandas_5algos_lambda1(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_other); /* proto */
static PyObject *__pyx_lambda_funcdef_6pandas_5algos_lambda2(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_other); /* proto */
static int __pyx_pf_6pandas_5algos_4Node___init__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, __pyx_t_5numpy_double_t __pyx_v_value, PyObject *__pyx_v_next, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_4Node_5value___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self); /* proto */
static int __pyx_pf_6pandas_5algos_4Node_5value_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_4Node_4next___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self); /* proto */
static int __pyx_pf_6pandas_5algos_4Node_4next_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pandas_5algos_4Node_4next_4__del__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_4Node_5width___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self); /* proto */
static int __pyx_pf_6pandas_5algos_4Node_5width_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_6pandas_5algos_4Node_5width_4__del__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self); /* proto */
static int __pyx_pf_6pandas_5algos_17IndexableSkiplist___init__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, PyObject *__pyx_v_expected_size); /* proto */
static Py_ssize_t __pyx_pf_6pandas_5algos_17IndexableSkiplist_2__len__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_4__getitem__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, PyObject *__pyx_v_i); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_6get(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, Py_ssize_t __pyx_v_i); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_8insert(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_10remove(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_rank_1d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_2rank_1d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, CYTHON_UNUSED PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_4rank_2d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_6rank_2d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, CYTHON_UNUSED PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_8rank_1d_generic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, int __pyx_v_retry, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_10rank_2d_generic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_12diff_2d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_14diff_2d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_16diff_2d_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_18_check_minp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_win, PyObject *__pyx_v_minp, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_20kth_smallest(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, Py_ssize_t __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_22median(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_24max_subseq(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_26min_subseq(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_28roll_sum(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_30roll_mean(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_32ewma(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, __pyx_t_5numpy_double_t __pyx_v_com, int __pyx_v_adjust); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_34nancorr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mat, PyObject *__pyx_v_cov, PyObject *__pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_36roll_var(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, int __pyx_v_ddof); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_38roll_skew(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_40roll_kurt(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_42roll_median_c(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arg, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_44roll_median_cython(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_46roll_max2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, int __pyx_v_window, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_48roll_max(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_50roll_min(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_52roll_min2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, int __pyx_v_window, int __pyx_v_minp); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_54roll_quantile(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, double __pyx_v_quantile); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_56roll_generic(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_58roll_window(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, PyArrayObject *__pyx_v_weights, int __pyx_v_minp, int __pyx_v_avg, int __pyx_v_avg_wgt); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_60is_lexsorted(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_62groupby_indices(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_64group_labels(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_66groupsort_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, Py_ssize_t __pyx_v_ngroups); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_68group_add(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_70group_prod(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_72group_nth(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels, __pyx_t_5numpy_int64_t __pyx_v_rank); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_74group_nth_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels, __pyx_t_5numpy_int64_t __pyx_v_rank); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_76group_nth_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins, __pyx_t_5numpy_int64_t __pyx_v_rank); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_78group_nth_bin_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins, __pyx_t_5numpy_int64_t __pyx_v_rank); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_80group_last(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_82group_last_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_84group_last_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_86group_last_bin_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_88group_min(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_90group_max(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_92group_mean(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_94group_median(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_96group_var(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_98group_add_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_100group_prod_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_102group_min_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_104group_max_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_106group_ohlc(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_108group_mean_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_110group_var_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_112inner_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_114left_outer_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups, PyObject *__pyx_v_sort); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_116full_outer_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_118_get_result_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sorter, PyObject *__pyx_v_indexer); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_120ffill_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_122ffill_by_group(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer, PyArrayObject *__pyx_v_group_ids, __pyx_t_5numpy_int64_t __pyx_v_max_group); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_124ensure_platform_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_126ensure_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_128ensure_int32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_130ensure_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_132ensure_object(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_134map_indices_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_136map_indices_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_138map_indices_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_140map_indices_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_142map_indices_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_144pad_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_146pad_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_148pad_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_150pad_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_152pad_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_154backfill_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_156backfill_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_158backfill_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_160backfill_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_162backfill_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_164pad_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_166pad_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_168pad_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_170pad_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_172pad_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_174backfill_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_176backfill_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_178backfill_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_180backfill_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_182backfill_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_184pad_2d_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_186pad_2d_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_188pad_2d_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_190pad_2d_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_192pad_2d_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_194backfill_2d_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_196backfill_2d_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_198backfill_2d_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_200backfill_2d_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_202backfill_2d_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_204take_1d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_206take_1d_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_208take_1d_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_210take_1d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_212take_1d_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_214is_monotonic_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_216is_monotonic_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_218is_monotonic_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_220is_monotonic_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_222is_monotonic_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_224groupby_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_226groupby_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_228groupby_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_230groupby_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_232groupby_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_234arrmap_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_236arrmap_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_238arrmap_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_240arrmap_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_242arrmap_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_244take_2d_axis0_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_246take_2d_axis0_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_248take_2d_axis0_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_250take_2d_axis0_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_252take_2d_axis0_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_254take_2d_axis1_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_256take_2d_axis1_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_258take_2d_axis1_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_260take_2d_axis1_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_262take_2d_axis1_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_264take_2d_multi_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_266take_2d_multi_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_268take_2d_multi_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_270take_2d_multi_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_272take_2d_multi_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_274left_join_indexer_unique_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_276left_join_indexer_unique_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_278left_join_indexer_unique_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_280left_join_indexer_unique_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_282left_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_284left_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_286left_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_288left_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_290outer_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_292outer_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_294outer_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_296outer_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_298inner_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_300inner_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_302inner_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6pandas_5algos_304inner_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static char __pyx_k_1[] = "Not Found";
static char __pyx_k_25[] = "first not supported for non-numeric data";
static char __pyx_k_35[] = "min_periods (%d) must be <= window (%d)";
static char __pyx_k_36[] = "min_periods must be >= 0";
static char __pyx_k_40[] = "Invalid window size %d";
static char __pyx_k_41[] = "Invalid min_periods size %d greater than window %d";
static char __pyx_k_44[] = "take_2d_axis1_float64";
static char __pyx_k_45[] = "Output array must have 4 columns";
static char __pyx_k_51[] = "Limit must be non-negative";
static char __pyx_k_92[] = "No NA values allowed";
static char __pyx_k__A[] = "A";
static char __pyx_k__B[] = "B";
static char __pyx_k__C[] = "C";
static char __pyx_k__D[] = "D";
static char __pyx_k__H[] = "H";
static char __pyx_k__I[] = "I";
static char __pyx_k__K[] = "K";
static char __pyx_k__L[] = "L";
static char __pyx_k__N[] = "N";
static char __pyx_k__O[] = "O";
static char __pyx_k__Q[] = "Q";
static char __pyx_k__R[] = "R";
static char __pyx_k__S[] = "S";
static char __pyx_k__T[] = "T";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__c[] = "c";
static char __pyx_k__d[] = "d";
static char __pyx_k__e[] = "e";
static char __pyx_k__f[] = "f";
static char __pyx_k__g[] = "g";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__k[] = "k";
static char __pyx_k__l[] = "l";
static char __pyx_k__m[] = "m";
static char __pyx_k__n[] = "n";
static char __pyx_k__q[] = "q";
static char __pyx_k__s[] = "s";
static char __pyx_k__t[] = "t";
static char __pyx_k__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__z[] = "z";
static char __pyx_k_102[] = "pandas.lib";
static char __pyx_k_103[] = "maybe_convert_objects";
static char __pyx_k_139[] = "Unable to parse %s";
static char __pyx_k_140[] = "ndarray is not C contiguous";
static char __pyx_k_142[] = "ndarray is not Fortran contiguous";
static char __pyx_k_144[] = "Non-native byte order not supported";
static char __pyx_k_146[] = "unknown dtype code in numpy.pxd (%d)";
static char __pyx_k_147[] = "Format string allocated too short, see comment in numpy.pxd";
static char __pyx_k_150[] = "Format string allocated too short.";
static char __pyx_k_152[] = "index out of bounds";
static char __pyx_k_155[] = "";
static char __pyx_k_158[] = "/home/wesm/code/pandas/pandas/algos.pyx";
static char __pyx_k_159[] = "pandas.algos";
static char __pyx_k_238[] = "group_nth_bin_object";
static char __pyx_k_247[] = "group_last_bin_object";
static char __pyx_k_274[] = "pandas/src/join.pyx";
static char __pyx_k_288[] = "pandas/src/generated.pyx";
static char __pyx_k_319[] = "backfill_inplace_float64";
static char __pyx_k_322[] = "backfill_inplace_object";
static char __pyx_k_325[] = "backfill_inplace_int32";
static char __pyx_k_328[] = "backfill_inplace_int64";
static char __pyx_k_331[] = "backfill_inplace_bool";
static char __pyx_k_334[] = "pad_2d_inplace_float64";
static char __pyx_k_337[] = "pad_2d_inplace_object";
static char __pyx_k_340[] = "pad_2d_inplace_int32";
static char __pyx_k_343[] = "pad_2d_inplace_int64";
static char __pyx_k_348[] = "backfill_2d_inplace_float64";
static char __pyx_k_351[] = "backfill_2d_inplace_object";
static char __pyx_k_354[] = "backfill_2d_inplace_int32";
static char __pyx_k_357[] = "backfill_2d_inplace_int64";
static char __pyx_k_360[] = "backfill_2d_inplace_bool";
static char __pyx_k_373[] = "is_monotonic_float64";
static char __pyx_k_404[] = "take_2d_axis0_float64";
static char __pyx_k_407[] = "take_2d_axis0_object";
static char __pyx_k_418[] = "take_2d_axis1_object";
static char __pyx_k_427[] = "take_2d_multi_float64";
static char __pyx_k_430[] = "take_2d_multi_object";
static char __pyx_k_439[] = "left_join_indexer_unique_float64";
static char __pyx_k_442[] = "left_join_indexer_unique_object";
static char __pyx_k_445[] = "left_join_indexer_unique_int32";
static char __pyx_k_448[] = "left_join_indexer_unique_int64";
static char __pyx_k_451[] = "left_join_indexer_float64";
static char __pyx_k_454[] = "left_join_indexer_object";
static char __pyx_k_457[] = "left_join_indexer_int32";
static char __pyx_k_460[] = "left_join_indexer_int64";
static char __pyx_k_463[] = "outer_join_indexer_float64";
static char __pyx_k_466[] = "outer_join_indexer_object";
static char __pyx_k_469[] = "outer_join_indexer_int32";
static char __pyx_k_472[] = "outer_join_indexer_int64";
static char __pyx_k_475[] = "inner_join_indexer_float64";
static char __pyx_k_478[] = "inner_join_indexer_object";
static char __pyx_k_481[] = "inner_join_indexer_int32";
static char __pyx_k_484[] = "inner_join_indexer_int64";
static char __pyx_k__NA[] = "NA";
static char __pyx_k__Zd[] = "Zd";
static char __pyx_k__Zf[] = "Zf";
static char __pyx_k__Zg[] = "Zg";
static char __pyx_k__ai[] = "ai";
static char __pyx_k__ct[] = "ct";
static char __pyx_k__f8[] = "f8";
static char __pyx_k__fv[] = "fv";
static char __pyx_k__i0[] = "i0";
static char __pyx_k__i8[] = "i8";
static char __pyx_k__lc[] = "lc";
static char __pyx_k__n0[] = "n0";
static char __pyx_k__np[] = "np";
static char __pyx_k__rc[] = "rc";
static char __pyx_k__sl[] = "sl";
static char __pyx_k__sx[] = "sx";
static char __pyx_k__sy[] = "sy";
static char __pyx_k__vx[] = "vx";
static char __pyx_k__vy[] = "vy";
static char __pyx_k__xi[] = "xi";
static char __pyx_k__xx[] = "xx";
static char __pyx_k__yi[] = "yi";
static char __pyx_k__NIL[] = "NIL";
static char __pyx_k__NaN[] = "NaN";
static char __pyx_k___as[] = "_as";
static char __pyx_k__adj[] = "adj";
static char __pyx_k__arg[] = "arg";
static char __pyx_k__arr[] = "arr";
static char __pyx_k__avg[] = "avg";
static char __pyx_k__buf[] = "buf";
static char __pyx_k__com[] = "com";
static char __pyx_k__cov[] = "cov";
static char __pyx_k__cur[] = "cur";
static char __pyx_k__day[] = "day";
static char __pyx_k__dim[] = "dim";
static char __pyx_k__end[] = "end";
static char __pyx_k__get[] = "get";
static char __pyx_k__gid[] = "gid";
static char __pyx_k__ids[] = "ids";
static char __pyx_k__idx[] = "idx";
static char __pyx_k__inf[] = "inf";
static char __pyx_k__key[] = "key";
static char __pyx_k__lab[] = "lab";
static char __pyx_k__lib[] = "lib";
static char __pyx_k__lim[] = "lim";
static char __pyx_k__loc[] = "loc";
static char __pyx_k__mat[] = "mat";
static char __pyx_k__max[] = "max";
static char __pyx_k__min[] = "min";
static char __pyx_k__nan[] = "nan";
static char __pyx_k__new[] = "new";
static char __pyx_k__old[] = "old";
static char __pyx_k__out[] = "out";
static char __pyx_k__pre[] = "pre";
static char __pyx_k__ptr[] = "ptr";
static char __pyx_k__put[] = "put";
static char __pyx_k__res[] = "res";
static char __pyx_k__ret[] = "ret";
static char __pyx_k__rev[] = "rev";
static char __pyx_k__top[] = "top";
static char __pyx_k__val[] = "val";
static char __pyx_k__win[] = "win";
static char __pyx_k__xxx[] = "xxx";
static char __pyx_k__NINF[] = "NINF";
static char __pyx_k__aold[] = "aold";
static char __pyx_k__axis[] = "axis";
static char __pyx_k__bins[] = "bins";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__ddof[] = "ddof";
static char __pyx_k__dims[] = "dims";
static char __pyx_k__dups[] = "dups";
static char __pyx_k__ewma[] = "ewma";
static char __pyx_k__fill[] = "fill";
static char __pyx_k__func[] = "func";
static char __pyx_k__hour[] = "hour";
static char __pyx_k__idx0[] = "idx0";
static char __pyx_k__idx1[] = "idx1";
static char __pyx_k__in_i[] = "in_i";
static char __pyx_k__in_k[] = "in_k";
static char __pyx_k__in_n[] = "in_n";
static char __pyx_k__infs[] = "infs";
static char __pyx_k__int_[] = "int_";
static char __pyx_k__keep[] = "keep";
static char __pyx_k__kind[] = "kind";
static char __pyx_k__last[] = "last";
static char __pyx_k__left[] = "left";
static char __pyx_k__lval[] = "lval";
static char __pyx_k__mask[] = "mask";
static char __pyx_k__maxx[] = "maxx";
static char __pyx_k__minp[] = "minp";
static char __pyx_k__minx[] = "minx";
static char __pyx_k__neww[] = "neww";
static char __pyx_k__next[] = "next";
static char __pyx_k__nobs[] = "nobs";
static char __pyx_k__oldw[] = "oldw";
static char __pyx_k__prev[] = "prev";
static char __pyx_k__rank[] = "rank";
static char __pyx_k__resx[] = "resx";
static char __pyx_k__ring[] = "ring";
static char __pyx_k__rval[] = "rval";
static char __pyx_k__seen[] = "seen";
static char __pyx_k__self[] = "self";
static char __pyx_k__size[] = "size";
static char __pyx_k__sort[] = "sort";
static char __pyx_k__stop[] = "stop";
static char __pyx_k__sumx[] = "sumx";
static char __pyx_k__sumy[] = "sumy";
static char __pyx_k__take[] = "take";
static char __pyx_k__vecs[] = "vecs";
static char __pyx_k__view[] = "view";
static char __pyx_k__vlow[] = "vlow";
static char __pyx_k__xxxx[] = "xxxx";
static char __pyx_k__year[] = "year";
static char __pyx_k__array[] = "array";
static char __pyx_k__count[] = "count";
static char __pyx_k__dtype[] = "dtype";
static char __pyx_k__empty[] = "empty";
static char __pyx_k__first[] = "first";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__iinfo[] = "iinfo";
static char __pyx_k__index[] = "index";
static char __pyx_k__input[] = "input";
static char __pyx_k__int32[] = "int32";
static char __pyx_k__int64[] = "int64";
static char __pyx_k__isnan[] = "isnan";
static char __pyx_k__label[] = "label";
static char __pyx_k__limit[] = "limit";
static char __pyx_k__meanx[] = "meanx";
static char __pyx_k__meany[] = "meany";
static char __pyx_k__month[] = "month";
static char __pyx_k__nbins[] = "nbins";
static char __pyx_k__nleft[] = "nleft";
static char __pyx_k__numpy[] = "numpy";
static char __pyx_k__other[] = "other";
static char __pyx_k__prodx[] = "prodx";
static char __pyx_k__range[] = "range";
static char __pyx_k__ranks[] = "ranks";
static char __pyx_k__retry[] = "retry";
static char __pyx_k__right[] = "right";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__start[] = "start";
static char __pyx_k__sum_x[] = "sum_x";
static char __pyx_k__sumxx[] = "sumxx";
static char __pyx_k__sumyy[] = "sumyy";
static char __pyx_k__uint8[] = "uint8";
static char __pyx_k__value[] = "value";
static char __pyx_k__vhigh[] = "vhigh";
static char __pyx_k__vopen[] = "vopen";
static char __pyx_k__where[] = "where";
static char __pyx_k__width[] = "width";
static char __pyx_k__win_i[] = "win_i";
static char __pyx_k__win_k[] = "win_k";
static char __pyx_k__win_n[] = "win_n";
static char __pyx_k__zeros[] = "zeros";
static char __pyx_k____eq__[] = "__eq__";
static char __pyx_k____ge__[] = "__ge__";
static char __pyx_k____gt__[] = "__gt__";
static char __pyx_k____le__[] = "__le__";
static char __pyx_k____lt__[] = "__lt__";
static char __pyx_k____ne__[] = "__ne__";
static char __pyx_k__adjust[] = "adjust";
static char __pyx_k__arange[] = "arange";
static char __pyx_k__astype[] = "astype";
static char __pyx_k__bufarr[] = "bufarr";
static char __pyx_k__counts[] = "counts";
static char __pyx_k__in_arr[] = "in_arr";
static char __pyx_k__insert[] = "insert";
static char __pyx_k__labels[] = "labels";
static char __pyx_k__length[] = "length";
static char __pyx_k__median[] = "median";
static char __pyx_k__minute[] = "minute";
static char __pyx_k__neg_ct[] = "neg_ct";
static char __pyx_k__nright[] = "nright";
static char __pyx_k__object[] = "object";
static char __pyx_k__offset[] = "offset";
static char __pyx_k__oldbuf[] = "oldbuf";
static char __pyx_k__outbuf[] = "outbuf";
static char __pyx_k__output[] = "output";
static char __pyx_k__random[] = "random";
static char __pyx_k__remove[] = "remove";
static char __pyx_k__result[] = "result";
static char __pyx_k__second[] = "second";
static char __pyx_k__sorter[] = "sorter";
static char __pyx_k__sum_xx[] = "sum_xx";
static char __pyx_k__val_in[] = "val_in";
static char __pyx_k__values[] = "values";
static char __pyx_k__vclose[] = "vclose";
static char __pyx_k__window[] = "window";
static char __pyx_k____cmp__[] = "__cmp__";
static char __pyx_k___counts[] = "_counts";
static char __pyx_k__argsort[] = "argsort";
static char __pyx_k__asarray[] = "asarray";
static char __pyx_k__average[] = "average";
static char __pyx_k__avg_wgt[] = "avg_wgt";
static char __pyx_k__divisor[] = "divisor";
static char __pyx_k__float32[] = "float32";
static char __pyx_k__float64[] = "float64";
static char __pyx_k__indexer[] = "indexer";
static char __pyx_k__keep_na[] = "keep_na";
static char __pyx_k__members[] = "members";
static char __pyx_k__minpair[] = "minpair";
static char __pyx_k__nancorr[] = "nancorr";
static char __pyx_k__ngroups[] = "ngroups";
static char __pyx_k__nlevels[] = "nlevels";
static char __pyx_k__nonzero[] = "nonzero";
static char __pyx_k__object_[] = "object_";
static char __pyx_k__periods[] = "periods";
static char __pyx_k__putmask[] = "putmask";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__tot_wgt[] = "tot_wgt";
static char __pyx_k__val_win[] = "val_win";
static char __pyx_k__weights[] = "weights";
static char __pyx_k__Infinity[] = "Infinity";
static char __pyx_k__KeyError[] = "KeyError";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__datetime[] = "datetime";
static char __pyx_k__isfinite[] = "isfinite";
static char __pyx_k__last_obs[] = "last_obs";
static char __pyx_k__left_pos[] = "left_pos";
static char __pyx_k__lindexer[] = "lindexer";
static char __pyx_k__midpoint[] = "midpoint";
static char __pyx_k__pad_bool[] = "pad_bool";
static char __pyx_k__position[] = "position";
static char __pyx_k__quantile[] = "quantile";
static char __pyx_k__rindexer[] = "rindexer";
static char __pyx_k__roll_max[] = "roll_max";
static char __pyx_k__roll_min[] = "roll_min";
static char __pyx_k__roll_sum[] = "roll_sum";
static char __pyx_k__roll_var[] = "roll_var";
static char __pyx_k__skiplist[] = "skiplist";
static char __pyx_k__tiebreak[] = "tiebreak";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__argsorted[] = "argsorted";
static char __pyx_k__ascending[] = "ascending";
static char __pyx_k__got_first[] = "got_first";
static char __pyx_k__group_add[] = "group_add";
static char __pyx_k__group_ids[] = "group_ids";
static char __pyx_k__group_max[] = "group_max";
static char __pyx_k__group_min[] = "group_min";
static char __pyx_k__group_nth[] = "group_nth";
static char __pyx_k__group_var[] = "group_var";
static char __pyx_k__is_unique[] = "is_unique";
static char __pyx_k__isnullobj[] = "isnullobj";
static char __pyx_k__max_group[] = "max_group";
static char __pyx_k__mergesort[] = "mergesort";
static char __pyx_k__na_option[] = "na_option";
static char __pyx_k__nan_value[] = "nan_value";
static char __pyx_k__ones_like[] = "ones_like";
static char __pyx_k__pad_int32[] = "pad_int32";
static char __pyx_k__pad_int64[] = "pad_int64";
static char __pyx_k__right_pos[] = "right_pos";
static char __pyx_k__roll_kurt[] = "roll_kurt";
static char __pyx_k__roll_max2[] = "roll_max2";
static char __pyx_k__roll_mean[] = "roll_mean";
static char __pyx_k__roll_min2[] = "roll_min2";
static char __pyx_k__roll_skew[] = "roll_skew";
static char __pyx_k__sum_ranks[] = "sum_ranks";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__empty_like[] = "empty_like";
static char __pyx_k__fill_count[] = "fill_count";
static char __pyx_k__fill_value[] = "fill_value";
static char __pyx_k__group_last[] = "group_last";
static char __pyx_k__group_mean[] = "group_mean";
static char __pyx_k__group_ohlc[] = "group_ohlc";
static char __pyx_k__group_prod[] = "group_prod";
static char __pyx_k__inner_join[] = "inner_join";
static char __pyx_k__left_count[] = "left_count";
static char __pyx_k__max_groups[] = "max_groups";
static char __pyx_k__max_subseq[] = "max_subseq";
static char __pyx_k__min_subseq[] = "min_subseq";
static char __pyx_k__pad_object[] = "pad_object";
static char __pyx_k__pydatetime[] = "pydatetime";
static char __pyx_k__valid_locs[] = "valid_locs";
static char __pyx_k__zeros_like[] = "zeros_like";
static char __pyx_k__NegInfinity[] = "NegInfinity";
static char __pyx_k___check_minp[] = "_check_minp";
static char __pyx_k__arrmap_bool[] = "arrmap_bool";
static char __pyx_k__isnullobj2d[] = "isnullobj2d";
static char __pyx_k__left_sorter[] = "left_sorter";
static char __pyx_k__microsecond[] = "microsecond";
static char __pyx_k__pad_float64[] = "pad_float64";
static char __pyx_k__right_count[] = "right_count";
static char __pyx_k__roll_window[] = "roll_window";
static char __pyx_k__sorted_data[] = "sorted_data";
static char __pyx_k__tiebreakers[] = "tiebreakers";
static char __pyx_k__ties_method[] = "ties_method";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k___return_true[] = "_return_true";
static char __pyx_k__arrmap_int32[] = "arrmap_int32";
static char __pyx_k__arrmap_int64[] = "arrmap_int64";
static char __pyx_k__c_contiguous[] = "c_contiguous";
static char __pyx_k__f_contiguous[] = "f_contiguous";
static char __pyx_k__group_labels[] = "group_labels";
static char __pyx_k__group_median[] = "group_median";
static char __pyx_k__groupby_bool[] = "groupby_bool";
static char __pyx_k__is_lexsorted[] = "is_lexsorted";
static char __pyx_k__kth_smallest[] = "kth_smallest";
static char __pyx_k__left_indexer[] = "left_indexer";
static char __pyx_k__right_sorter[] = "right_sorter";
static char __pyx_k__roll_generic[] = "roll_generic";
static char __pyx_k__take_1d_bool[] = "take_1d_bool";
static char __pyx_k___return_false[] = "_return_false";
static char __pyx_k__arrmap_object[] = "arrmap_object";
static char __pyx_k__backfill_bool[] = "backfill_bool";
static char __pyx_k__diff_2d_int32[] = "diff_2d_int32";
static char __pyx_k__diff_2d_int64[] = "diff_2d_int64";
static char __pyx_k__expected_size[] = "expected_size";
static char __pyx_k__ffill_indexer[] = "ffill_indexer";
static char __pyx_k__group_add_bin[] = "group_add_bin";
static char __pyx_k__group_max_bin[] = "group_max_bin";
static char __pyx_k__group_min_bin[] = "group_min_bin";
static char __pyx_k__group_nth_bin[] = "group_nth_bin";
static char __pyx_k__group_var_bin[] = "group_var_bin";
static char __pyx_k__groupby_int32[] = "groupby_int32";
static char __pyx_k__groupby_int64[] = "groupby_int64";
static char __pyx_k__rank_1d_int64[] = "rank_1d_int64";
static char __pyx_k__rank_2d_int64[] = "rank_2d_int64";
static char __pyx_k__right_indexer[] = "right_indexer";
static char __pyx_k__roll_median_c[] = "roll_median_c";
static char __pyx_k__roll_quantile[] = "roll_quantile";
static char __pyx_k__take_1d_int32[] = "take_1d_int32";
static char __pyx_k__take_1d_int64[] = "take_1d_int64";
static char __pyx_k__arrmap_float64[] = "arrmap_float64";
static char __pyx_k__backfill_int32[] = "backfill_int32";
static char __pyx_k__backfill_int64[] = "backfill_int64";
static char __pyx_k__ffill_by_group[] = "ffill_by_group";
static char __pyx_k__group_last_bin[] = "group_last_bin";
static char __pyx_k__group_mean_bin[] = "group_mean_bin";
static char __pyx_k__group_prod_bin[] = "group_prod_bin";
static char __pyx_k__groupby_object[] = "groupby_object";
static char __pyx_k__list_of_arrays[] = "list_of_arrays";
static char __pyx_k__take_1d_object[] = "take_1d_object";
static char __pyx_k__backfill_object[] = "backfill_object";
static char __pyx_k__diff_2d_float64[] = "diff_2d_float64";
static char __pyx_k__full_outer_join[] = "full_outer_join";
static char __pyx_k__groupby_float64[] = "groupby_float64";
static char __pyx_k__groupby_indices[] = "groupby_indices";
static char __pyx_k__left_outer_join[] = "left_outer_join";
static char __pyx_k__rank_1d_float64[] = "rank_1d_float64";
static char __pyx_k__rank_1d_generic[] = "rank_1d_generic";
static char __pyx_k__rank_2d_float64[] = "rank_2d_float64";
static char __pyx_k__rank_2d_generic[] = "rank_2d_generic";
static char __pyx_k__take_1d_float64[] = "take_1d_float64";
static char __pyx_k__backfill_float64[] = "backfill_float64";
static char __pyx_k__group_nth_object[] = "group_nth_object";
static char __pyx_k__pad_inplace_bool[] = "pad_inplace_bool";
static char __pyx_k__group_last_object[] = "group_last_object";
static char __pyx_k__groupsort_indexer[] = "groupsort_indexer";
static char __pyx_k__is_monotonic_bool[] = "is_monotonic_bool";
static char __pyx_k__pad_inplace_int32[] = "pad_inplace_int32";
static char __pyx_k__pad_inplace_int64[] = "pad_inplace_int64";
static char __pyx_k__is_monotonic_int32[] = "is_monotonic_int32";
static char __pyx_k__is_monotonic_int64[] = "is_monotonic_int64";
static char __pyx_k__pad_inplace_object[] = "pad_inplace_object";
static char __pyx_k__roll_median_cython[] = "roll_median_cython";
static char __pyx_k__take_2d_axis0_bool[] = "take_2d_axis0_bool";
static char __pyx_k__take_2d_axis1_bool[] = "take_2d_axis1_bool";
static char __pyx_k__take_2d_multi_bool[] = "take_2d_multi_bool";
static char __pyx_k__NotImplementedError[] = "NotImplementedError";
static char __pyx_k___get_result_indexer[] = "_get_result_indexer";
static char __pyx_k__is_monotonic_object[] = "is_monotonic_object";
static char __pyx_k__pad_2d_inplace_bool[] = "pad_2d_inplace_bool";
static char __pyx_k__pad_inplace_float64[] = "pad_inplace_float64";
static char __pyx_k__take_2d_axis0_int32[] = "take_2d_axis0_int32";
static char __pyx_k__take_2d_axis0_int64[] = "take_2d_axis0_int64";
static char __pyx_k__take_2d_axis1_int32[] = "take_2d_axis1_int32";
static char __pyx_k__take_2d_axis1_int64[] = "take_2d_axis1_int64";
static char __pyx_k__take_2d_multi_int32[] = "take_2d_multi_int32";
static char __pyx_k__take_2d_multi_int64[] = "take_2d_multi_int64";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_n_s_102;
static PyObject *__pyx_n_s_103;
static PyObject *__pyx_kp_s_139;
static PyObject *__pyx_kp_u_140;
static PyObject *__pyx_kp_u_142;
static PyObject *__pyx_kp_u_144;
static PyObject *__pyx_kp_u_146;
static PyObject *__pyx_kp_u_147;
static PyObject *__pyx_kp_u_150;
static PyObject *__pyx_kp_s_152;
static PyObject *__pyx_n_s_155;
static PyObject *__pyx_kp_s_158;
static PyObject *__pyx_n_s_159;
static PyObject *__pyx_n_s_238;
static PyObject *__pyx_n_s_247;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_274;
static PyObject *__pyx_kp_s_288;
static PyObject *__pyx_n_s_319;
static PyObject *__pyx_n_s_322;
static PyObject *__pyx_n_s_325;
static PyObject *__pyx_n_s_328;
static PyObject *__pyx_n_s_331;
static PyObject *__pyx_n_s_334;
static PyObject *__pyx_n_s_337;
static PyObject *__pyx_n_s_340;
static PyObject *__pyx_n_s_343;
static PyObject *__pyx_n_s_348;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_n_s_351;
static PyObject *__pyx_n_s_354;
static PyObject *__pyx_n_s_357;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_n_s_360;
static PyObject *__pyx_n_s_373;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_n_s_404;
static PyObject *__pyx_n_s_407;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_n_s_418;
static PyObject *__pyx_n_s_427;
static PyObject *__pyx_n_s_430;
static PyObject *__pyx_n_s_439;
static PyObject *__pyx_n_s_44;
static PyObject *__pyx_n_s_442;
static PyObject *__pyx_n_s_445;
static PyObject *__pyx_n_s_448;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_n_s_451;
static PyObject *__pyx_n_s_454;
static PyObject *__pyx_n_s_457;
static PyObject *__pyx_n_s_460;
static PyObject *__pyx_n_s_463;
static PyObject *__pyx_n_s_466;
static PyObject *__pyx_n_s_469;
static PyObject *__pyx_n_s_472;
static PyObject *__pyx_n_s_475;
static PyObject *__pyx_n_s_478;
static PyObject *__pyx_n_s_481;
static PyObject *__pyx_n_s_484;
static PyObject *__pyx_kp_s_51;
static PyObject *__pyx_kp_s_92;
static PyObject *__pyx_n_s__A;
static PyObject *__pyx_n_s__B;
static PyObject *__pyx_n_s__C;
static PyObject *__pyx_n_s__D;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__Infinity;
static PyObject *__pyx_n_s__K;
static PyObject *__pyx_n_s__KeyError;
static PyObject *__pyx_n_s__N;
static PyObject *__pyx_n_s__NA;
static PyObject *__pyx_n_s__NIL;
static PyObject *__pyx_n_s__NINF;
static PyObject *__pyx_n_s__NaN;
static PyObject *__pyx_n_s__NegInfinity;
static PyObject *__pyx_n_s__NotImplementedError;
static PyObject *__pyx_n_s__O;
static PyObject *__pyx_n_s__R;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__S;
static PyObject *__pyx_n_s__T;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____cmp__;
static PyObject *__pyx_n_s____eq__;
static PyObject *__pyx_n_s____ge__;
static PyObject *__pyx_n_s____gt__;
static PyObject *__pyx_n_s____le__;
static PyObject *__pyx_n_s____lt__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____ne__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___as;
static PyObject *__pyx_n_s___check_minp;
static PyObject *__pyx_n_s___counts;
static PyObject *__pyx_n_s___get_result_indexer;
static PyObject *__pyx_n_s___return_false;
static PyObject *__pyx_n_s___return_true;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__adj;
static PyObject *__pyx_n_s__adjust;
static PyObject *__pyx_n_s__ai;
static PyObject *__pyx_n_s__aold;
static PyObject *__pyx_n_s__arange;
static PyObject *__pyx_n_s__arg;
static PyObject *__pyx_n_s__argsort;
static PyObject *__pyx_n_s__argsorted;
static PyObject *__pyx_n_s__arr;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__arrmap_bool;
static PyObject *__pyx_n_s__arrmap_float64;
static PyObject *__pyx_n_s__arrmap_int32;
static PyObject *__pyx_n_s__arrmap_int64;
static PyObject *__pyx_n_s__arrmap_object;
static PyObject *__pyx_n_s__asarray;
static PyObject *__pyx_n_s__ascending;
static PyObject *__pyx_n_s__astype;
static PyObject *__pyx_n_s__average;
static PyObject *__pyx_n_s__avg;
static PyObject *__pyx_n_s__avg_wgt;
static PyObject *__pyx_n_s__axis;
static PyObject *__pyx_n_s__b;
static PyObject *__pyx_n_s__backfill_bool;
static PyObject *__pyx_n_s__backfill_float64;
static PyObject *__pyx_n_s__backfill_int32;
static PyObject *__pyx_n_s__backfill_int64;
static PyObject *__pyx_n_s__backfill_object;
static PyObject *__pyx_n_s__bins;
static PyObject *__pyx_n_s__buf;
static PyObject *__pyx_n_s__bufarr;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_s__c_contiguous;
static PyObject *__pyx_n_s__com;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__count;
static PyObject *__pyx_n_s__counts;
static PyObject *__pyx_n_s__cov;
static PyObject *__pyx_n_s__ct;
static PyObject *__pyx_n_s__cur;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__datetime;
static PyObject *__pyx_n_s__day;
static PyObject *__pyx_n_s__ddof;
static PyObject *__pyx_n_s__diff_2d_float64;
static PyObject *__pyx_n_s__diff_2d_int32;
static PyObject *__pyx_n_s__diff_2d_int64;
static PyObject *__pyx_n_s__dim;
static PyObject *__pyx_n_s__dims;
static PyObject *__pyx_n_s__divisor;
static PyObject *__pyx_n_s__dtype;
static PyObject *__pyx_n_s__dups;
static PyObject *__pyx_n_s__e;
static PyObject *__pyx_n_s__empty;
static PyObject *__pyx_n_s__empty_like;
static PyObject *__pyx_n_s__end;
static PyObject *__pyx_n_s__ewma;
static PyObject *__pyx_n_s__expected_size;
static PyObject *__pyx_n_s__f8;
static PyObject *__pyx_n_s__f_contiguous;
static PyObject *__pyx_n_s__ffill_by_group;
static PyObject *__pyx_n_s__ffill_indexer;
static PyObject *__pyx_n_s__fill;
static PyObject *__pyx_n_s__fill_count;
static PyObject *__pyx_n_s__fill_value;
static PyObject *__pyx_n_s__first;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__float32;
static PyObject *__pyx_n_s__float64;
static PyObject *__pyx_n_s__full_outer_join;
static PyObject *__pyx_n_s__func;
static PyObject *__pyx_n_s__fv;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__gid;
static PyObject *__pyx_n_s__got_first;
static PyObject *__pyx_n_s__group_add;
static PyObject *__pyx_n_s__group_add_bin;
static PyObject *__pyx_n_s__group_ids;
static PyObject *__pyx_n_s__group_labels;
static PyObject *__pyx_n_s__group_last;
static PyObject *__pyx_n_s__group_last_bin;
static PyObject *__pyx_n_s__group_last_object;
static PyObject *__pyx_n_s__group_max;
static PyObject *__pyx_n_s__group_max_bin;
static PyObject *__pyx_n_s__group_mean;
static PyObject *__pyx_n_s__group_mean_bin;
static PyObject *__pyx_n_s__group_median;
static PyObject *__pyx_n_s__group_min;
static PyObject *__pyx_n_s__group_min_bin;
static PyObject *__pyx_n_s__group_nth;
static PyObject *__pyx_n_s__group_nth_bin;
static PyObject *__pyx_n_s__group_nth_object;
static PyObject *__pyx_n_s__group_ohlc;
static PyObject *__pyx_n_s__group_prod;
static PyObject *__pyx_n_s__group_prod_bin;
static PyObject *__pyx_n_s__group_var;
static PyObject *__pyx_n_s__group_var_bin;
static PyObject *__pyx_n_s__groupby_bool;
static PyObject *__pyx_n_s__groupby_float64;
static PyObject *__pyx_n_s__groupby_indices;
static PyObject *__pyx_n_s__groupby_int32;
static PyObject *__pyx_n_s__groupby_int64;
static PyObject *__pyx_n_s__groupby_object;
static PyObject *__pyx_n_s__groupsort_indexer;
static PyObject *__pyx_n_s__hour;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__i0;
static PyObject *__pyx_n_s__i8;
static PyObject *__pyx_n_s__ids;
static PyObject *__pyx_n_s__idx;
static PyObject *__pyx_n_s__idx0;
static PyObject *__pyx_n_s__idx1;
static PyObject *__pyx_n_s__iinfo;
static PyObject *__pyx_n_s__in_arr;
static PyObject *__pyx_n_s__in_i;
static PyObject *__pyx_n_s__in_k;
static PyObject *__pyx_n_s__in_n;
static PyObject *__pyx_n_s__index;
static PyObject *__pyx_n_s__indexer;
static PyObject *__pyx_n_s__inf;
static PyObject *__pyx_n_s__infs;
static PyObject *__pyx_n_s__inner_join;
static PyObject *__pyx_n_s__input;
static PyObject *__pyx_n_s__insert;
static PyObject *__pyx_n_s__int32;
static PyObject *__pyx_n_s__int64;
static PyObject *__pyx_n_s__int_;
static PyObject *__pyx_n_s__is_lexsorted;
static PyObject *__pyx_n_s__is_monotonic_bool;
static PyObject *__pyx_n_s__is_monotonic_int32;
static PyObject *__pyx_n_s__is_monotonic_int64;
static PyObject *__pyx_n_s__is_monotonic_object;
static PyObject *__pyx_n_s__is_unique;
static PyObject *__pyx_n_s__isfinite;
static PyObject *__pyx_n_s__isnan;
static PyObject *__pyx_n_s__isnullobj;
static PyObject *__pyx_n_s__isnullobj2d;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__k;
static PyObject *__pyx_n_s__keep;
static PyObject *__pyx_n_s__keep_na;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__kind;
static PyObject *__pyx_n_s__kth_smallest;
static PyObject *__pyx_n_s__l;
static PyObject *__pyx_n_s__lab;
static PyObject *__pyx_n_s__label;
static PyObject *__pyx_n_s__labels;
static PyObject *__pyx_n_s__last;
static PyObject *__pyx_n_s__last_obs;
static PyObject *__pyx_n_s__lc;
static PyObject *__pyx_n_s__left;
static PyObject *__pyx_n_s__left_count;
static PyObject *__pyx_n_s__left_indexer;
static PyObject *__pyx_n_s__left_outer_join;
static PyObject *__pyx_n_s__left_pos;
static PyObject *__pyx_n_s__left_sorter;
static PyObject *__pyx_n_s__length;
static PyObject *__pyx_n_s__lib;
static PyObject *__pyx_n_s__lim;
static PyObject *__pyx_n_s__limit;
static PyObject *__pyx_n_s__lindexer;
static PyObject *__pyx_n_s__list_of_arrays;
static PyObject *__pyx_n_s__loc;
static PyObject *__pyx_n_s__lval;
static PyObject *__pyx_n_s__m;
static PyObject *__pyx_n_s__mask;
static PyObject *__pyx_n_s__mat;
static PyObject *__pyx_n_s__max;
static PyObject *__pyx_n_s__max_group;
static PyObject *__pyx_n_s__max_groups;
static PyObject *__pyx_n_s__max_subseq;
static PyObject *__pyx_n_s__maxx;
static PyObject *__pyx_n_s__meanx;
static PyObject *__pyx_n_s__meany;
static PyObject *__pyx_n_s__median;
static PyObject *__pyx_n_s__members;
static PyObject *__pyx_n_s__mergesort;
static PyObject *__pyx_n_s__microsecond;
static PyObject *__pyx_n_s__midpoint;
static PyObject *__pyx_n_s__min;
static PyObject *__pyx_n_s__min_subseq;
static PyObject *__pyx_n_s__minp;
static PyObject *__pyx_n_s__minpair;
static PyObject *__pyx_n_s__minute;
static PyObject *__pyx_n_s__minx;
static PyObject *__pyx_n_s__month;
static PyObject *__pyx_n_s__n;
static PyObject *__pyx_n_s__n0;
static PyObject *__pyx_n_s__na_option;
static PyObject *__pyx_n_s__nan;
static PyObject *__pyx_n_s__nan_value;
static PyObject *__pyx_n_s__nancorr;
static PyObject *__pyx_n_s__nbins;
static PyObject *__pyx_n_s__neg_ct;
static PyObject *__pyx_n_s__new;
static PyObject *__pyx_n_s__neww;
static PyObject *__pyx_n_s__next;
static PyObject *__pyx_n_s__ngroups;
static PyObject *__pyx_n_s__nleft;
static PyObject *__pyx_n_s__nlevels;
static PyObject *__pyx_n_s__nobs;
static PyObject *__pyx_n_s__nonzero;
static PyObject *__pyx_n_s__np;
static PyObject *__pyx_n_s__nright;
static PyObject *__pyx_n_s__numpy;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__object_;
static PyObject *__pyx_n_s__offset;
static PyObject *__pyx_n_s__old;
static PyObject *__pyx_n_s__oldbuf;
static PyObject *__pyx_n_s__oldw;
static PyObject *__pyx_n_s__ones_like;
static PyObject *__pyx_n_s__other;
static PyObject *__pyx_n_s__out;
static PyObject *__pyx_n_s__outbuf;
static PyObject *__pyx_n_s__output;
static PyObject *__pyx_n_s__pad_2d_inplace_bool;
static PyObject *__pyx_n_s__pad_bool;
static PyObject *__pyx_n_s__pad_float64;
static PyObject *__pyx_n_s__pad_inplace_bool;
static PyObject *__pyx_n_s__pad_inplace_float64;
static PyObject *__pyx_n_s__pad_inplace_int32;
static PyObject *__pyx_n_s__pad_inplace_int64;
static PyObject *__pyx_n_s__pad_inplace_object;
static PyObject *__pyx_n_s__pad_int32;
static PyObject *__pyx_n_s__pad_int64;
static PyObject *__pyx_n_s__pad_object;
static PyObject *__pyx_n_s__periods;
static PyObject *__pyx_n_s__position;
static PyObject *__pyx_n_s__pre;
static PyObject *__pyx_n_s__prev;
static PyObject *__pyx_n_s__prodx;
static PyObject *__pyx_n_s__ptr;
static PyObject *__pyx_n_s__put;
static PyObject *__pyx_n_s__putmask;
static PyObject *__pyx_n_s__pydatetime;
static PyObject *__pyx_n_s__quantile;
static PyObject *__pyx_n_s__random;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__rank;
static PyObject *__pyx_n_s__rank_1d_float64;
static PyObject *__pyx_n_s__rank_1d_generic;
static PyObject *__pyx_n_s__rank_1d_int64;
static PyObject *__pyx_n_s__rank_2d_float64;
static PyObject *__pyx_n_s__rank_2d_generic;
static PyObject *__pyx_n_s__rank_2d_int64;
static PyObject *__pyx_n_s__ranks;
static PyObject *__pyx_n_s__rc;
static PyObject *__pyx_n_s__remove;
static PyObject *__pyx_n_s__res;
static PyObject *__pyx_n_s__result;
static PyObject *__pyx_n_s__resx;
static PyObject *__pyx_n_s__ret;
static PyObject *__pyx_n_s__retry;
static PyObject *__pyx_n_s__rev;
static PyObject *__pyx_n_s__reverse;
static PyObject *__pyx_n_s__right;
static PyObject *__pyx_n_s__right_count;
static PyObject *__pyx_n_s__right_indexer;
static PyObject *__pyx_n_s__right_pos;
static PyObject *__pyx_n_s__right_sorter;
static PyObject *__pyx_n_s__rindexer;
static PyObject *__pyx_n_s__ring;
static PyObject *__pyx_n_s__roll_generic;
static PyObject *__pyx_n_s__roll_kurt;
static PyObject *__pyx_n_s__roll_max;
static PyObject *__pyx_n_s__roll_max2;
static PyObject *__pyx_n_s__roll_mean;
static PyObject *__pyx_n_s__roll_median_c;
static PyObject *__pyx_n_s__roll_median_cython;
static PyObject *__pyx_n_s__roll_min;
static PyObject *__pyx_n_s__roll_min2;
static PyObject *__pyx_n_s__roll_quantile;
static PyObject *__pyx_n_s__roll_skew;
static PyObject *__pyx_n_s__roll_sum;
static PyObject *__pyx_n_s__roll_var;
static PyObject *__pyx_n_s__roll_window;
static PyObject *__pyx_n_s__rval;
static PyObject *__pyx_n_s__s;
static PyObject *__pyx_n_s__second;
static PyObject *__pyx_n_s__seen;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__skiplist;
static PyObject *__pyx_n_s__sl;
static PyObject *__pyx_n_s__sort;
static PyObject *__pyx_n_s__sorted_data;
static PyObject *__pyx_n_s__sorter;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__stop;
static PyObject *__pyx_n_s__sum_ranks;
static PyObject *__pyx_n_s__sum_x;
static PyObject *__pyx_n_s__sum_xx;
static PyObject *__pyx_n_s__sumx;
static PyObject *__pyx_n_s__sumxx;
static PyObject *__pyx_n_s__sumy;
static PyObject *__pyx_n_s__sumyy;
static PyObject *__pyx_n_s__sx;
static PyObject *__pyx_n_s__sy;
static PyObject *__pyx_n_s__t;
static PyObject *__pyx_n_s__take;
static PyObject *__pyx_n_s__take_1d_bool;
static PyObject *__pyx_n_s__take_1d_float64;
static PyObject *__pyx_n_s__take_1d_int32;
static PyObject *__pyx_n_s__take_1d_int64;
static PyObject *__pyx_n_s__take_1d_object;
static PyObject *__pyx_n_s__take_2d_axis0_bool;
static PyObject *__pyx_n_s__take_2d_axis0_int32;
static PyObject *__pyx_n_s__take_2d_axis0_int64;
static PyObject *__pyx_n_s__take_2d_axis1_bool;
static PyObject *__pyx_n_s__take_2d_axis1_int32;
static PyObject *__pyx_n_s__take_2d_axis1_int64;
static PyObject *__pyx_n_s__take_2d_multi_bool;
static PyObject *__pyx_n_s__take_2d_multi_int32;
static PyObject *__pyx_n_s__take_2d_multi_int64;
static PyObject *__pyx_n_s__tiebreak;
static PyObject *__pyx_n_s__tiebreakers;
static PyObject *__pyx_n_s__ties_method;
static PyObject *__pyx_n_s__top;
static PyObject *__pyx_n_s__tot_wgt;
static PyObject *__pyx_n_s__uint8;
static PyObject *__pyx_n_s__val;
static PyObject *__pyx_n_s__val_in;
static PyObject *__pyx_n_s__val_win;
static PyObject *__pyx_n_s__valid_locs;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__values;
static PyObject *__pyx_n_s__vclose;
static PyObject *__pyx_n_s__vecs;
static PyObject *__pyx_n_s__vhigh;
static PyObject *__pyx_n_s__view;
static PyObject *__pyx_n_s__vlow;
static PyObject *__pyx_n_s__vopen;
static PyObject *__pyx_n_s__vx;
static PyObject *__pyx_n_s__vy;
static PyObject *__pyx_n_s__w;
static PyObject *__pyx_n_s__weights;
static PyObject *__pyx_n_s__where;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__win;
static PyObject *__pyx_n_s__win_i;
static PyObject *__pyx_n_s__win_k;
static PyObject *__pyx_n_s__win_n;
static PyObject *__pyx_n_s__window;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xi;
static PyObject *__pyx_n_s__xx;
static PyObject *__pyx_n_s__xxx;
static PyObject *__pyx_n_s__xxxx;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__year;
static PyObject *__pyx_n_s__yi;
static PyObject *__pyx_n_s__z;
static PyObject *__pyx_n_s__zeros;
static PyObject *__pyx_n_s__zeros_like;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_100;
static PyObject *__pyx_k_3;
static PyObject *__pyx_k_6;
static PyObject *__pyx_k_9;
static PyObject *__pyx_k_15;
static PyObject *__pyx_k_21;
static PyObject *__pyx_k_27;
static PyObject *__pyx_k_39;
static PyObject *__pyx_k_47;
static PyObject *__pyx_k_91;
static PyObject *__pyx_k_94;
static PyObject *__pyx_k_96;
static PyObject *__pyx_k_98;
static PyObject *__pyx_k_100;
static PyObject *__pyx_k_104;
static PyObject *__pyx_k_106;
static PyObject *__pyx_k_108;
static PyObject *__pyx_k_110;
static PyObject *__pyx_k_112;
static PyObject *__pyx_k_114;
static PyObject *__pyx_k_116;
static PyObject *__pyx_k_118;
static PyObject *__pyx_k_120;
static PyObject *__pyx_k_122;
static PyObject *__pyx_k_124;
static PyObject *__pyx_k_127;
static PyObject *__pyx_k_130;
static PyObject *__pyx_k_133;
static PyObject *__pyx_k_136;
static PyObject *__pyx_k_slice_4;
static PyObject *__pyx_k_slice_7;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_slice_11;
static PyObject *__pyx_k_slice_12;
static PyObject *__pyx_k_slice_17;
static PyObject *__pyx_k_slice_18;
static PyObject *__pyx_k_slice_23;
static PyObject *__pyx_k_slice_30;
static PyObject *__pyx_k_slice_31;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_13;
static PyObject *__pyx_k_tuple_14;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_33;
static PyObject *__pyx_k_tuple_34;
static PyObject *__pyx_k_tuple_37;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_tuple_48;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_52;
static PyObject *__pyx_k_tuple_53;
static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_56;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_58;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_63;
static PyObject *__pyx_k_tuple_64;
static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_tuple_66;
static PyObject *__pyx_k_tuple_67;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_tuple_69;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_71;
static PyObject *__pyx_k_tuple_72;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_74;
static PyObject *__pyx_k_tuple_75;
static PyObject *__pyx_k_tuple_76;
static PyObject *__pyx_k_tuple_77;
static PyObject *__pyx_k_tuple_78;
static PyObject *__pyx_k_tuple_79;
static PyObject *__pyx_k_tuple_80;
static PyObject *__pyx_k_tuple_81;
static PyObject *__pyx_k_tuple_82;
static PyObject *__pyx_k_tuple_83;
static PyObject *__pyx_k_tuple_84;
static PyObject *__pyx_k_tuple_85;
static PyObject *__pyx_k_tuple_86;
static PyObject *__pyx_k_tuple_87;
static PyObject *__pyx_k_tuple_88;
static PyObject *__pyx_k_tuple_89;
static PyObject *__pyx_k_tuple_90;
static PyObject *__pyx_k_tuple_93;
static PyObject *__pyx_k_tuple_95;
static PyObject *__pyx_k_tuple_97;
static PyObject *__pyx_k_tuple_99;
static PyObject *__pyx_k_tuple_101;
static PyObject *__pyx_k_tuple_105;
static PyObject *__pyx_k_tuple_107;
static PyObject *__pyx_k_tuple_109;
static PyObject *__pyx_k_tuple_111;
static PyObject *__pyx_k_tuple_113;
static PyObject *__pyx_k_tuple_115;
static PyObject *__pyx_k_tuple_117;
static PyObject *__pyx_k_tuple_119;
static PyObject *__pyx_k_tuple_121;
static PyObject *__pyx_k_tuple_123;
static PyObject *__pyx_k_tuple_125;
static PyObject *__pyx_k_tuple_126;
static PyObject *__pyx_k_tuple_128;
static PyObject *__pyx_k_tuple_129;
static PyObject *__pyx_k_tuple_131;
static PyObject *__pyx_k_tuple_132;
static PyObject *__pyx_k_tuple_134;
static PyObject *__pyx_k_tuple_135;
static PyObject *__pyx_k_tuple_137;
static PyObject *__pyx_k_tuple_138;
static PyObject *__pyx_k_tuple_141;
static PyObject *__pyx_k_tuple_143;
static PyObject *__pyx_k_tuple_145;
static PyObject *__pyx_k_tuple_148;
static PyObject *__pyx_k_tuple_149;
static PyObject *__pyx_k_tuple_151;
static PyObject *__pyx_k_tuple_153;
static PyObject *__pyx_k_tuple_154;
static PyObject *__pyx_k_tuple_156;
static PyObject *__pyx_k_tuple_160;
static PyObject *__pyx_k_tuple_162;
static PyObject *__pyx_k_tuple_164;
static PyObject *__pyx_k_tuple_166;
static PyObject *__pyx_k_tuple_168;
static PyObject *__pyx_k_tuple_170;
static PyObject *__pyx_k_tuple_172;
static PyObject *__pyx_k_tuple_174;
static PyObject *__pyx_k_tuple_176;
static PyObject *__pyx_k_tuple_178;
static PyObject *__pyx_k_tuple_180;
static PyObject *__pyx_k_tuple_182;
static PyObject *__pyx_k_tuple_184;
static PyObject *__pyx_k_tuple_186;
static PyObject *__pyx_k_tuple_188;
static PyObject *__pyx_k_tuple_190;
static PyObject *__pyx_k_tuple_192;
static PyObject *__pyx_k_tuple_194;
static PyObject *__pyx_k_tuple_196;
static PyObject *__pyx_k_tuple_198;
static PyObject *__pyx_k_tuple_200;
static PyObject *__pyx_k_tuple_202;
static PyObject *__pyx_k_tuple_204;
static PyObject *__pyx_k_tuple_206;
static PyObject *__pyx_k_tuple_208;
static PyObject *__pyx_k_tuple_210;
static PyObject *__pyx_k_tuple_212;
static PyObject *__pyx_k_tuple_214;
static PyObject *__pyx_k_tuple_216;
static PyObject *__pyx_k_tuple_218;
static PyObject *__pyx_k_tuple_220;
static PyObject *__pyx_k_tuple_222;
static PyObject *__pyx_k_tuple_224;
static PyObject *__pyx_k_tuple_226;
static PyObject *__pyx_k_tuple_228;
static PyObject *__pyx_k_tuple_230;
static PyObject *__pyx_k_tuple_232;
static PyObject *__pyx_k_tuple_234;
static PyObject *__pyx_k_tuple_236;
static PyObject *__pyx_k_tuple_239;
static PyObject *__pyx_k_tuple_241;
static PyObject *__pyx_k_tuple_243;
static PyObject *__pyx_k_tuple_245;
static PyObject *__pyx_k_tuple_248;
static PyObject *__pyx_k_tuple_250;
static PyObject *__pyx_k_tuple_252;
static PyObject *__pyx_k_tuple_254;
static PyObject *__pyx_k_tuple_256;
static PyObject *__pyx_k_tuple_258;
static PyObject *__pyx_k_tuple_260;
static PyObject *__pyx_k_tuple_262;
static PyObject *__pyx_k_tuple_264;
static PyObject *__pyx_k_tuple_266;
static PyObject *__pyx_k_tuple_268;
static PyObject *__pyx_k_tuple_270;
static PyObject *__pyx_k_tuple_272;
static PyObject *__pyx_k_tuple_275;
static PyObject *__pyx_k_tuple_277;
static PyObject *__pyx_k_tuple_279;
static PyObject *__pyx_k_tuple_281;
static PyObject *__pyx_k_tuple_283;
static PyObject *__pyx_k_tuple_285;
static PyObject *__pyx_k_tuple_286;
static PyObject *__pyx_k_tuple_289;
static PyObject *__pyx_k_tuple_291;
static PyObject *__pyx_k_tuple_293;
static PyObject *__pyx_k_tuple_295;
static PyObject *__pyx_k_tuple_297;
static PyObject *__pyx_k_tuple_299;
static PyObject *__pyx_k_tuple_301;
static PyObject *__pyx_k_tuple_303;
static PyObject *__pyx_k_tuple_305;
static PyObject *__pyx_k_tuple_307;
static PyObject *__pyx_k_tuple_309;
static PyObject *__pyx_k_tuple_311;
static PyObject *__pyx_k_tuple_313;
static PyObject *__pyx_k_tuple_315;
static PyObject *__pyx_k_tuple_317;
static PyObject *__pyx_k_tuple_320;
static PyObject *__pyx_k_tuple_323;
static PyObject *__pyx_k_tuple_326;
static PyObject *__pyx_k_tuple_329;
static PyObject *__pyx_k_tuple_332;
static PyObject *__pyx_k_tuple_335;
static PyObject *__pyx_k_tuple_338;
static PyObject *__pyx_k_tuple_341;
static PyObject *__pyx_k_tuple_344;
static PyObject *__pyx_k_tuple_346;
static PyObject *__pyx_k_tuple_349;
static PyObject *__pyx_k_tuple_352;
static PyObject *__pyx_k_tuple_355;
static PyObject *__pyx_k_tuple_358;
static PyObject *__pyx_k_tuple_361;
static PyObject *__pyx_k_tuple_363;
static PyObject *__pyx_k_tuple_365;
static PyObject *__pyx_k_tuple_367;
static PyObject *__pyx_k_tuple_369;
static PyObject *__pyx_k_tuple_371;
static PyObject *__pyx_k_tuple_374;
static PyObject *__pyx_k_tuple_376;
static PyObject *__pyx_k_tuple_378;
static PyObject *__pyx_k_tuple_380;
static PyObject *__pyx_k_tuple_382;
static PyObject *__pyx_k_tuple_384;
static PyObject *__pyx_k_tuple_386;
static PyObject *__pyx_k_tuple_388;
static PyObject *__pyx_k_tuple_390;
static PyObject *__pyx_k_tuple_392;
static PyObject *__pyx_k_tuple_394;
static PyObject *__pyx_k_tuple_396;
static PyObject *__pyx_k_tuple_398;
static PyObject *__pyx_k_tuple_400;
static PyObject *__pyx_k_tuple_402;
static PyObject *__pyx_k_tuple_405;
static PyObject *__pyx_k_tuple_408;
static PyObject *__pyx_k_tuple_410;
static PyObject *__pyx_k_tuple_412;
static PyObject *__pyx_k_tuple_414;
static PyObject *__pyx_k_tuple_416;
static PyObject *__pyx_k_tuple_419;
static PyObject *__pyx_k_tuple_421;
static PyObject *__pyx_k_tuple_423;
static PyObject *__pyx_k_tuple_425;
static PyObject *__pyx_k_tuple_428;
static PyObject *__pyx_k_tuple_431;
static PyObject *__pyx_k_tuple_433;
static PyObject *__pyx_k_tuple_435;
static PyObject *__pyx_k_tuple_437;
static PyObject *__pyx_k_tuple_440;
static PyObject *__pyx_k_tuple_443;
static PyObject *__pyx_k_tuple_446;
static PyObject *__pyx_k_tuple_449;
static PyObject *__pyx_k_tuple_452;
static PyObject *__pyx_k_tuple_455;
static PyObject *__pyx_k_tuple_458;
static PyObject *__pyx_k_tuple_461;
static PyObject *__pyx_k_tuple_464;
static PyObject *__pyx_k_tuple_467;
static PyObject *__pyx_k_tuple_470;
static PyObject *__pyx_k_tuple_473;
static PyObject *__pyx_k_tuple_476;
static PyObject *__pyx_k_tuple_479;
static PyObject *__pyx_k_tuple_482;
static PyObject *__pyx_k_codeobj_157;
static PyObject *__pyx_k_codeobj_161;
static PyObject *__pyx_k_codeobj_163;
static PyObject *__pyx_k_codeobj_165;
static PyObject *__pyx_k_codeobj_167;
static PyObject *__pyx_k_codeobj_169;
static PyObject *__pyx_k_codeobj_171;
static PyObject *__pyx_k_codeobj_173;
static PyObject *__pyx_k_codeobj_175;
static PyObject *__pyx_k_codeobj_177;
static PyObject *__pyx_k_codeobj_179;
static PyObject *__pyx_k_codeobj_181;
static PyObject *__pyx_k_codeobj_183;
static PyObject *__pyx_k_codeobj_185;
static PyObject *__pyx_k_codeobj_187;
static PyObject *__pyx_k_codeobj_189;
static PyObject *__pyx_k_codeobj_191;
static PyObject *__pyx_k_codeobj_193;
static PyObject *__pyx_k_codeobj_195;
static PyObject *__pyx_k_codeobj_197;
static PyObject *__pyx_k_codeobj_199;
static PyObject *__pyx_k_codeobj_201;
static PyObject *__pyx_k_codeobj_203;
static PyObject *__pyx_k_codeobj_205;
static PyObject *__pyx_k_codeobj_207;
static PyObject *__pyx_k_codeobj_209;
static PyObject *__pyx_k_codeobj_211;
static PyObject *__pyx_k_codeobj_213;
static PyObject *__pyx_k_codeobj_215;
static PyObject *__pyx_k_codeobj_217;
static PyObject *__pyx_k_codeobj_219;
static PyObject *__pyx_k_codeobj_221;
static PyObject *__pyx_k_codeobj_223;
static PyObject *__pyx_k_codeobj_225;
static PyObject *__pyx_k_codeobj_227;
static PyObject *__pyx_k_codeobj_229;
static PyObject *__pyx_k_codeobj_231;
static PyObject *__pyx_k_codeobj_233;
static PyObject *__pyx_k_codeobj_235;
static PyObject *__pyx_k_codeobj_237;
static PyObject *__pyx_k_codeobj_240;
static PyObject *__pyx_k_codeobj_242;
static PyObject *__pyx_k_codeobj_244;
static PyObject *__pyx_k_codeobj_246;
static PyObject *__pyx_k_codeobj_249;
static PyObject *__pyx_k_codeobj_251;
static PyObject *__pyx_k_codeobj_253;
static PyObject *__pyx_k_codeobj_255;
static PyObject *__pyx_k_codeobj_257;
static PyObject *__pyx_k_codeobj_259;
static PyObject *__pyx_k_codeobj_261;
static PyObject *__pyx_k_codeobj_263;
static PyObject *__pyx_k_codeobj_265;
static PyObject *__pyx_k_codeobj_267;
static PyObject *__pyx_k_codeobj_269;
static PyObject *__pyx_k_codeobj_271;
static PyObject *__pyx_k_codeobj_273;
static PyObject *__pyx_k_codeobj_276;
static PyObject *__pyx_k_codeobj_278;
static PyObject *__pyx_k_codeobj_280;
static PyObject *__pyx_k_codeobj_282;
static PyObject *__pyx_k_codeobj_284;
static PyObject *__pyx_k_codeobj_287;
static PyObject *__pyx_k_codeobj_290;
static PyObject *__pyx_k_codeobj_292;
static PyObject *__pyx_k_codeobj_294;
static PyObject *__pyx_k_codeobj_296;
static PyObject *__pyx_k_codeobj_298;
static PyObject *__pyx_k_codeobj_300;
static PyObject *__pyx_k_codeobj_302;
static PyObject *__pyx_k_codeobj_304;
static PyObject *__pyx_k_codeobj_306;
static PyObject *__pyx_k_codeobj_308;
static PyObject *__pyx_k_codeobj_310;
static PyObject *__pyx_k_codeobj_312;
static PyObject *__pyx_k_codeobj_314;
static PyObject *__pyx_k_codeobj_316;
static PyObject *__pyx_k_codeobj_318;
static PyObject *__pyx_k_codeobj_321;
static PyObject *__pyx_k_codeobj_324;
static PyObject *__pyx_k_codeobj_327;
static PyObject *__pyx_k_codeobj_330;
static PyObject *__pyx_k_codeobj_333;
static PyObject *__pyx_k_codeobj_336;
static PyObject *__pyx_k_codeobj_339;
static PyObject *__pyx_k_codeobj_342;
static PyObject *__pyx_k_codeobj_345;
static PyObject *__pyx_k_codeobj_347;
static PyObject *__pyx_k_codeobj_350;
static PyObject *__pyx_k_codeobj_353;
static PyObject *__pyx_k_codeobj_356;
static PyObject *__pyx_k_codeobj_359;
static PyObject *__pyx_k_codeobj_362;
static PyObject *__pyx_k_codeobj_364;
static PyObject *__pyx_k_codeobj_366;
static PyObject *__pyx_k_codeobj_368;
static PyObject *__pyx_k_codeobj_370;
static PyObject *__pyx_k_codeobj_372;
static PyObject *__pyx_k_codeobj_375;
static PyObject *__pyx_k_codeobj_377;
static PyObject *__pyx_k_codeobj_379;
static PyObject *__pyx_k_codeobj_381;
static PyObject *__pyx_k_codeobj_383;
static PyObject *__pyx_k_codeobj_385;
static PyObject *__pyx_k_codeobj_387;
static PyObject *__pyx_k_codeobj_389;
static PyObject *__pyx_k_codeobj_391;
static PyObject *__pyx_k_codeobj_393;
static PyObject *__pyx_k_codeobj_395;
static PyObject *__pyx_k_codeobj_397;
static PyObject *__pyx_k_codeobj_399;
static PyObject *__pyx_k_codeobj_401;
static PyObject *__pyx_k_codeobj_403;
static PyObject *__pyx_k_codeobj_406;
static PyObject *__pyx_k_codeobj_409;
static PyObject *__pyx_k_codeobj_411;
static PyObject *__pyx_k_codeobj_413;
static PyObject *__pyx_k_codeobj_415;
static PyObject *__pyx_k_codeobj_417;
static PyObject *__pyx_k_codeobj_420;
static PyObject *__pyx_k_codeobj_422;
static PyObject *__pyx_k_codeobj_424;
static PyObject *__pyx_k_codeobj_426;
static PyObject *__pyx_k_codeobj_429;
static PyObject *__pyx_k_codeobj_432;
static PyObject *__pyx_k_codeobj_434;
static PyObject *__pyx_k_codeobj_436;
static PyObject *__pyx_k_codeobj_438;
static PyObject *__pyx_k_codeobj_441;
static PyObject *__pyx_k_codeobj_444;
static PyObject *__pyx_k_codeobj_447;
static PyObject *__pyx_k_codeobj_450;
static PyObject *__pyx_k_codeobj_453;
static PyObject *__pyx_k_codeobj_456;
static PyObject *__pyx_k_codeobj_459;
static PyObject *__pyx_k_codeobj_462;
static PyObject *__pyx_k_codeobj_465;
static PyObject *__pyx_k_codeobj_468;
static PyObject *__pyx_k_codeobj_471;
static PyObject *__pyx_k_codeobj_474;
static PyObject *__pyx_k_codeobj_477;
static PyObject *__pyx_k_codeobj_480;
static PyObject *__pyx_k_codeobj_483;

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_306lambda1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_306lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_6pandas_5algos_306lambda1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_306lambda1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_other = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lambda1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambda1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_6pandas_5algos_lambda1(__pyx_self, __pyx_v_self, __pyx_v_other);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":490
 *         return left != right
 * 
 * _return_false = lambda self, other: False             # <<<<<<<<<<<<<<
 * _return_true = lambda self, other: True
 * 
 */

static PyObject *__pyx_lambda_funcdef_6pandas_5algos_lambda1(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda1", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_307lambda2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_307lambda2 = {__Pyx_NAMESTR("lambda2"), (PyCFunction)__pyx_pw_6pandas_5algos_307lambda2, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_307lambda2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_other = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__other,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__other)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lambda2", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_other = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambda2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_lambda_funcdef_6pandas_5algos_lambda2(__pyx_self, __pyx_v_self, __pyx_v_other);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":491
 * 
 * _return_false = lambda self, other: False
 * _return_true = lambda self, other: True             # <<<<<<<<<<<<<<
 * 
 * class Infinity(object):
 */

static PyObject *__pyx_lambda_funcdef_6pandas_5algos_lambda2(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda2", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":39
 * 
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b             # <<<<<<<<<<<<<<
 * cdef inline int int_min(int a, int b): return a if a <= b else b
 * 
 */

static CYTHON_INLINE int __pyx_f_6pandas_5algos_int_max(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("int_max", 0);
  if ((__pyx_v_a >= __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

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

/* "pandas/algos.pyx":40
 * 
 * cdef inline int int_max(int a, int b): return a if a >= b else b
 * cdef inline int int_min(int a, int b): return a if a <= b else b             # <<<<<<<<<<<<<<
 * 
 * 
 */

static CYTHON_INLINE int __pyx_f_6pandas_5algos_int_min(int __pyx_v_a, int __pyx_v_b) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("int_min", 0);
  if ((__pyx_v_a <= __pyx_v_b)) {
    __pyx_t_1 = __pyx_v_a;
  } else {
    __pyx_t_1 = __pyx_v_b;
  }
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

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

/* "pandas/src/skiplist.pyx":18
 * # MSVC does not have log2!
 * 
 * cdef double Log2(double x):             # <<<<<<<<<<<<<<
 *     return log(x) / log(2.)
 * 
 */

static double __pyx_f_6pandas_5algos_Log2(double __pyx_v_x) {
  double __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("Log2", 0);

  /* "pandas/src/skiplist.pyx":19
 * 
 * cdef double Log2(double x):
 *     return log(x) / log(2.)             # <<<<<<<<<<<<<<
 * 
 * cimport numpy as np
 */
  __pyx_t_1 = log(__pyx_v_x);
  __pyx_t_2 = log(2.);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = (__pyx_t_1 / __pyx_t_2);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("pandas.algos.Log2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __pyx_t_5numpy_double_t __pyx_v_value;
  PyObject *__pyx_v_next = 0;
  PyObject *__pyx_v_width = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__value,&__pyx_n_s__next,&__pyx_n_s__width,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__value)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__next)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __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_value = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_value == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_next = ((PyObject*)values[1]);
    __pyx_v_width = ((PyObject*)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.Node.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_next), (&PyList_Type), 1, "next", 1))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_width), (&PyList_Type), 1, "width", 1))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_4Node___init__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self), __pyx_v_value, __pyx_v_next, __pyx_v_width);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":38
 *         list width
 * 
 *     def __init__(self, double_t value, list next, list width):             # <<<<<<<<<<<<<<
 *         self.value = value
 *         self.next = next
 */

static int __pyx_pf_6pandas_5algos_4Node___init__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, __pyx_t_5numpy_double_t __pyx_v_value, PyObject *__pyx_v_next, PyObject *__pyx_v_width) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pandas/src/skiplist.pyx":39
 * 
 *     def __init__(self, double_t value, list next, list width):
 *         self.value = value             # <<<<<<<<<<<<<<
 *         self.next = next
 *         self.width = width
 */
  __pyx_v_self->value = __pyx_v_value;

  /* "pandas/src/skiplist.pyx":40
 *     def __init__(self, double_t value, list next, list width):
 *         self.value = value
 *         self.next = next             # <<<<<<<<<<<<<<
 *         self.width = width
 * 
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_next));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_next));
  __Pyx_GOTREF(__pyx_v_self->next);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->next));
  __pyx_v_self->next = __pyx_v_next;

  /* "pandas/src/skiplist.pyx":41
 *         self.value = value
 *         self.next = next
 *         self.width = width             # <<<<<<<<<<<<<<
 * 
 * # Singleton terminator node
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_width));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_width));
  __Pyx_GOTREF(__pyx_v_self->width);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->width));
  __pyx_v_self->width = __pyx_v_width;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_4Node_5value_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_4Node_5value_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_5value___get__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":34
 * cdef class Node:
 *     cdef public:
 *         double_t value             # <<<<<<<<<<<<<<
 *         list next
 *         list width
 */

static PyObject *__pyx_pf_6pandas_5algos_4Node_5value___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.Node.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_5value_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_5value_2__set__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pandas_5algos_4Node_5value_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __pyx_t_5numpy_double_t __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->value = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pandas.algos.Node.value.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_4Node_4next_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_4Node_4next_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_4next___get__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":35
 *     cdef public:
 *         double_t value
 *         list next             # <<<<<<<<<<<<<<
 *         list width
 * 
 */

static PyObject *__pyx_pf_6pandas_5algos_4Node_4next___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->next));
  __pyx_r = ((PyObject *)__pyx_v_self->next);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_4next_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_4next_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_4next_2__set__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pandas_5algos_4Node_4next_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->next);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->next));
  __pyx_v_self->next = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pandas.algos.Node.next.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_4next_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_4next_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_4next_4__del__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pandas_5algos_4Node_4next_4__del__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->next);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->next));
  __pyx_v_self->next = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_4Node_5width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_4Node_5width_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_5width___get__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":36
 *         double_t value
 *         list next
 *         list width             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, double_t value, list next, list width):
 */

static PyObject *__pyx_pf_6pandas_5algos_4Node_5width___get__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->width));
  __pyx_r = ((PyObject *)__pyx_v_self->width);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_5width_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_5width_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_5width_2__set__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pandas_5algos_4Node_5width_2__set__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->width);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->width));
  __pyx_v_self->width = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("pandas.algos.Node.width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_4Node_5width_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6pandas_5algos_4Node_5width_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_4Node_5width_4__del__(((struct __pyx_obj_6pandas_5algos_Node *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6pandas_5algos_4Node_5width_4__del__(struct __pyx_obj_6pandas_5algos_Node *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->width);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->width));
  __pyx_v_self->width = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_6pandas_5algos_17IndexableSkiplist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6pandas_5algos_17IndexableSkiplist_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expected_size = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__expected_size,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_100);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__expected_size);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_expected_size = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist___init__(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self), __pyx_v_expected_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":55
 *         Node head
 * 
 *     def __init__(self, expected_size=100):             # <<<<<<<<<<<<<<
 *         self.size = 0
 *         self.maxlevels = int(1 + Log2(expected_size))
 */

static int __pyx_pf_6pandas_5algos_17IndexableSkiplist___init__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, PyObject *__pyx_v_expected_size) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "pandas/src/skiplist.pyx":56
 * 
 *     def __init__(self, expected_size=100):
 *         self.size = 0             # <<<<<<<<<<<<<<
 *         self.maxlevels = int(1 + Log2(expected_size))
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels)
 */
  __pyx_v_self->size = 0;

  /* "pandas/src/skiplist.pyx":57
 *     def __init__(self, expected_size=100):
 *         self.size = 0
 *         self.maxlevels = int(1 + Log2(expected_size))             # <<<<<<<<<<<<<<
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels)
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_expected_size); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->maxlevels = ((Py_ssize_t)(1.0 + __pyx_f_6pandas_5algos_Log2(__pyx_t_1)));

  /* "pandas/src/skiplist.pyx":58
 *         self.size = 0
 *         self.maxlevels = int(1 + Log2(expected_size))
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NIL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyList_New(1 * ((__pyx_v_self->maxlevels<0) ? 0:__pyx_v_self->maxlevels)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_self->maxlevels; __pyx_temp++) {
      __Pyx_INCREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_4, __pyx_temp, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(1 * ((__pyx_v_self->maxlevels<0) ? 0:__pyx_v_self->maxlevels)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_self->maxlevels; __pyx_temp++) {
      __Pyx_INCREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, __pyx_temp, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
    }
  }
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_5algos_Node)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->head);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->head));
  __pyx_v_self->head = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_2);
  __pyx_t_2 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static Py_ssize_t __pyx_pw_6pandas_5algos_17IndexableSkiplist_3__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6pandas_5algos_17IndexableSkiplist_3__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist_2__len__(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":60
 *         self.head = Node(np.NaN, [NIL] * self.maxlevels, [1] * self.maxlevels)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.size
 * 
 */

static Py_ssize_t __pyx_pf_6pandas_5algos_17IndexableSkiplist_2__len__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "pandas/src/skiplist.pyx":61
 * 
 *     def __len__(self):
 *         return self.size             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, i):
 */
  __pyx_r = __pyx_v_self->size;
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist_4__getitem__(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self), ((PyObject *)__pyx_v_i));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":63
 *         return self.size
 * 
 *     def __getitem__(self, i):             # <<<<<<<<<<<<<<
 *         return self.get(i)
 * 
 */

static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_4__getitem__(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, PyObject *__pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "pandas/src/skiplist.pyx":64
 * 
 *     def __getitem__(self, i):
 *         return self.get(i)             # <<<<<<<<<<<<<<
 * 
 *     cpdef get(self, Py_ssize_t i):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":66
 *         return self.get(i)
 * 
 *     cpdef get(self, Py_ssize_t i):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level
 *         cdef Node node
 */

static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_7get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_17IndexableSkiplist_get(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, Py_ssize_t __pyx_v_i, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_level;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_node = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_7get)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/skiplist.pyx":70
 *         cdef Node node
 * 
 *         node = self.head             # <<<<<<<<<<<<<<
 *         i += 1
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->head);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_node = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":71
 * 
 *         node = self.head
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 */
  __pyx_v_i = (__pyx_v_i + 1);

  /* "pandas/src/skiplist.pyx":73
 *         i += 1
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             while node.width[level] <= i:
 *                 i -= node.width[level]
 */
  for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) {
    __pyx_v_level = __pyx_t_4;

    /* "pandas/src/skiplist.pyx":74
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             while node.width[level] <= i:             # <<<<<<<<<<<<<<
 *                 i -= node.width[level]
 *                 node = node.next[level]
 */
    while (1) {
      if (unlikely(((PyObject *)__pyx_v_node->width) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) break;

      /* "pandas/src/skiplist.pyx":75
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             while node.width[level] <= i:
 *                 i -= node.width[level]             # <<<<<<<<<<<<<<
 *                 node = node.next[level]
 * 
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(((PyObject *)__pyx_v_node->width) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_i = __pyx_t_6;

      /* "pandas/src/skiplist.pyx":76
 *             while node.width[level] <= i:
 *                 i -= node.width[level]
 *                 node = node.next[level]             # <<<<<<<<<<<<<<
 * 
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_node->next) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
      __pyx_t_1 = 0;
    }
  }

  /* "pandas/src/skiplist.pyx":79
 * 
 * 
 *         return node.value             # <<<<<<<<<<<<<<
 * 
 *     cpdef insert(self, double value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_node->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_7get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_7get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  assert(__pyx_arg_i); {
    __pyx_v_i = __Pyx_PyIndex_AsSsize_t(__pyx_arg_i); if (unlikely((__pyx_v_i == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist_6get(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self), ((Py_ssize_t)__pyx_v_i));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":66
 *         return self.get(i)
 * 
 *     cpdef get(self, Py_ssize_t i):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level
 *         cdef Node node
 */

static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_6get(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, Py_ssize_t __pyx_v_i) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":81
 *         return node.value
 * 
 *     cpdef insert(self, double value):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level, steps, d
 *         cdef Node node, prevnode, newnode, next_at_level, tmp
 */

static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_9insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_17IndexableSkiplist_insert(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_level;
  Py_ssize_t __pyx_v_steps;
  Py_ssize_t __pyx_v_d;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_node = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_prevnode = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_newnode = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_next_at_level = 0;
  PyObject *__pyx_v_chain = 0;
  PyObject *__pyx_v_steps_at_level = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__insert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_9insert)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/skiplist.pyx":87
 * 
 *         # find first node on each level where node.next[levels].value > value
 *         chain = [None] * self.maxlevels             # <<<<<<<<<<<<<<
 *         steps_at_level = [0] * self.maxlevels
 *         node = self.head
 */
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_self->maxlevels<0) ? 0:__pyx_v_self->maxlevels)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_self->maxlevels; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
  }
  __pyx_v_chain = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":88
 *         # find first node on each level where node.next[levels].value > value
 *         chain = [None] * self.maxlevels
 *         steps_at_level = [0] * self.maxlevels             # <<<<<<<<<<<<<<
 *         node = self.head
 * 
 */
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_self->maxlevels<0) ? 0:__pyx_v_self->maxlevels)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_self->maxlevels; __pyx_temp++) {
      __Pyx_INCREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
    }
  }
  __pyx_v_steps_at_level = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":89
 *         chain = [None] * self.maxlevels
 *         steps_at_level = [0] * self.maxlevels
 *         node = self.head             # <<<<<<<<<<<<<<
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->head);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_node = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":91
 *         node = self.head
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             next_at_level = node.next[level]
 * 
 */
  for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) {
    __pyx_v_level = __pyx_t_4;

    /* "pandas/src/skiplist.pyx":92
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             while next_at_level.value <= value:
 */
    if (unlikely(((PyObject *)__pyx_v_node->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_next_at_level));
    __pyx_v_next_at_level = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pandas/src/skiplist.pyx":94
 *             next_at_level = node.next[level]
 * 
 *             while next_at_level.value <= value:             # <<<<<<<<<<<<<<
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])
 */
    while (1) {
      __pyx_t_5 = (__pyx_v_next_at_level->value <= __pyx_v_value);
      if (!__pyx_t_5) break;

      /* "pandas/src/skiplist.pyx":95
 * 
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +             # <<<<<<<<<<<<<<
 *                                          node.width[level])
 *                 node = next_at_level
 */
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "pandas/src/skiplist.pyx":96
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])             # <<<<<<<<<<<<<<
 *                 node = next_at_level
 *                 next_at_level = node.next[level]
 */
      if (unlikely(((PyObject *)__pyx_v_node->width) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->width), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "pandas/src/skiplist.pyx":95
 * 
 *             while next_at_level.value <= value:
 *                 steps_at_level[level] = (steps_at_level[level] +             # <<<<<<<<<<<<<<
 *                                          node.width[level])
 *                 node = next_at_level
 */
      if (__Pyx_SetItemInt(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pandas/src/skiplist.pyx":97
 *                 steps_at_level[level] = (steps_at_level[level] +
 *                                          node.width[level])
 *                 node = next_at_level             # <<<<<<<<<<<<<<
 *                 next_at_level = node.next[level]
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_next_at_level));
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = __pyx_v_next_at_level;

      /* "pandas/src/skiplist.pyx":98
 *                                          node.width[level])
 *                 node = next_at_level
 *                 next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             chain[level] = node
 */
      if (unlikely(((PyObject *)__pyx_v_node->next) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
      __pyx_v_next_at_level = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_3);
      __pyx_t_3 = 0;
    }

    /* "pandas/src/skiplist.pyx":100
 *                 next_at_level = node.next[level]
 * 
 *             chain[level] = node             # <<<<<<<<<<<<<<
 * 
 *         # insert a link to the newnode at each level
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_chain), __pyx_v_level, ((PyObject *)__pyx_v_node), sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pandas/src/skiplist.pyx":103
 * 
 *         # insert a link to the newnode at each level
 *         d = min(self.maxlevels, 1 - int(Log2(random())))             # <<<<<<<<<<<<<<
 *         newnode = Node(value, [None] * d, [None] * d)
 *         steps = 0
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_f_6pandas_5algos_Log2(__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_v_self->maxlevels;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_5) {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_d = __pyx_t_4;

  /* "pandas/src/skiplist.pyx":104
 *         # insert a link to the newnode at each level
 *         d = min(self.maxlevels, 1 - int(Log2(random())))
 *         newnode = Node(value, [None] * d, [None] * d)             # <<<<<<<<<<<<<<
 *         steps = 0
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(1 * ((__pyx_v_d<0) ? 0:__pyx_v_d)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_d; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      PyList_SET_ITEM(__pyx_t_3, __pyx_temp, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
  }
  __pyx_t_7 = PyList_New(1 * ((__pyx_v_d<0) ? 0:__pyx_v_d)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_d; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      PyList_SET_ITEM(__pyx_t_7, __pyx_temp, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
  }
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_5algos_Node)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_newnode = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pandas/src/skiplist.pyx":105
 *         d = min(self.maxlevels, 1 - int(Log2(random())))
 *         newnode = Node(value, [None] * d, [None] * d)
 *         steps = 0             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d):
 */
  __pyx_v_steps = 0;

  /* "pandas/src/skiplist.pyx":107
 *         steps = 0
 * 
 *         for level in range(d):             # <<<<<<<<<<<<<<
 *             prevnode = chain[level]
 *             newnode.next[level] = prevnode.next[level]
 */
  __pyx_t_4 = __pyx_v_d;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_4; __pyx_t_8+=1) {
    __pyx_v_level = __pyx_t_8;

    /* "pandas/src/skiplist.pyx":108
 * 
 *         for level in range(d):
 *             prevnode = chain[level]             # <<<<<<<<<<<<<<
 *             newnode.next[level] = prevnode.next[level]
 *             prevnode.next[level] = newnode
 */
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_prevnode));
    __pyx_v_prevnode = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_7);
    __pyx_t_7 = 0;

    /* "pandas/src/skiplist.pyx":109
 *         for level in range(d):
 *             prevnode = chain[level]
 *             newnode.next[level] = prevnode.next[level]             # <<<<<<<<<<<<<<
 *             prevnode.next[level] = newnode
 *             newnode.width[level] = (prevnode.width[level] - steps)
 */
    if (unlikely(((PyObject *)__pyx_v_prevnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(((PyObject *)__pyx_v_newnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_newnode->next), __pyx_v_level, __pyx_t_7, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pandas/src/skiplist.pyx":110
 *             prevnode = chain[level]
 *             newnode.next[level] = prevnode.next[level]
 *             prevnode.next[level] = newnode             # <<<<<<<<<<<<<<
 *             newnode.width[level] = (prevnode.width[level] - steps)
 *             prevnode.width[level] = steps + 1
 */
    if (unlikely(((PyObject *)__pyx_v_prevnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, ((PyObject *)__pyx_v_newnode), sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "pandas/src/skiplist.pyx":111
 *             newnode.next[level] = prevnode.next[level]
 *             prevnode.next[level] = newnode
 *             newnode.width[level] = (prevnode.width[level] - steps)             # <<<<<<<<<<<<<<
 *             prevnode.width[level] = steps + 1
 *             steps += steps_at_level[level]
 */
    if (unlikely(((PyObject *)__pyx_v_prevnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->width), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(((PyObject *)__pyx_v_newnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_newnode->width), __pyx_v_level, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pandas/src/skiplist.pyx":112
 *             prevnode.next[level] = newnode
 *             newnode.width[level] = (prevnode.width[level] - steps)
 *             prevnode.width[level] = steps + 1             # <<<<<<<<<<<<<<
 *             steps += steps_at_level[level]
 * 
 */
    __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_steps + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(((PyObject *)__pyx_v_prevnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->width), __pyx_v_level, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "pandas/src/skiplist.pyx":113
 *             newnode.width[level] = (prevnode.width[level] - steps)
 *             prevnode.width[level] = steps + 1
 *             steps += steps_at_level[level]             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d, self.maxlevels):
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_steps); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_steps_at_level), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_steps = __pyx_t_9;
  }

  /* "pandas/src/skiplist.pyx":115
 *             steps += steps_at_level[level]
 * 
 *         for level in range(d, self.maxlevels):             # <<<<<<<<<<<<<<
 *             (<Node> chain[level]).width[level] += 1
 * 
 */
  __pyx_t_4 = __pyx_v_self->maxlevels;
  for (__pyx_t_8 = __pyx_v_d; __pyx_t_8 < __pyx_t_4; __pyx_t_8+=1) {
    __pyx_v_level = __pyx_t_8;

    /* "pandas/src/skiplist.pyx":116
 * 
 *         for level in range(d, self.maxlevels):
 *             (<Node> chain[level]).width[level] += 1             # <<<<<<<<<<<<<<
 * 
 *         self.size += 1
 */
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (unlikely(((PyObject *)((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_7)->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_7)->width));
    __pyx_t_10 = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_7)->width;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_9 = __pyx_v_level;
    if (unlikely(((PyObject *)__pyx_t_10) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_10), __pyx_t_9, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(((PyObject *)__pyx_t_10) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_t_10), __pyx_t_9, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  }

  /* "pandas/src/skiplist.pyx":118
 *             (<Node> chain[level]).width[level] += 1
 * 
 *         self.size += 1             # <<<<<<<<<<<<<<
 * 
 *     cpdef remove(self, double value):
 */
  __pyx_v_self->size = (__pyx_v_self->size + 1);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(((PyObject *)__pyx_t_10));
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_prevnode);
  __Pyx_XDECREF((PyObject *)__pyx_v_newnode);
  __Pyx_XDECREF((PyObject *)__pyx_v_next_at_level);
  __Pyx_XDECREF(__pyx_v_chain);
  __Pyx_XDECREF(__pyx_v_steps_at_level);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_9insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_9insert(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("insert (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist_8insert(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self), ((double)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":81
 *         return node.value
 * 
 *     cpdef insert(self, double value):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level, steps, d
 *         cdef Node node, prevnode, newnode, next_at_level, tmp
 */

static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_8insert(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("insert", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_self->__pyx_vtab)->insert(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.insert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":120
 *         self.size += 1
 * 
 *     cpdef remove(self, double value):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level, d
 *         cdef Node node, prevnode, tmpnode, next_at_level
 */

static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_11remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_17IndexableSkiplist_remove(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value, int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_level;
  Py_ssize_t __pyx_v_d;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_node = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_prevnode = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_tmpnode = 0;
  struct __pyx_obj_6pandas_5algos_Node *__pyx_v_next_at_level = 0;
  PyObject *__pyx_v_chain = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__remove); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_11remove)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/skiplist.pyx":126
 * 
 *         # find first node on each level where node.next[levels].value >= value
 *         chain = [None] * self.maxlevels             # <<<<<<<<<<<<<<
 *         node = self.head
 * 
 */
  __pyx_t_1 = PyList_New(1 * ((__pyx_v_self->maxlevels<0) ? 0:__pyx_v_self->maxlevels)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  { Py_ssize_t __pyx_temp;
    for (__pyx_temp=0; __pyx_temp < __pyx_v_self->maxlevels; __pyx_temp++) {
      __Pyx_INCREF(Py_None);
      PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
  }
  __pyx_v_chain = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":127
 *         # find first node on each level where node.next[levels].value >= value
 *         chain = [None] * self.maxlevels
 *         node = self.head             # <<<<<<<<<<<<<<
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->head);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_node = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":129
 *         node = self.head
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:
 */
  for (__pyx_t_4 = (__pyx_v_self->maxlevels - 1); __pyx_t_4 > -1; __pyx_t_4-=1) {
    __pyx_v_level = __pyx_t_4;

    /* "pandas/src/skiplist.pyx":130
 * 
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 *             while next_at_level.value < value:
 *                 node = next_at_level
 */
    if (unlikely(((PyObject *)__pyx_v_node->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_next_at_level));
    __pyx_v_next_at_level = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pandas/src/skiplist.pyx":131
 *         for level in range(self.maxlevels - 1, -1, -1):
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:             # <<<<<<<<<<<<<<
 *                 node = next_at_level
 *                 next_at_level = node.next[level]
 */
    while (1) {
      __pyx_t_5 = (__pyx_v_next_at_level->value < __pyx_v_value);
      if (!__pyx_t_5) break;

      /* "pandas/src/skiplist.pyx":132
 *             next_at_level = node.next[level]
 *             while next_at_level.value < value:
 *                 node = next_at_level             # <<<<<<<<<<<<<<
 *                 next_at_level = node.next[level]
 * 
 */
      __Pyx_INCREF(((PyObject *)__pyx_v_next_at_level));
      __Pyx_DECREF(((PyObject *)__pyx_v_node));
      __pyx_v_node = __pyx_v_next_at_level;

      /* "pandas/src/skiplist.pyx":133
 *             while next_at_level.value < value:
 *                 node = next_at_level
 *                 next_at_level = node.next[level]             # <<<<<<<<<<<<<<
 * 
 *             chain[level] = node
 */
      if (unlikely(((PyObject *)__pyx_v_node->next) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_node->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_next_at_level));
      __pyx_v_next_at_level = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
      __pyx_t_1 = 0;
    }

    /* "pandas/src/skiplist.pyx":135
 *                 next_at_level = node.next[level]
 * 
 *             chain[level] = node             # <<<<<<<<<<<<<<
 * 
 *         if value != (<Node> (<Node> (<Node> chain[0]).next)[0]).value:
 */
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_chain), __pyx_v_level, ((PyObject *)__pyx_v_node), sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "pandas/src/skiplist.pyx":137
 *             chain[level] = node
 * 
 *         if value != (<Node> (<Node> (<Node> chain[0]).next)[0]).value:             # <<<<<<<<<<<<<<
 *             raise KeyError('Not Found')
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1)->next), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = (__pyx_v_value != ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_2)->value);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "pandas/src/skiplist.pyx":138
 * 
 *         if value != (<Node> (<Node> (<Node> chain[0]).next)[0]).value:
 *             raise KeyError('Not Found')             # <<<<<<<<<<<<<<
 * 
 *         # remove one link at each level
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "pandas/src/skiplist.pyx":141
 * 
 *         # remove one link at each level
 *         d = len((<Node> (<Node> (<Node> chain[0]).next)[0]).next)             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d):
 */
  __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_2)->next), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = ((PyObject *)((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1)->next);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(__pyx_t_2 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = PyList_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_d = __pyx_t_4;

  /* "pandas/src/skiplist.pyx":143
 *         d = len((<Node> (<Node> (<Node> chain[0]).next)[0]).next)
 * 
 *         for level in range(d):             # <<<<<<<<<<<<<<
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]
 */
  __pyx_t_4 = __pyx_v_d;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_4; __pyx_t_6+=1) {
    __pyx_v_level = __pyx_t_6;

    /* "pandas/src/skiplist.pyx":144
 * 
 *         for level in range(d):
 *             prevnode = chain[level]             # <<<<<<<<<<<<<<
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1
 */
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_prevnode));
    __pyx_v_prevnode = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pandas/src/skiplist.pyx":145
 *         for level in range(d):
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]             # <<<<<<<<<<<<<<
 *             prevnode.width[level] += tmpnode.width[level] - 1
 *             prevnode.next[level] = tmpnode.next[level]
 */
    if (unlikely(((PyObject *)__pyx_v_prevnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_tmpnode));
    __pyx_v_tmpnode = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pandas/src/skiplist.pyx":146
 *             prevnode = chain[level]
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1             # <<<<<<<<<<<<<<
 *             prevnode.next[level] = tmpnode.next[level]
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_prevnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_prevnode->width));
    __pyx_t_7 = __pyx_v_prevnode->width;
    __pyx_t_8 = __pyx_v_level;
    if (unlikely(((PyObject *)__pyx_t_7) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_7), __pyx_t_8, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(((PyObject *)__pyx_v_tmpnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_tmpnode->width), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(((PyObject *)__pyx_t_7) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_t_7), __pyx_t_8, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

    /* "pandas/src/skiplist.pyx":147
 *             tmpnode = prevnode.next[level]
 *             prevnode.width[level] += tmpnode.width[level] - 1
 *             prevnode.next[level] = tmpnode.next[level]             # <<<<<<<<<<<<<<
 * 
 *         for level in range(d, self.maxlevels):
 */
    if (unlikely(((PyObject *)__pyx_v_tmpnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_tmpnode->next), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (unlikely(((PyObject *)__pyx_v_prevnode->next) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_prevnode->next), __pyx_v_level, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/skiplist.pyx":149
 *             prevnode.next[level] = tmpnode.next[level]
 * 
 *         for level in range(d, self.maxlevels):             # <<<<<<<<<<<<<<
 *             tmpnode = chain[level]
 *             tmpnode.width[level] -= 1
 */
  __pyx_t_4 = __pyx_v_self->maxlevels;
  for (__pyx_t_6 = __pyx_v_d; __pyx_t_6 < __pyx_t_4; __pyx_t_6+=1) {
    __pyx_v_level = __pyx_t_6;

    /* "pandas/src/skiplist.pyx":150
 * 
 *         for level in range(d, self.maxlevels):
 *             tmpnode = chain[level]             # <<<<<<<<<<<<<<
 *             tmpnode.width[level] -= 1
 * 
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_chain), __pyx_v_level, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6pandas_5algos_Node))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_tmpnode));
    __pyx_v_tmpnode = ((struct __pyx_obj_6pandas_5algos_Node *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "pandas/src/skiplist.pyx":151
 *         for level in range(d, self.maxlevels):
 *             tmpnode = chain[level]
 *             tmpnode.width[level] -= 1             # <<<<<<<<<<<<<<
 * 
 *         self.size -= 1
 */
    if (unlikely(((PyObject *)__pyx_v_tmpnode->width) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_tmpnode->width));
    __pyx_t_7 = __pyx_v_tmpnode->width;
    __pyx_t_8 = __pyx_v_level;
    if (unlikely(((PyObject *)__pyx_t_7) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_t_7), __pyx_t_8, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(((PyObject *)__pyx_t_7) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (__Pyx_SetItemInt(((PyObject *)__pyx_t_7), __pyx_t_8, __pyx_t_3, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  }

  /* "pandas/src/skiplist.pyx":153
 *             tmpnode.width[level] -= 1
 * 
 *         self.size -= 1             # <<<<<<<<<<<<<<
 */
  __pyx_v_self->size = (__pyx_v_self->size - 1);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_node);
  __Pyx_XDECREF((PyObject *)__pyx_v_prevnode);
  __Pyx_XDECREF((PyObject *)__pyx_v_tmpnode);
  __Pyx_XDECREF((PyObject *)__pyx_v_next_at_level);
  __Pyx_XDECREF(__pyx_v_chain);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_11remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_17IndexableSkiplist_11remove(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
  double __pyx_v_value;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove (wrapper)", 0);
  assert(__pyx_arg_value); {
    __pyx_v_value = __pyx_PyFloat_AsDouble(__pyx_arg_value); if (unlikely((__pyx_v_value == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_17IndexableSkiplist_10remove(((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_self), ((double)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/skiplist.pyx":120
 *         self.size += 1
 * 
 *     cpdef remove(self, double value):             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t level, d
 *         cdef Node node, prevnode, tmpnode, next_at_level
 */

static PyObject *__pyx_pf_6pandas_5algos_17IndexableSkiplist_10remove(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_self, double __pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_self->__pyx_vtab)->remove(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.IndexableSkiplist.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":75
 * # from cython cimport floating, integral
 * 
 * cdef _take_2d_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                       object idx):
 *     cdef:
 */

static PyObject *__pyx_f_6pandas_5algos__take_2d_float64(PyArrayObject *__pyx_v_values, PyObject *__pyx_v_idx) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyArrayObject *__pyx_v_indexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_take_2d_float64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":79
 *     cdef:
 *         Py_ssize_t i, j, N, K
 *         ndarray[Py_ssize_t, ndim=2, cast=True] indexer = idx             # <<<<<<<<<<<<<<
 *         ndarray[float64_t, ndim=2] result
 *         object val
 */
  if (!(likely(((__pyx_v_idx) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_idx, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyArrayObject *)__pyx_v_idx);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_Py_ssize_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
      __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indexer.diminfo[1].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indexer.diminfo[1].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_v_idx);
  __pyx_v_indexer = ((PyArrayObject *)__pyx_v_idx);

  /* "pandas/algos.pyx":83
 *         object val
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 *     result = np.empty_like(values)
 *     for i in range(N):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_N = __pyx_t_7;
  __pyx_v_K = __pyx_t_8;

  /* "pandas/algos.pyx":84
 * 
 *     N, K = (<object> values).shape
 *     result = np.empty_like(values)             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         for j in range(K):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_9 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":85
 *     N, K = (<object> values).shape
 *     result = np.empty_like(values)
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 */
  __pyx_t_8 = __pyx_v_N;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/algos.pyx":86
 *     result = np.empty_like(values)
 *     for i in range(N):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result
 */
    __pyx_t_14 = __pyx_v_K;
    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "pandas/algos.pyx":87
 *     for i in range(N):
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_indexer.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_indexer.diminfo[1].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_indexer.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = (*__Pyx_BufPtrStrided2d(Py_ssize_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_indexer.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[1].strides));
      __pyx_t_10 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_result.diminfo[1].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_result.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_result.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
    }
  }

  /* "pandas/algos.pyx":88
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _take_2d_int64(ndarray[int64_t, ndim=2] values,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos._take_2d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":90
 *     return result
 * 
 * cdef _take_2d_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                       object idx):
 *     cdef:
 */

static PyObject *__pyx_f_6pandas_5algos__take_2d_int64(PyArrayObject *__pyx_v_values, PyObject *__pyx_v_idx) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyArrayObject *__pyx_v_indexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_take_2d_int64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":94
 *     cdef:
 *         Py_ssize_t i, j, N, K
 *         ndarray[Py_ssize_t, ndim=2, cast=True] indexer = idx             # <<<<<<<<<<<<<<
 *         ndarray[int64_t, ndim=2] result
 *         object val
 */
  if (!(likely(((__pyx_v_idx) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_idx, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyArrayObject *)__pyx_v_idx);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_Py_ssize_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
      __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indexer.diminfo[1].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indexer.diminfo[1].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_v_idx);
  __pyx_v_indexer = ((PyArrayObject *)__pyx_v_idx);

  /* "pandas/algos.pyx":98
 *         object val
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 *     result = np.empty_like(values)
 *     for i in range(N):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_N = __pyx_t_7;
  __pyx_v_K = __pyx_t_8;

  /* "pandas/algos.pyx":99
 * 
 *     N, K = (<object> values).shape
 *     result = np.empty_like(values)             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         for j in range(K):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_9 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":100
 *     N, K = (<object> values).shape
 *     result = np.empty_like(values)
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 */
  __pyx_t_8 = __pyx_v_N;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/algos.pyx":101
 *     result = np.empty_like(values)
 *     for i in range(N):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result
 */
    __pyx_t_14 = __pyx_v_K;
    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "pandas/algos.pyx":102
 *     for i in range(N):
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_indexer.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_indexer.diminfo[1].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_indexer.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = (*__Pyx_BufPtrStrided2d(Py_ssize_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_indexer.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[1].strides));
      __pyx_t_10 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_result.diminfo[1].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_result.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_result.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
    }
  }

  /* "pandas/algos.pyx":103
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result             # <<<<<<<<<<<<<<
 * 
 * cdef _take_2d_object(ndarray[object, ndim=2] values,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos._take_2d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":105
 *     return result
 * 
 * cdef _take_2d_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                      object idx):
 *     cdef:
 */

static PyObject *__pyx_f_6pandas_5algos__take_2d_object(PyArrayObject *__pyx_v_values, PyObject *__pyx_v_idx) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyArrayObject *__pyx_v_indexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyArrayObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  PyObject **__pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_take_2d_object", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":109
 *     cdef:
 *         Py_ssize_t i, j, N, K
 *         ndarray[Py_ssize_t, ndim=2, cast=True] indexer = idx             # <<<<<<<<<<<<<<
 *         ndarray[object, ndim=2] result
 *         object val
 */
  if (!(likely(((__pyx_v_idx) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_idx, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((PyArrayObject *)__pyx_v_idx);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_Py_ssize_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
      __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indexer.diminfo[1].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indexer.diminfo[1].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_v_idx);
  __pyx_v_indexer = ((PyArrayObject *)__pyx_v_idx);

  /* "pandas/algos.pyx":113
 *         object val
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 *     result = values.copy()
 *     for i in range(N):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_N = __pyx_t_7;
  __pyx_v_K = __pyx_t_8;

  /* "pandas/algos.pyx":114
 * 
 *     N, K = (<object> values).shape
 *     result = values.copy()             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         for j in range(K):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_9 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":115
 *     N, K = (<object> values).shape
 *     result = values.copy()
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 */
  __pyx_t_8 = __pyx_v_N;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/algos.pyx":116
 *     result = values.copy()
 *     for i in range(N):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result
 */
    __pyx_t_14 = __pyx_v_K;
    for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
      __pyx_v_j = __pyx_t_15;

      /* "pandas/algos.pyx":117
 *     for i in range(N):
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_indexer.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_indexer.diminfo[1].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_indexer.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_19 = (*__Pyx_BufPtrStrided2d(Py_ssize_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_indexer.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[1].strides));
      __pyx_t_10 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_10 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_10 = 0;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_result.diminfo[1].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_10 = 1;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_result.diminfo[1].shape)) __pyx_t_10 = 1;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_22 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_result.diminfo[1].strides);
      __Pyx_GOTREF(*__pyx_t_22);
      __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(*__pyx_t_22);
      *__pyx_t_22 = __pyx_t_4;
      __Pyx_GIVEREF(*__pyx_t_22);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }

  /* "pandas/algos.pyx":118
 *         for j in range(K):
 *             result[i, j] = values[i, indexer[i, j]]
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos._take_2d_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_1rank_1d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_rank_1d_float64[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_1rank_1d_float64 = {__Pyx_NAMESTR("rank_1d_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_1rank_1d_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_rank_1d_float64)};
static PyObject *__pyx_pw_6pandas_5algos_1rank_1d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_1d_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_s__average);
    values[2] = __pyx_k_3;
    values[3] = ((PyObject *)__pyx_n_s__keep);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_1d_float64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    __pyx_v_ties_method = values[1];
    __pyx_v_ascending = values[2];
    __pyx_v_na_option = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_1d_float64", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_1d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_rank_1d_float64(__pyx_self, __pyx_v_in_arr, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":121
 * 
 * 
 * def rank_1d_float64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                     na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_rank_1d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_sorted_data = 0;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_nan_value;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  int __pyx_v_keep_na;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v__as = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sorted_data;
  __Pyx_Buffer __pyx_pybuffer_sorted_data;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __pyx_t_5numpy_float64_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyArrayObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  __pyx_t_5numpy_int64_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  __pyx_t_5numpy_int64_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  __pyx_t_5numpy_int64_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __pyx_t_5numpy_int64_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  __pyx_t_5numpy_int64_t __pyx_t_32;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_1d_float64", 0);
  __pyx_pybuffer_sorted_data.pybuffer.buf = NULL;
  __pyx_pybuffer_sorted_data.refcount = 0;
  __pyx_pybuffernd_sorted_data.data = NULL;
  __pyx_pybuffernd_sorted_data.rcbuffer = &__pyx_pybuffer_sorted_data;
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;

  /* "pandas/algos.pyx":128
 * 
 *     cdef:
 *         Py_ssize_t i, j, n, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[float64_t] sorted_data, ranks, values
 *         ndarray[int64_t] argsorted
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":132
 *         ndarray[int64_t] argsorted
 *         float64_t val, nan_value
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *         bint keep_na = 0
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":133
 *         float64_t val, nan_value
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *         bint keep_na = 0
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":134
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *         bint keep_na = 0             # <<<<<<<<<<<<<<
 *     tiebreak = tiebreakers[ties_method]
 * 
 */
  __pyx_v_keep_na = 0;

  /* "pandas/algos.pyx":135
 *         int tiebreak = 0
 *         bint keep_na = 0
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     values = np.asarray(in_arr).copy()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":137
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     values = np.asarray(in_arr).copy()             # <<<<<<<<<<<<<<
 * 
 *     keep_na = na_option == 'keep'
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_in_arr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
  __Pyx_GIVEREF(__pyx_v_in_arr);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_values = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":139
 *     values = np.asarray(in_arr).copy()
 * 
 *     keep_na = na_option == 'keep'             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__keep), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_keep_na = __pyx_t_9;

  /* "pandas/algos.pyx":141
 *     keep_na = na_option == 'keep'
 * 
 *     if ascending ^ (na_option == 'top'):             # <<<<<<<<<<<<<<
 *         nan_value = np.inf
 *     else:
 */
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__top), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyNumber_Xor(__pyx_v_ascending, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_9) {

    /* "pandas/algos.pyx":142
 * 
 *     if ascending ^ (na_option == 'top'):
 *         nan_value = np.inf             # <<<<<<<<<<<<<<
 *     else:
 *         nan_value = -np.inf
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_nan_value = __pyx_t_10;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":144
 *         nan_value = np.inf
 *     else:
 *         nan_value = -np.inf             # <<<<<<<<<<<<<<
 *     mask = np.isnan(values)
 *     np.putmask(values, mask, nan_value)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_nan_value = __pyx_t_10;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":145
 *     else:
 *         nan_value = -np.inf
 *     mask = np.isnan(values)             # <<<<<<<<<<<<<<
 *     np.putmask(values, mask, nan_value)
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__isnan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_v_mask = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":146
 *         nan_value = -np.inf
 *     mask = np.isnan(values)
 *     np.putmask(values, mask, nan_value)             # <<<<<<<<<<<<<<
 * 
 *     n = len(values)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__putmask); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nan_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __Pyx_INCREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":148
 *     np.putmask(values, mask, nan_value)
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     ranks = np.empty(n, dtype='f8')
 * 
 */
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_11;

  /* "pandas/algos.pyx":149
 * 
 *     n = len(values)
 *     ranks = np.empty(n, dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     # py2.5/win32 hack, can't pass i8
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/algos.pyx":152
 * 
 *     # py2.5/win32 hack, can't pass i8
 *     if tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')
 */
  __pyx_t_9 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
  if (__pyx_t_9) {

    /* "pandas/algos.pyx":154
 *     if tiebreak == TIEBREAK_FIRST:
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')             # <<<<<<<<<<<<<<
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 */
    __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__kind), ((PyObject *)__pyx_n_s__mergesort)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_v__as = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pandas/algos.pyx":155
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')
 *         if not ascending:             # <<<<<<<<<<<<<<
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_13 = (!__pyx_t_9);
    if (__pyx_t_13) {

      /* "pandas/algos.pyx":156
 *         _as = values.argsort(kind='mergesort')
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING             # <<<<<<<<<<<<<<
 *     else:
 *         _as = values.argsort()
 */
      __pyx_v_tiebreak = __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":158
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort()             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v__as = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":160
 *         _as = values.argsort()
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[::-1]
 * 
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = (!__pyx_t_13);
  if (__pyx_t_9) {

    /* "pandas/algos.pyx":161
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
    __pyx_t_1 = PyObject_GetItem(__pyx_v__as, __pyx_k_slice_4); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":163
 *         _as = _as[::-1]
 * 
 *     sorted_data = values.take(_as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v__as);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__as);
  __Pyx_GIVEREF(__pyx_v__as);
  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_sorted_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_sorted_data.diminfo[0].strides = __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorted_data.diminfo[0].shape = __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_sorted_data = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/algos.pyx":164
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_12 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_4 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":166
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         sum_ranks += i + 1
 *         dups += 1
 */
  __pyx_t_11 = __pyx_v_n;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_11; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "pandas/algos.pyx":167
 * 
 *     for i in range(n):
 *         sum_ranks += i + 1             # <<<<<<<<<<<<<<
 *         dups += 1
 *         val = sorted_data[i]
 */
    __pyx_v_sum_ranks = (__pyx_v_sum_ranks + (__pyx_v_i + 1));

    /* "pandas/algos.pyx":168
 *     for i in range(n):
 *         sum_ranks += i + 1
 *         dups += 1             # <<<<<<<<<<<<<<
 *         val = sorted_data[i]
 *         if (val == nan_value) and keep_na:
 */
    __pyx_v_dups = (__pyx_v_dups + 1);

    /* "pandas/algos.pyx":169
 *         sum_ranks += i + 1
 *         dups += 1
 *         val = sorted_data[i]             # <<<<<<<<<<<<<<
 *         if (val == nan_value) and keep_na:
 *             ranks[argsorted[i]] = nan
 */
    __pyx_t_16 = __pyx_v_i;
    __pyx_t_3 = -1;
    if (__pyx_t_16 < 0) {
      __pyx_t_16 += __pyx_pybuffernd_sorted_data.diminfo[0].shape;
      if (unlikely(__pyx_t_16 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_sorted_data.diminfo[0].shape)) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_sorted_data.diminfo[0].strides));

    /* "pandas/algos.pyx":170
 *         dups += 1
 *         val = sorted_data[i]
 *         if (val == nan_value) and keep_na:             # <<<<<<<<<<<<<<
 *             ranks[argsorted[i]] = nan
 *             continue
 */
    __pyx_t_9 = (__pyx_v_val == __pyx_v_nan_value);
    if (__pyx_t_9) {
      __pyx_t_13 = __pyx_v_keep_na;
    } else {
      __pyx_t_13 = __pyx_t_9;
    }
    if (__pyx_t_13) {

      /* "pandas/algos.pyx":171
 *         val = sorted_data[i]
 *         if (val == nan_value) and keep_na:
 *             ranks[argsorted[i]] = nan             # <<<<<<<<<<<<<<
 *             continue
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > FP_ERR:
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_argsorted.diminfo[0].strides));
      __pyx_t_3 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_ranks.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_ranks.diminfo[0].strides) = __pyx_v_6pandas_5algos_nan;

      /* "pandas/algos.pyx":172
 *         if (val == nan_value) and keep_na:
 *             ranks[argsorted[i]] = nan
 *             continue             # <<<<<<<<<<<<<<
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > FP_ERR:
 *             if tiebreak == TIEBREAK_AVERAGE:
 */
      goto __pyx_L7_continue;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":173
 *             ranks[argsorted[i]] = nan
 *             continue
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > FP_ERR:             # <<<<<<<<<<<<<<
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 */
    __pyx_t_13 = (__pyx_v_i == (__pyx_v_n - 1));
    if (!__pyx_t_13) {
      __pyx_t_19 = (__pyx_v_i + 1);
      __pyx_t_3 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_sorted_data.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_sorted_data.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_9 = (fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_sorted_data.diminfo[0].strides)) - __pyx_v_val)) > __pyx_v_6pandas_5algos_FP_ERR);
      __pyx_t_20 = __pyx_t_9;
    } else {
      __pyx_t_20 = __pyx_t_13;
    }
    if (__pyx_t_20) {

      /* "pandas/algos.pyx":174
 *             continue
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > FP_ERR:
 *             if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 */
      __pyx_t_20 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
      if (__pyx_t_20) {

        /* "pandas/algos.pyx":175
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > FP_ERR:
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 */
        __pyx_t_21 = (__pyx_v_i + 1);
        for (__pyx_t_22 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/algos.pyx":176
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 */
          if (unlikely(__pyx_v_dups == 0)) {
            PyErr_Format(PyExc_ZeroDivisionError, "float division");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_23 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_24 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
        }
        goto __pyx_L11;
      }

      /* "pandas/algos.pyx":177
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 */
      __pyx_t_20 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
      if (__pyx_t_20) {

        /* "pandas/algos.pyx":178
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 */
        __pyx_t_21 = (__pyx_v_i + 1);
        for (__pyx_t_22 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/algos.pyx":179
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_25 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_25 < 0) {
            __pyx_t_25 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_26 < 0) {
            __pyx_t_26 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ranks.diminfo[0].strides) = ((__pyx_v_i - __pyx_v_dups) + 2);
        }
        goto __pyx_L11;
      }

      /* "pandas/algos.pyx":180
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 */
      __pyx_t_20 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
      if (__pyx_t_20) {

        /* "pandas/algos.pyx":181
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 */
        __pyx_t_21 = (__pyx_v_i + 1);
        for (__pyx_t_22 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/algos.pyx":182
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_i + 1);
        }
        goto __pyx_L11;
      }

      /* "pandas/algos.pyx":183
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1
 */
      __pyx_t_20 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
      if (__pyx_t_20) {

        /* "pandas/algos.pyx":184
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 */
        __pyx_t_21 = (__pyx_v_i + 1);
        for (__pyx_t_22 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/algos.pyx":185
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_29 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_29 < 0) {
            __pyx_t_29 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_30 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_30 < 0) {
            __pyx_t_30 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_j + 1);
        }
        goto __pyx_L11;
      }

      /* "pandas/algos.pyx":186
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 */
      __pyx_t_20 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING);
      if (__pyx_t_20) {

        /* "pandas/algos.pyx":187
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0
 */
        __pyx_t_21 = (__pyx_v_i + 1);
        for (__pyx_t_22 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/algos.pyx":188
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2             # <<<<<<<<<<<<<<
 *             sum_ranks = dups = 0
 *     return ranks
 */
          __pyx_t_31 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_31 < 0) {
            __pyx_t_31 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_32 < 0) {
            __pyx_t_32 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ranks.diminfo[0].strides) = ((((2 * __pyx_v_i) - __pyx_v_j) - __pyx_v_dups) + 2);
        }
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "pandas/algos.pyx":189
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 *     return ranks
 * 
 */
      __pyx_v_sum_ranks = 0;
      __pyx_v_dups = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;
    __pyx_L7_continue:;
  }

  /* "pandas/algos.pyx":190
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0
 *     return ranks             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
  __pyx_r = ((PyObject *)__pyx_v_ranks);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_1d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_3rank_1d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_2rank_1d_int64[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_3rank_1d_int64 = {__Pyx_NAMESTR("rank_1d_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_3rank_1d_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_2rank_1d_int64)};
static PyObject *__pyx_pw_6pandas_5algos_3rank_1d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  CYTHON_UNUSED PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_1d_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_n_s__average);
    values[2] = __pyx_k_6;
    values[3] = ((PyObject *)__pyx_n_s__keep);
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_1d_int64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    __pyx_v_ties_method = values[1];
    __pyx_v_ascending = values[2];
    __pyx_v_na_option = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_1d_int64", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_1d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_2rank_1d_int64(__pyx_self, __pyx_v_in_arr, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":193
 * 
 * 
 * def rank_1d_int64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                   na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_2rank_1d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, CYTHON_UNUSED PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_sorted_data = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  PyObject *__pyx_v__as = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sorted_data;
  __Pyx_Buffer __pyx_pybuffer_sorted_data;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyArrayObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  PyArrayObject *__pyx_t_14 = NULL;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  __pyx_t_5numpy_int64_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  __pyx_t_5numpy_int64_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  __pyx_t_5numpy_int64_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __pyx_t_5numpy_int64_t __pyx_t_30;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_1d_int64", 0);
  __pyx_pybuffer_sorted_data.pybuffer.buf = NULL;
  __pyx_pybuffer_sorted_data.refcount = 0;
  __pyx_pybuffernd_sorted_data.data = NULL;
  __pyx_pybuffernd_sorted_data.rcbuffer = &__pyx_pybuffer_sorted_data;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;

  /* "pandas/algos.pyx":200
 * 
 *     cdef:
 *         Py_ssize_t i, j, n, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] sorted_data, values
 *         ndarray[float64_t] ranks
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":205
 *         ndarray[int64_t] argsorted
 *         int64_t val
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":206
 *         int64_t val
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *     tiebreak = tiebreakers[ties_method]
 * 
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":207
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     values = np.asarray(in_arr)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":209
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     values = np.asarray(in_arr)             # <<<<<<<<<<<<<<
 * 
 *     n = len(values)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_in_arr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
  __Pyx_GIVEREF(__pyx_v_in_arr);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_values = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":211
 *     values = np.asarray(in_arr)
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     ranks = np.empty(n, dtype='f8')
 * 
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_9;

  /* "pandas/algos.pyx":212
 * 
 *     n = len(values)
 *     ranks = np.empty(n, dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     # py2.5/win32 hack, can't pass i8
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/algos.pyx":215
 * 
 *     # py2.5/win32 hack, can't pass i8
 *     if tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')
 */
  __pyx_t_12 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":217
 *     if tiebreak == TIEBREAK_FIRST:
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')             # <<<<<<<<<<<<<<
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 */
    __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__kind), ((PyObject *)__pyx_n_s__mergesort)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_v__as = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/algos.pyx":218
 *         # need to use a stable sort here
 *         _as = values.argsort(kind='mergesort')
 *         if not ascending:             # <<<<<<<<<<<<<<
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 */
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_13 = (!__pyx_t_12);
    if (__pyx_t_13) {

      /* "pandas/algos.pyx":219
 *         _as = values.argsort(kind='mergesort')
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING             # <<<<<<<<<<<<<<
 *     else:
 *         _as = values.argsort()
 */
      __pyx_v_tiebreak = __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":221
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort()             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v__as = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":223
 *         _as = values.argsort()
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[::-1]
 * 
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = (!__pyx_t_13);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":224
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
    __pyx_t_4 = PyObject_GetItem(__pyx_v__as, __pyx_k_slice_7); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":226
 *         _as = _as[::-1]
 * 
 *     sorted_data = values.take(_as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__take); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v__as);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__as);
  __Pyx_GIVEREF(__pyx_v__as);
  __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_sorted_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_sorted_data.diminfo[0].strides = __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorted_data.diminfo[0].shape = __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = 0;
  __pyx_v_sorted_data = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/algos.pyx":227
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_10 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":229
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         sum_ranks += i + 1
 *         dups += 1
 */
  __pyx_t_9 = __pyx_v_n;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_9; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "pandas/algos.pyx":230
 * 
 *     for i in range(n):
 *         sum_ranks += i + 1             # <<<<<<<<<<<<<<
 *         dups += 1
 *         val = sorted_data[i]
 */
    __pyx_v_sum_ranks = (__pyx_v_sum_ranks + (__pyx_v_i + 1));

    /* "pandas/algos.pyx":231
 *     for i in range(n):
 *         sum_ranks += i + 1
 *         dups += 1             # <<<<<<<<<<<<<<
 *         val = sorted_data[i]
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > 0:
 */
    __pyx_v_dups = (__pyx_v_dups + 1);

    /* "pandas/algos.pyx":232
 *         sum_ranks += i + 1
 *         dups += 1
 *         val = sorted_data[i]             # <<<<<<<<<<<<<<
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > 0:
 *             if tiebreak == TIEBREAK_AVERAGE:
 */
    __pyx_t_16 = __pyx_v_i;
    __pyx_t_3 = -1;
    if (__pyx_t_16 < 0) {
      __pyx_t_16 += __pyx_pybuffernd_sorted_data.diminfo[0].shape;
      if (unlikely(__pyx_t_16 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_sorted_data.diminfo[0].shape)) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_sorted_data.diminfo[0].strides));

    /* "pandas/algos.pyx":233
 *         dups += 1
 *         val = sorted_data[i]
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > 0:             # <<<<<<<<<<<<<<
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 */
    __pyx_t_12 = (__pyx_v_i == (__pyx_v_n - 1));
    if (!__pyx_t_12) {
      __pyx_t_17 = (__pyx_v_i + 1);
      __pyx_t_3 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_sorted_data.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_sorted_data.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_13 = (fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_sorted_data.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_sorted_data.diminfo[0].strides)) - __pyx_v_val)) > 0.0);
      __pyx_t_18 = __pyx_t_13;
    } else {
      __pyx_t_18 = __pyx_t_12;
    }
    if (__pyx_t_18) {

      /* "pandas/algos.pyx":234
 *         val = sorted_data[i]
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > 0:
 *             if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 */
      __pyx_t_18 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
      if (__pyx_t_18) {

        /* "pandas/algos.pyx":235
 *         if i == n - 1 or fabs(sorted_data[i + 1] - val) > 0:
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 */
        __pyx_t_19 = (__pyx_v_i + 1);
        for (__pyx_t_20 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;

          /* "pandas/algos.pyx":236
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 */
          if (unlikely(__pyx_v_dups == 0)) {
            PyErr_Format(PyExc_ZeroDivisionError, "float division");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_21 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_22 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
        }
        goto __pyx_L9;
      }

      /* "pandas/algos.pyx":237
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 */
      __pyx_t_18 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
      if (__pyx_t_18) {

        /* "pandas/algos.pyx":238
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 */
        __pyx_t_19 = (__pyx_v_i + 1);
        for (__pyx_t_20 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;

          /* "pandas/algos.pyx":239
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_23 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_24 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ranks.diminfo[0].strides) = ((__pyx_v_i - __pyx_v_dups) + 2);
        }
        goto __pyx_L9;
      }

      /* "pandas/algos.pyx":240
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 */
      __pyx_t_18 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
      if (__pyx_t_18) {

        /* "pandas/algos.pyx":241
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 */
        __pyx_t_19 = (__pyx_v_i + 1);
        for (__pyx_t_20 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;

          /* "pandas/algos.pyx":242
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_25 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_25 < 0) {
            __pyx_t_25 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_26 < 0) {
            __pyx_t_26 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_i + 1);
        }
        goto __pyx_L9;
      }

      /* "pandas/algos.pyx":243
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1
 */
      __pyx_t_18 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
      if (__pyx_t_18) {

        /* "pandas/algos.pyx":244
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 */
        __pyx_t_19 = (__pyx_v_i + 1);
        for (__pyx_t_20 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;

          /* "pandas/algos.pyx":245
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_j + 1);
        }
        goto __pyx_L9;
      }

      /* "pandas/algos.pyx":246
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 */
      __pyx_t_18 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING);
      if (__pyx_t_18) {

        /* "pandas/algos.pyx":247
 *                     ranks[argsorted[j]] = j + 1
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0
 */
        __pyx_t_19 = (__pyx_v_i + 1);
        for (__pyx_t_20 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
          __pyx_v_j = __pyx_t_20;

          /* "pandas/algos.pyx":248
 *             elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2             # <<<<<<<<<<<<<<
 *             sum_ranks = dups = 0
 *     return ranks
 */
          __pyx_t_29 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_29 < 0) {
            __pyx_t_29 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_30 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_30 < 0) {
            __pyx_t_30 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ranks.diminfo[0].strides) = ((((2 * __pyx_v_i) - __pyx_v_j) - __pyx_v_dups) + 2);
        }
        goto __pyx_L9;
      }
      __pyx_L9:;

      /* "pandas/algos.pyx":249
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 *     return ranks
 * 
 */
      __pyx_v_sum_ranks = 0;
      __pyx_v_dups = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }

  /* "pandas/algos.pyx":250
 *                     ranks[argsorted[j]] = 2 * i - j - dups + 2
 *             sum_ranks = dups = 0
 *     return ranks             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
  __pyx_r = ((PyObject *)__pyx_v_ranks);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_1d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorted_data.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_5rank_2d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_4rank_2d_float64[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_5rank_2d_float64 = {__Pyx_NAMESTR("rank_2d_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_5rank_2d_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_4rank_2d_float64)};
static PyObject *__pyx_pw_6pandas_5algos_5rank_2d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_2d_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__axis,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_n_s__average);
    values[3] = __pyx_k_9;
    values[4] = ((PyObject *)__pyx_n_s__keep);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_2d_float64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    __pyx_v_axis = values[1];
    __pyx_v_ties_method = values[2];
    __pyx_v_ascending = values[3];
    __pyx_v_na_option = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_2d_float64", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_2d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_4rank_2d_float64(__pyx_self, __pyx_v_in_arr, __pyx_v_axis, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":253
 * 
 * 
 * def rank_2d_float64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_4rank_2d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_z;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_nan_value;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  int __pyx_v_keep_na;
  PyObject *__pyx_v__as = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  PyArrayObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  int __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  __pyx_t_5numpy_int64_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  __pyx_t_5numpy_int64_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  __pyx_t_5numpy_int64_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  __pyx_t_5numpy_int64_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  __pyx_t_5numpy_int64_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_2d_float64", 0);
  __Pyx_INCREF(__pyx_v_in_arr);
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;

  /* "pandas/algos.pyx":260
 * 
 *     cdef:
 *         Py_ssize_t i, j, z, k, n, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[float64_t, ndim=2] ranks, values
 *         ndarray[int64_t, ndim=2] argsorted
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":264
 *         ndarray[int64_t, ndim=2] argsorted
 *         float64_t val, nan_value
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *         bint keep_na = 0
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":265
 *         float64_t val, nan_value
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *         bint keep_na = 0
 * 
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":266
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *         bint keep_na = 0             # <<<<<<<<<<<<<<
 * 
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_keep_na = 0;

  /* "pandas/algos.pyx":268
 *         bint keep_na = 0
 * 
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     keep_na = na_option == 'keep'
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":270
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     keep_na = na_option == 'keep'             # <<<<<<<<<<<<<<
 * 
 *     in_arr = np.asarray(in_arr)
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__keep), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_keep_na = __pyx_t_4;

  /* "pandas/algos.pyx":272
 *     keep_na = na_option == 'keep'
 * 
 *     in_arr = np.asarray(in_arr)             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_in_arr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
  __Pyx_GIVEREF(__pyx_v_in_arr);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_in_arr);
  __pyx_v_in_arr = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":274
 *     in_arr = np.asarray(in_arr)
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         values = in_arr.T.copy()
 *     else:
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":275
 * 
 *     if axis == 0:
 *         values = in_arr.T.copy()             # <<<<<<<<<<<<<<
 *     else:
 *         values = in_arr.copy()
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__T); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":277
 *         values = in_arr.T.copy()
 *     else:
 *         values = in_arr.copy()             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":279
 *         values = in_arr.copy()
 * 
 *     if ascending ^ (na_option == 'top'):             # <<<<<<<<<<<<<<
 *         nan_value = np.inf
 *     else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__top), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyNumber_Xor(__pyx_v_ascending, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":280
 * 
 *     if ascending ^ (na_option == 'top'):
 *         nan_value = np.inf             # <<<<<<<<<<<<<<
 *     else:
 *         nan_value = -np.inf
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_nan_value = __pyx_t_10;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":282
 *         nan_value = np.inf
 *     else:
 *         nan_value = -np.inf             # <<<<<<<<<<<<<<
 * 
 *     np.putmask(values, np.isnan(values), nan_value)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_nan_value = __pyx_t_10;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":284
 *         nan_value = -np.inf
 * 
 *     np.putmask(values, np.isnan(values), nan_value)             # <<<<<<<<<<<<<<
 * 
 *     n, k = (<object> values).shape
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__putmask); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isnan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nan_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_11 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":286
 *     np.putmask(values, np.isnan(values), nan_value)
 * 
 *     n, k = (<object> values).shape             # <<<<<<<<<<<<<<
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_5 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_n = __pyx_t_13;
  __pyx_v_k = __pyx_t_14;

  /* "pandas/algos.pyx":287
 * 
 *     n, k = (<object> values).shape
 *     ranks = np.empty((n, k), dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     if tiebreak == TIEBREAK_FIRST:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_11));
  __pyx_t_11 = 0;
  __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_11));
  if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ranks.diminfo[1].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ranks.diminfo[1].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":289
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 *     if tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')
 */
  __pyx_t_4 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":291
 *     if tiebreak == TIEBREAK_FIRST:
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')             # <<<<<<<<<<<<<<
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_11));
    if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__kind), ((PyObject *)__pyx_n_s__mergesort)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
    __pyx_v__as = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/algos.pyx":292
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')
 *         if not ascending:             # <<<<<<<<<<<<<<
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = (!__pyx_t_4);
    if (__pyx_t_15) {

      /* "pandas/algos.pyx":293
 *         _as = values.argsort(axis=1, kind='mergesort')
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING             # <<<<<<<<<<<<<<
 *     else:
 *         _as = values.argsort(1)
 */
      __pyx_v_tiebreak = __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING;
      goto __pyx_L8;
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "pandas/algos.pyx":295
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v__as = __pyx_t_11;
    __pyx_t_11 = 0;
  }
  __pyx_L7:;

  /* "pandas/algos.pyx":297
 *         _as = values.argsort(1)
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[:, ::-1]
 * 
 */
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_15);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":298
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_float64(values, _as)
 */
    __pyx_t_11 = PyObject_GetItem(__pyx_v__as, ((PyObject *)__pyx_k_tuple_13)); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_11;
    __pyx_t_11 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "pandas/algos.pyx":300
 *         _as = _as[:, ::-1]
 * 
 *     values = _take_2d_float64(values, _as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_11 = __pyx_f_6pandas_5algos__take_2d_float64(((PyArrayObject *)__pyx_v_values), __pyx_v__as); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_11);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_values));
  __pyx_v_values = ((PyArrayObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "pandas/algos.pyx":301
 * 
 *     values = _take_2d_float64(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_11 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_argsorted.diminfo[1].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_argsorted.diminfo[1].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_16 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":303
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         dups = sum_ranks = 0
 *         for j in range(k):
 */
  __pyx_t_14 = __pyx_v_n;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":304
 * 
 *     for i in range(n):
 *         dups = sum_ranks = 0             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             sum_ranks += j + 1
 */
    __pyx_v_dups = 0;
    __pyx_v_sum_ranks = 0;

    /* "pandas/algos.pyx":305
 *     for i in range(n):
 *         dups = sum_ranks = 0
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             sum_ranks += j + 1
 *             dups += 1
 */
    __pyx_t_17 = __pyx_v_k;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_j = __pyx_t_18;

      /* "pandas/algos.pyx":306
 *         dups = sum_ranks = 0
 *         for j in range(k):
 *             sum_ranks += j + 1             # <<<<<<<<<<<<<<
 *             dups += 1
 *             val = values[i, j]
 */
      __pyx_v_sum_ranks = (__pyx_v_sum_ranks + (__pyx_v_j + 1));

      /* "pandas/algos.pyx":307
 *         for j in range(k):
 *             sum_ranks += j + 1
 *             dups += 1             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 *             if val == nan_value and keep_na:
 */
      __pyx_v_dups = (__pyx_v_dups + 1);

      /* "pandas/algos.pyx":308
 *             sum_ranks += j + 1
 *             dups += 1
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 *             if val == nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan
 */
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_20 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 1;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":309
 *             dups += 1
 *             val = values[i, j]
 *             if val == nan_value and keep_na:             # <<<<<<<<<<<<<<
 *                 ranks[i, argsorted[i, j]] = nan
 *                 continue
 */
      __pyx_t_4 = (__pyx_v_val == __pyx_v_nan_value);
      if (__pyx_t_4) {
        __pyx_t_15 = __pyx_v_keep_na;
      } else {
        __pyx_t_15 = __pyx_t_4;
      }
      if (__pyx_t_15) {

        /* "pandas/algos.pyx":310
 *             val = values[i, j]
 *             if val == nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan             # <<<<<<<<<<<<<<
 *                 continue
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_3 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_21 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
          if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_22 < 0) {
          __pyx_t_22 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
          if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_23 = __pyx_v_i;
        __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_argsorted.diminfo[1].strides));
        __pyx_t_3 = -1;
        if (__pyx_t_23 < 0) {
          __pyx_t_23 += __pyx_pybuffernd_ranks.diminfo[0].shape;
          if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_24 < 0) {
          __pyx_t_24 += __pyx_pybuffernd_ranks.diminfo[1].shape;
          if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_ranks.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;

        /* "pandas/algos.pyx":311
 *             if val == nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan
 *                 continue             # <<<<<<<<<<<<<<
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:
 */
        goto __pyx_L12_continue;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "pandas/algos.pyx":312
 *                 ranks[i, argsorted[i, j]] = nan
 *                 continue
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:             # <<<<<<<<<<<<<<
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 */
      __pyx_t_15 = (__pyx_v_j == (__pyx_v_k - 1));
      if (!__pyx_t_15) {
        __pyx_t_25 = __pyx_v_i;
        __pyx_t_26 = (__pyx_v_j + 1);
        __pyx_t_3 = -1;
        if (__pyx_t_25 < 0) {
          __pyx_t_25 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_values.diminfo[1].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = (fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides)) - __pyx_v_val)) > __pyx_v_6pandas_5algos_FP_ERR);
        __pyx_t_27 = __pyx_t_4;
      } else {
        __pyx_t_27 = __pyx_t_15;
      }
      if (__pyx_t_27) {

        /* "pandas/algos.pyx":313
 *                 continue
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 */
        __pyx_t_27 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
        if (__pyx_t_27) {

          /* "pandas/algos.pyx":314
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 */
          __pyx_t_28 = (__pyx_v_j + 1);
          for (__pyx_t_29 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
            __pyx_v_z = __pyx_t_29;

            /* "pandas/algos.pyx":315
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 */
            if (unlikely(__pyx_v_dups == 0)) {
              PyErr_Format(PyExc_ZeroDivisionError, "float division");
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_30 = __pyx_v_i;
            __pyx_t_31 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_31 < 0) {
              __pyx_t_31 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_32 = __pyx_v_i;
            __pyx_t_33 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_32 < 0) {
              __pyx_t_32 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_33 < 0) {
              __pyx_t_33 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_33 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
          }
          goto __pyx_L16;
        }

        /* "pandas/algos.pyx":316
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 */
        __pyx_t_27 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
        if (__pyx_t_27) {

          /* "pandas/algos.pyx":317
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 */
          __pyx_t_28 = (__pyx_v_j + 1);
          for (__pyx_t_29 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
            __pyx_v_z = __pyx_t_29;

            /* "pandas/algos.pyx":318
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_34 = __pyx_v_i;
            __pyx_t_35 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_34 < 0) {
              __pyx_t_34 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_34 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_35 < 0) {
              __pyx_t_35 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_35 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_36 = __pyx_v_i;
            __pyx_t_37 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_36 < 0) {
              __pyx_t_36 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_36 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_37 < 0) {
              __pyx_t_37 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_37 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_ranks.diminfo[1].strides) = ((__pyx_v_j - __pyx_v_dups) + 2);
          }
          goto __pyx_L16;
        }

        /* "pandas/algos.pyx":319
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 */
        __pyx_t_27 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
        if (__pyx_t_27) {

          /* "pandas/algos.pyx":320
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 */
          __pyx_t_28 = (__pyx_v_j + 1);
          for (__pyx_t_29 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
            __pyx_v_z = __pyx_t_29;

            /* "pandas/algos.pyx":321
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_38 = __pyx_v_i;
            __pyx_t_39 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_38 < 0) {
              __pyx_t_38 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_38 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_39 < 0) {
              __pyx_t_39 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_39 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_40 = __pyx_v_i;
            __pyx_t_41 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_40 < 0) {
              __pyx_t_40 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_40 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_41 < 0) {
              __pyx_t_41 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_41 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_j + 1);
          }
          goto __pyx_L16;
        }

        /* "pandas/algos.pyx":322
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1
 */
        __pyx_t_27 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
        if (__pyx_t_27) {

          /* "pandas/algos.pyx":323
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 */
          __pyx_t_28 = (__pyx_v_j + 1);
          for (__pyx_t_29 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
            __pyx_v_z = __pyx_t_29;

            /* "pandas/algos.pyx":324
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_43 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_42 < 0) {
              __pyx_t_42 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_42 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_43 < 0) {
              __pyx_t_43 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_43 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_44 = __pyx_v_i;
            __pyx_t_45 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_44 < 0) {
              __pyx_t_44 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_44 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_45 < 0) {
              __pyx_t_45 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_45 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_z + 1);
          }
          goto __pyx_L16;
        }

        /* "pandas/algos.pyx":325
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 */
        __pyx_t_27 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING);
        if (__pyx_t_27) {

          /* "pandas/algos.pyx":326
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 *                 sum_ranks = dups = 0
 */
          __pyx_t_28 = (__pyx_v_j + 1);
          for (__pyx_t_29 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
            __pyx_v_z = __pyx_t_29;

            /* "pandas/algos.pyx":327
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2             # <<<<<<<<<<<<<<
 *                 sum_ranks = dups = 0
 * 
 */
            __pyx_t_46 = __pyx_v_i;
            __pyx_t_47 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_46 < 0) {
              __pyx_t_46 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_46 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_47 < 0) {
              __pyx_t_47 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_47 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_48 = __pyx_v_i;
            __pyx_t_49 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_48 < 0) {
              __pyx_t_48 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_48 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_49 < 0) {
              __pyx_t_49 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_49 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_ranks.diminfo[1].strides) = ((((2 * __pyx_v_j) - __pyx_v_z) - __pyx_v_dups) + 2);
          }
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "pandas/algos.pyx":328
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 *                 sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
        __pyx_v_sum_ranks = 0;
        __pyx_v_dups = 0;
        goto __pyx_L15;
      }
      __pyx_L15:;
      __pyx_L12_continue:;
    }
  }

  /* "pandas/algos.pyx":330
 *                 sum_ranks = dups = 0
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         return ranks.T
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_27 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_27 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_27) {

    /* "pandas/algos.pyx":331
 * 
 *     if axis == 0:
 *         return ranks.T             # <<<<<<<<<<<<<<
 *     else:
 *         return ranks
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_ranks), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L27;
  }
  /*else*/ {

    /* "pandas/algos.pyx":333
 *         return ranks.T
 *     else:
 *         return ranks             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
    __pyx_r = ((PyObject *)__pyx_v_ranks);
    goto __pyx_L0;
  }
  __pyx_L27:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_2d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XDECREF(__pyx_v_in_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_7rank_2d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_6rank_2d_int64[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_7rank_2d_int64 = {__Pyx_NAMESTR("rank_2d_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_7rank_2d_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_6rank_2d_int64)};
static PyObject *__pyx_pw_6pandas_5algos_7rank_2d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  CYTHON_UNUSED PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_2d_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__axis,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_n_s__average);
    values[3] = __pyx_k_15;
    values[4] = ((PyObject *)__pyx_n_s__keep);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_2d_int64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    __pyx_v_axis = values[1];
    __pyx_v_ties_method = values[2];
    __pyx_v_ascending = values[3];
    __pyx_v_na_option = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_2d_int64", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_2d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_6rank_2d_int64(__pyx_self, __pyx_v_in_arr, __pyx_v_axis, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":336
 * 
 * 
 * def rank_2d_int64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_6rank_2d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, CYTHON_UNUSED PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_z;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  PyArrayObject *__pyx_v_values = 0;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  PyObject *__pyx_v__as = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyArrayObject *__pyx_t_16 = NULL;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  int __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  __pyx_t_5numpy_int64_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  __pyx_t_5numpy_int64_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  __pyx_t_5numpy_int64_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  __pyx_t_5numpy_int64_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  __pyx_t_5numpy_int64_t __pyx_t_45;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_2d_int64", 0);
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;

  /* "pandas/algos.pyx":343
 * 
 *     cdef:
 *         Py_ssize_t i, j, z, k, n, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[float64_t, ndim=2] ranks
 *         ndarray[int64_t, ndim=2] argsorted
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":348
 *         ndarray[int64_t, ndim=2, cast=True] values
 *         int64_t val
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":349
 *         int64_t val
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *     tiebreak = tiebreakers[ties_method]
 * 
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":350
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":352
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         values = np.asarray(in_arr).T
 *     else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":353
 * 
 *     if axis == 0:
 *         values = np.asarray(in_arr).T             # <<<<<<<<<<<<<<
 *     else:
 *         values = np.asarray(in_arr)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_in_arr);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
    __Pyx_GIVEREF(__pyx_v_in_arr);
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":355
 *         values = np.asarray(in_arr).T
 *     else:
 *         values = np.asarray(in_arr)             # <<<<<<<<<<<<<<
 * 
 *     n, k = (<object> values).shape
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_in_arr);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
    __Pyx_GIVEREF(__pyx_v_in_arr);
    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":357
 *         values = np.asarray(in_arr)
 * 
 *     n, k = (<object> values).shape             # <<<<<<<<<<<<<<
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_n = __pyx_t_12;
  __pyx_v_k = __pyx_t_13;

  /* "pandas/algos.pyx":358
 * 
 *     n, k = (<object> values).shape
 *     ranks = np.empty((n, k), dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     if tiebreak == TIEBREAK_FIRST:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_10 = 0;
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ranks.diminfo[1].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ranks.diminfo[1].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":360
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 *     if tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')
 */
  __pyx_t_4 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":362
 *     if tiebreak == TIEBREAK_FIRST:
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')             # <<<<<<<<<<<<<<
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
    if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__kind), ((PyObject *)__pyx_n_s__mergesort)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
    __pyx_v__as = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pandas/algos.pyx":363
 *         # need to use a stable sort here
 *         _as = values.argsort(axis=1, kind='mergesort')
 *         if not ascending:             # <<<<<<<<<<<<<<
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = (!__pyx_t_4);
    if (__pyx_t_15) {

      /* "pandas/algos.pyx":364
 *         _as = values.argsort(axis=1, kind='mergesort')
 *         if not ascending:
 *             tiebreak = TIEBREAK_FIRST_DESCENDING             # <<<<<<<<<<<<<<
 *     else:
 *         _as = values.argsort(1)
 */
      __pyx_v_tiebreak = __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":366
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v__as = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":368
 *         _as = values.argsort(1)
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[:, ::-1]
 * 
 */
  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (!__pyx_t_15);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":369
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_int64(values, _as)
 */
    __pyx_t_10 = PyObject_GetItem(__pyx_v__as, ((PyObject *)__pyx_k_tuple_19)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_10;
    __pyx_t_10 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "pandas/algos.pyx":371
 *         _as = _as[:, ::-1]
 * 
 *     values = _take_2d_int64(values, _as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_10 = __pyx_f_6pandas_5algos__take_2d_int64(((PyArrayObject *)__pyx_v_values), __pyx_v__as); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 1, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_values));
  __pyx_v_values = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/algos.pyx":372
 * 
 *     values = _take_2d_int64(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_10 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_argsorted.diminfo[1].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_argsorted.diminfo[1].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_16 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":374
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         dups = sum_ranks = 0
 *         for j in range(k):
 */
  __pyx_t_13 = __pyx_v_n;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/algos.pyx":375
 * 
 *     for i in range(n):
 *         dups = sum_ranks = 0             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             sum_ranks += j + 1
 */
    __pyx_v_dups = 0;
    __pyx_v_sum_ranks = 0;

    /* "pandas/algos.pyx":376
 *     for i in range(n):
 *         dups = sum_ranks = 0
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             sum_ranks += j + 1
 *             dups += 1
 */
    __pyx_t_17 = __pyx_v_k;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
      __pyx_v_j = __pyx_t_18;

      /* "pandas/algos.pyx":377
 *         dups = sum_ranks = 0
 *         for j in range(k):
 *             sum_ranks += j + 1             # <<<<<<<<<<<<<<
 *             dups += 1
 *             val = values[i, j]
 */
      __pyx_v_sum_ranks = (__pyx_v_sum_ranks + (__pyx_v_j + 1));

      /* "pandas/algos.pyx":378
 *         for j in range(k):
 *             sum_ranks += j + 1
 *             dups += 1             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 */
      __pyx_v_dups = (__pyx_v_dups + 1);

      /* "pandas/algos.pyx":379
 *             sum_ranks += j + 1
 *             dups += 1
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:
 */
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_20 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 1;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":380
 *             dups += 1
 *             val = values[i, j]
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:             # <<<<<<<<<<<<<<
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 */
      __pyx_t_4 = (__pyx_v_j == (__pyx_v_k - 1));
      if (!__pyx_t_4) {
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = (__pyx_v_j + 1);
        __pyx_t_3 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_21 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_22 < 0) {
          __pyx_t_22 += __pyx_pybuffernd_values.diminfo[1].shape;
          if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_15 = (fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides)) - __pyx_v_val)) > __pyx_v_6pandas_5algos_FP_ERR);
        __pyx_t_23 = __pyx_t_15;
      } else {
        __pyx_t_23 = __pyx_t_4;
      }
      if (__pyx_t_23) {

        /* "pandas/algos.pyx":381
 *             val = values[i, j]
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 */
        __pyx_t_23 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
        if (__pyx_t_23) {

          /* "pandas/algos.pyx":382
 *             if j == k - 1 or fabs(values[i, j + 1] - val) > FP_ERR:
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 */
          __pyx_t_24 = (__pyx_v_j + 1);
          for (__pyx_t_25 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
            __pyx_v_z = __pyx_t_25;

            /* "pandas/algos.pyx":383
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 */
            if (unlikely(__pyx_v_dups == 0)) {
              PyErr_Format(PyExc_ZeroDivisionError, "float division");
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_26 = __pyx_v_i;
            __pyx_t_27 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_26 < 0) {
              __pyx_t_26 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_27 < 0) {
              __pyx_t_27 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_28 < 0) {
              __pyx_t_28 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_29 < 0) {
              __pyx_t_29 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
          }
          goto __pyx_L14;
        }

        /* "pandas/algos.pyx":384
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 */
        __pyx_t_23 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
        if (__pyx_t_23) {

          /* "pandas/algos.pyx":385
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 */
          __pyx_t_24 = (__pyx_v_j + 1);
          for (__pyx_t_25 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
            __pyx_v_z = __pyx_t_25;

            /* "pandas/algos.pyx":386
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_30 = __pyx_v_i;
            __pyx_t_31 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_31 < 0) {
              __pyx_t_31 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_32 = __pyx_v_i;
            __pyx_t_33 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_32 < 0) {
              __pyx_t_32 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_33 < 0) {
              __pyx_t_33 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_33 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_ranks.diminfo[1].strides) = ((__pyx_v_j - __pyx_v_dups) + 2);
          }
          goto __pyx_L14;
        }

        /* "pandas/algos.pyx":387
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 */
        __pyx_t_23 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
        if (__pyx_t_23) {

          /* "pandas/algos.pyx":388
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 */
          __pyx_t_24 = (__pyx_v_j + 1);
          for (__pyx_t_25 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
            __pyx_v_z = __pyx_t_25;

            /* "pandas/algos.pyx":389
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_34 = __pyx_v_i;
            __pyx_t_35 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_34 < 0) {
              __pyx_t_34 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_34 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_35 < 0) {
              __pyx_t_35 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_35 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_36 = __pyx_v_i;
            __pyx_t_37 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_36 < 0) {
              __pyx_t_36 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_36 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_37 < 0) {
              __pyx_t_37 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_37 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_j + 1);
          }
          goto __pyx_L14;
        }

        /* "pandas/algos.pyx":390
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1
 */
        __pyx_t_23 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
        if (__pyx_t_23) {

          /* "pandas/algos.pyx":391
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 */
          __pyx_t_24 = (__pyx_v_j + 1);
          for (__pyx_t_25 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
            __pyx_v_z = __pyx_t_25;

            /* "pandas/algos.pyx":392
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_38 = __pyx_v_i;
            __pyx_t_39 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_38 < 0) {
              __pyx_t_38 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_38 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_39 < 0) {
              __pyx_t_39 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_39 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_40 = __pyx_v_i;
            __pyx_t_41 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_40 < 0) {
              __pyx_t_40 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_40 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_41 < 0) {
              __pyx_t_41 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_41 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_z + 1);
          }
          goto __pyx_L14;
        }

        /* "pandas/algos.pyx":393
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 */
        __pyx_t_23 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING);
        if (__pyx_t_23) {

          /* "pandas/algos.pyx":394
 *                         ranks[i, argsorted[i, z]] = z + 1
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 *                 sum_ranks = dups = 0
 */
          __pyx_t_24 = (__pyx_v_j + 1);
          for (__pyx_t_25 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
            __pyx_v_z = __pyx_t_25;

            /* "pandas/algos.pyx":395
 *                 elif tiebreak == TIEBREAK_FIRST_DESCENDING:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2             # <<<<<<<<<<<<<<
 *                 sum_ranks = dups = 0
 * 
 */
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_43 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_42 < 0) {
              __pyx_t_42 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_42 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_43 < 0) {
              __pyx_t_43 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_43 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_44 = __pyx_v_i;
            __pyx_t_45 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_44 < 0) {
              __pyx_t_44 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_44 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_45 < 0) {
              __pyx_t_45 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_45 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_ranks.diminfo[1].strides) = ((((2 * __pyx_v_j) - __pyx_v_z) - __pyx_v_dups) + 2);
          }
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/algos.pyx":396
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = 2 * j - z - dups + 2
 *                 sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
        __pyx_v_sum_ranks = 0;
        __pyx_v_dups = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;
    }
  }

  /* "pandas/algos.pyx":398
 *                 sum_ranks = dups = 0
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         return ranks.T
 *     else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_23 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_23 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_23) {

    /* "pandas/algos.pyx":399
 * 
 *     if axis == 0:
 *         return ranks.T             # <<<<<<<<<<<<<<
 *     else:
 *         return ranks
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_ranks), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L25;
  }
  /*else*/ {

    /* "pandas/algos.pyx":401
 *         return ranks.T
 *     else:
 *         return ranks             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
    __pyx_r = ((PyObject *)__pyx_v_ranks);
    goto __pyx_L0;
  }
  __pyx_L25:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_2d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_9rank_1d_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_8rank_1d_generic[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_9rank_1d_generic = {__Pyx_NAMESTR("rank_1d_generic"), (PyCFunction)__pyx_pw_6pandas_5algos_9rank_1d_generic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_8rank_1d_generic)};
static PyObject *__pyx_pw_6pandas_5algos_9rank_1d_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  int __pyx_v_retry;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_1d_generic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__retry,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)__pyx_n_s__average);
    values[3] = __pyx_k_21;
    values[4] = ((PyObject *)__pyx_n_s__keep);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__retry);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_1d_generic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    if (values[1]) {
      __pyx_v_retry = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_retry == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_retry = ((int)1);
    }
    __pyx_v_ties_method = values[2];
    __pyx_v_ascending = values[3];
    __pyx_v_na_option = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_1d_generic", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_1d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_8rank_1d_generic(__pyx_self, __pyx_v_in_arr, __pyx_v_retry, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":404
 * 
 * 
 * def rank_1d_generic(object in_arr, bint retry=1, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_8rank_1d_generic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, int __pyx_v_retry, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_sorted_data = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  PyObject *__pyx_v_val = 0;
  PyObject *__pyx_v_nan_value = 0;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  int __pyx_v_keep_na;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v__as = NULL;
  PyObject *__pyx_v_valid_locs = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyArrayObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  PyArrayObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  int __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_int64_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  __pyx_t_5numpy_int64_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  __pyx_t_5numpy_int64_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_1d_generic", 0);
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;

  /* "pandas/algos.pyx":411
 * 
 *     cdef:
 *         Py_ssize_t i, j, n, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[float64_t] ranks
 *         ndarray sorted_data, values
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":416
 *         ndarray[int64_t] argsorted
 *         object val, nan_value
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *         bint keep_na = 0
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":417
 *         object val, nan_value
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *         bint keep_na = 0
 * 
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":418
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *         bint keep_na = 0             # <<<<<<<<<<<<<<
 * 
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_keep_na = 0;

  /* "pandas/algos.pyx":420
 *         bint keep_na = 0
 * 
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     keep_na = na_option == 'keep'
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":422
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     keep_na = na_option == 'keep'             # <<<<<<<<<<<<<<
 * 
 *     values = np.array(in_arr, copy=True)
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__keep), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_keep_na = __pyx_t_4;

  /* "pandas/algos.pyx":424
 *     keep_na = na_option == 'keep'
 * 
 *     values = np.array(in_arr, copy=True)             # <<<<<<<<<<<<<<
 * 
 *     if values.dtype != np.object_:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_in_arr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
  __Pyx_GIVEREF(__pyx_v_in_arr);
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__copy), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_values = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/algos.pyx":426
 *     values = np.array(in_arr, copy=True)
 * 
 *     if values.dtype != np.object_:             # <<<<<<<<<<<<<<
 *         values = values.astype('O')
 * 
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__object_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":427
 * 
 *     if values.dtype != np.object_:
 *         values = values.astype('O')             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_values));
    __pyx_v_values = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":429
 *         values = values.astype('O')
 * 
 *     if ascending ^ (na_option == 'top'):             # <<<<<<<<<<<<<<
 *         # always greater than everything
 *         nan_value = Infinity()
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__top), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyNumber_Xor(__pyx_v_ascending, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":431
 *     if ascending ^ (na_option == 'top'):
 *         # always greater than everything
 *         nan_value = Infinity()             # <<<<<<<<<<<<<<
 *     else:
 *         nan_value = NegInfinity()
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__Infinity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_nan_value = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":433
 *         nan_value = Infinity()
 *     else:
 *         nan_value = NegInfinity()             # <<<<<<<<<<<<<<
 * 
 *     mask = lib.isnullobj(values)
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NegInfinity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_nan_value = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":435
 *         nan_value = NegInfinity()
 * 
 *     mask = lib.isnullobj(values)             # <<<<<<<<<<<<<<
 *     np.putmask(values, mask, nan_value)
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__lib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isnullobj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_mask = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "pandas/algos.pyx":436
 * 
 *     mask = lib.isnullobj(values)
 *     np.putmask(values, mask, nan_value)             # <<<<<<<<<<<<<<
 * 
 *     n = len(values)
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__putmask); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __Pyx_INCREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  __Pyx_INCREF(__pyx_v_nan_value);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_nan_value);
  __Pyx_GIVEREF(__pyx_v_nan_value);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":438
 *     np.putmask(values, mask, nan_value)
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     ranks = np.empty(n, dtype='f8')
 * 
 */
  __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_7;

  /* "pandas/algos.pyx":439
 * 
 *     n = len(values)
 *     ranks = np.empty(n, dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     # py2.5/win32 hack, can't pass i8
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":442
 * 
 *     # py2.5/win32 hack, can't pass i8
 *     try:             # <<<<<<<<<<<<<<
 *         _as = values.argsort()
 *     except TypeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "pandas/algos.pyx":443
 *     # py2.5/win32 hack, can't pass i8
 *     try:
 *         _as = values.argsort()             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         if not retry:
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v__as = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L12_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pandas/algos.pyx":444
 *     try:
 *         _as = values.argsort()
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         if not retry:
 *             raise
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("pandas.algos.rank_1d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);

      /* "pandas/algos.pyx":445
 *         _as = values.argsort()
 *     except TypeError:
 *         if not retry:             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
      __pyx_t_4 = (!__pyx_v_retry);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":446
 *     except TypeError:
 *         if not retry:
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         valid_locs = (-mask).nonzero()[0]
 */
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_5);
        __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_5 = 0; 
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/algos.pyx":448
 *             raise
 * 
 *         valid_locs = (-mask).nonzero()[0]             # <<<<<<<<<<<<<<
 *         ranks.put(valid_locs, rank_1d_generic(values.take(valid_locs), 0,
 *                                               ties_method=ties_method,
 */
      __pyx_t_6 = PyNumber_Negative(__pyx_v_mask); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__nonzero); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_valid_locs = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "pandas/algos.pyx":449
 * 
 *         valid_locs = (-mask).nonzero()[0]
 *         ranks.put(valid_locs, rank_1d_generic(values.take(valid_locs), 0,             # <<<<<<<<<<<<<<
 *                                               ties_method=ties_method,
 *                                               ascending=ascending))
 */
      __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_ranks), __pyx_n_s__put); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__rank_1d_generic); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_13 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__take); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_v_valid_locs);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_valid_locs);
      __Pyx_GIVEREF(__pyx_v_valid_locs);
      __pyx_t_15 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      __pyx_t_15 = 0;
      __pyx_t_15 = PyDict_New(); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_15));

      /* "pandas/algos.pyx":450
 *         valid_locs = (-mask).nonzero()[0]
 *         ranks.put(valid_locs, rank_1d_generic(values.take(valid_locs), 0,
 *                                               ties_method=ties_method,             # <<<<<<<<<<<<<<
 *                                               ascending=ascending))
 *         np.putmask(ranks, mask, np.nan)
 */
      if (PyDict_SetItem(__pyx_t_15, ((PyObject *)__pyx_n_s__ties_method), __pyx_v_ties_method) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}

      /* "pandas/algos.pyx":451
 *         ranks.put(valid_locs, rank_1d_generic(values.take(valid_locs), 0,
 *                                               ties_method=ties_method,
 *                                               ascending=ascending))             # <<<<<<<<<<<<<<
 *         np.putmask(ranks, mask, np.nan)
 *         return ranks
 */
      if (PyDict_SetItem(__pyx_t_15, ((PyObject *)__pyx_n_s__ascending), __pyx_v_ascending) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __pyx_t_13 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_14), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_v_valid_locs);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_valid_locs);
      __Pyx_GIVEREF(__pyx_v_valid_locs);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "pandas/algos.pyx":452
 *                                               ties_method=ties_method,
 *                                               ascending=ascending))
 *         np.putmask(ranks, mask, np.nan)             # <<<<<<<<<<<<<<
 *         return ranks
 * 
 */
      __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_15 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__putmask); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__nan); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
      PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_ranks));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_ranks));
      __Pyx_INCREF(__pyx_v_mask);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_mask);
      __Pyx_GIVEREF(__pyx_v_mask);
      PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "pandas/algos.pyx":453
 *                                               ascending=ascending))
 *         np.putmask(ranks, mask, np.nan)
 *         return ranks             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
      __pyx_r = ((PyObject *)__pyx_v_ranks);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L8_except_return;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_exception_handled;
    }
    __pyx_L7_except_error:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L8_except_return:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
    goto __pyx_L0;
    __pyx_L6_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_10, __pyx_t_9);
    __pyx_L12_try_end:;
  }

  /* "pandas/algos.pyx":455
 *         return ranks
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[::-1]
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_16 = (!__pyx_t_4);
  if (__pyx_t_16) {

    /* "pandas/algos.pyx":456
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
    __pyx_t_5 = PyObject_GetItem(__pyx_v__as, __pyx_k_slice_23); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "pandas/algos.pyx":458
 *         _as = _as[::-1]
 * 
 *     sorted_data = values.take(_as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__take); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v__as);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__as);
  __Pyx_GIVEREF(__pyx_v__as);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_sorted_data = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":459
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_17 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":461
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         sum_ranks += i + 1
 *         dups += 1
 */
  __pyx_t_7 = __pyx_v_n;
  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_7; __pyx_t_18+=1) {
    __pyx_v_i = __pyx_t_18;

    /* "pandas/algos.pyx":462
 * 
 *     for i in range(n):
 *         sum_ranks += i + 1             # <<<<<<<<<<<<<<
 *         dups += 1
 *         val = util.get_value_at(sorted_data, i)
 */
    __pyx_v_sum_ranks = (__pyx_v_sum_ranks + (__pyx_v_i + 1));

    /* "pandas/algos.pyx":463
 *     for i in range(n):
 *         sum_ranks += i + 1
 *         dups += 1             # <<<<<<<<<<<<<<
 *         val = util.get_value_at(sorted_data, i)
 *         if val is nan_value and keep_na:
 */
    __pyx_v_dups = (__pyx_v_dups + 1);

    /* "pandas/algos.pyx":464
 *         sum_ranks += i + 1
 *         dups += 1
 *         val = util.get_value_at(sorted_data, i)             # <<<<<<<<<<<<<<
 *         if val is nan_value and keep_na:
 *             ranks[argsorted[i]] = nan
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_f_4util_get_value_at(__pyx_v_sorted_data, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pandas/algos.pyx":465
 *         dups += 1
 *         val = util.get_value_at(sorted_data, i)
 *         if val is nan_value and keep_na:             # <<<<<<<<<<<<<<
 *             ranks[argsorted[i]] = nan
 *             continue
 */
    __pyx_t_16 = (__pyx_v_val == __pyx_v_nan_value);
    if (__pyx_t_16) {
      __pyx_t_4 = __pyx_v_keep_na;
    } else {
      __pyx_t_4 = __pyx_t_16;
    }
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":466
 *         val = util.get_value_at(sorted_data, i)
 *         if val is nan_value and keep_na:
 *             ranks[argsorted[i]] = nan             # <<<<<<<<<<<<<<
 *             continue
 *         if (i == n - 1 or
 */
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_argsorted.diminfo[0].strides));
      __pyx_t_3 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_ranks.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_ranks.diminfo[0].strides) = __pyx_v_6pandas_5algos_nan;

      /* "pandas/algos.pyx":467
 *         if val is nan_value and keep_na:
 *             ranks[argsorted[i]] = nan
 *             continue             # <<<<<<<<<<<<<<
 *         if (i == n - 1 or
 *             are_diff(util.get_value_at(sorted_data, i + 1), val)):
 */
      goto __pyx_L17_continue;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "pandas/algos.pyx":468
 *             ranks[argsorted[i]] = nan
 *             continue
 *         if (i == n - 1 or             # <<<<<<<<<<<<<<
 *             are_diff(util.get_value_at(sorted_data, i + 1), val)):
 *             if tiebreak == TIEBREAK_AVERAGE:
 */
    __pyx_t_4 = (__pyx_v_i == (__pyx_v_n - 1));
    if (!__pyx_t_4) {

      /* "pandas/algos.pyx":469
 *             continue
 *         if (i == n - 1 or
 *             are_diff(util.get_value_at(sorted_data, i + 1), val)):             # <<<<<<<<<<<<<<
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 */
      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_i + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __pyx_f_4util_get_value_at(__pyx_v_sorted_data, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_f_6pandas_5algos_are_diff(__pyx_t_1, __pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_21 = __pyx_t_16;
    } else {
      __pyx_t_21 = __pyx_t_4;
    }
    if (__pyx_t_21) {

      /* "pandas/algos.pyx":470
 *         if (i == n - 1 or
 *             are_diff(util.get_value_at(sorted_data, i + 1), val)):
 *             if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 */
      __pyx_t_21 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
      if (__pyx_t_21) {

        /* "pandas/algos.pyx":471
 *             are_diff(util.get_value_at(sorted_data, i + 1), val)):
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 */
        __pyx_t_22 = (__pyx_v_i + 1);
        for (__pyx_t_23 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
          __pyx_v_j = __pyx_t_23;

          /* "pandas/algos.pyx":472
 *             if tiebreak == TIEBREAK_AVERAGE:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 */
          if (unlikely(__pyx_v_dups == 0)) {
            PyErr_Format(PyExc_ZeroDivisionError, "float division");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_25 < 0) {
            __pyx_t_25 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
        }
        goto __pyx_L21;
      }

      /* "pandas/algos.pyx":473
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 */
      __pyx_t_21 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
      if (__pyx_t_21) {

        /* "pandas/algos.pyx":474
 *                     ranks[argsorted[j]] = sum_ranks / dups
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 */
        __pyx_t_22 = (__pyx_v_i + 1);
        for (__pyx_t_23 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
          __pyx_v_j = __pyx_t_23;

          /* "pandas/algos.pyx":475
 *             elif tiebreak == TIEBREAK_MIN:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 */
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_26 < 0) {
            __pyx_t_26 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ranks.diminfo[0].strides) = ((__pyx_v_i - __pyx_v_dups) + 2);
        }
        goto __pyx_L21;
      }

      /* "pandas/algos.pyx":476
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 */
      __pyx_t_21 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
      if (__pyx_t_21) {

        /* "pandas/algos.pyx":477
 *                     ranks[argsorted[j]] = i - dups + 2
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):             # <<<<<<<<<<<<<<
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 */
        __pyx_t_22 = (__pyx_v_i + 1);
        for (__pyx_t_23 = ((__pyx_v_i - __pyx_v_dups) + 1); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
          __pyx_v_j = __pyx_t_23;

          /* "pandas/algos.pyx":478
 *             elif tiebreak == TIEBREAK_MAX:
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1             # <<<<<<<<<<<<<<
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 raise ValueError('first not supported for non-numeric data')
 */
          __pyx_t_28 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_29 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_argsorted.diminfo[0].strides));
          __pyx_t_3 = -1;
          if (__pyx_t_29 < 0) {
            __pyx_t_29 += __pyx_pybuffernd_ranks.diminfo[0].shape;
            if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ranks.diminfo[0].strides) = (__pyx_v_i + 1);
        }
        goto __pyx_L21;
      }

      /* "pandas/algos.pyx":479
 *                 for j in range(i - dups + 1, i + 1):
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                 raise ValueError('first not supported for non-numeric data')
 *             sum_ranks = dups = 0
 */
      __pyx_t_21 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
      if (__pyx_t_21) {

        /* "pandas/algos.pyx":480
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 raise ValueError('first not supported for non-numeric data')             # <<<<<<<<<<<<<<
 *             sum_ranks = dups = 0
 *     return ranks
 */
        __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L21;
      }
      __pyx_L21:;

      /* "pandas/algos.pyx":481
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 raise ValueError('first not supported for non-numeric data')
 *             sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 *     return ranks
 * 
 */
      __pyx_v_sum_ranks = 0;
      __pyx_v_dups = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;
    __pyx_L17_continue:;
  }

  /* "pandas/algos.pyx":482
 *                 raise ValueError('first not supported for non-numeric data')
 *             sum_ranks = dups = 0
 *     return ranks             # <<<<<<<<<<<<<<
 * 
 * cdef inline are_diff(object left, object right):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
  __pyx_r = ((PyObject *)__pyx_v_ranks);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_1d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_sorted_data);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_nan_value);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XDECREF(__pyx_v_valid_locs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":484
 *     return ranks
 * 
 * cdef inline are_diff(object left, object right):             # <<<<<<<<<<<<<<
 *     try:
 *         return fabs(left - right) > FP_ERR
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_5algos_are_diff(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  double __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("are_diff", 0);

  /* "pandas/algos.pyx":485
 * 
 * cdef inline are_diff(object left, object right):
 *     try:             # <<<<<<<<<<<<<<
 *         return fabs(left - right) > FP_ERR
 *     except TypeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "pandas/algos.pyx":486
 * cdef inline are_diff(object left, object right):
 *     try:
 *         return fabs(left - right) > FP_ERR             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         return left != right
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyNumber_Subtract(__pyx_v_left, __pyx_v_right); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyBool_FromLong((fabs(__pyx_t_5) > __pyx_v_6pandas_5algos_FP_ERR)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pandas/algos.pyx":487
 *     try:
 *         return fabs(left - right) > FP_ERR
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         return left != right
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("pandas.algos.are_diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "pandas/algos.pyx":488
 *         return fabs(left - right) > FP_ERR
 *     except TypeError:
 *         return left != right             # <<<<<<<<<<<<<<
 * 
 * _return_false = lambda self, other: False
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = PyObject_RichCompare(__pyx_v_left, __pyx_v_right, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("pandas.algos.are_diff", __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_6pandas_5algos_11rank_2d_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_10rank_2d_generic[] = "\n    Fast NaN-friendly version of scipy.stats.rankdata\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_11rank_2d_generic = {__Pyx_NAMESTR("rank_2d_generic"), (PyCFunction)__pyx_pw_6pandas_5algos_11rank_2d_generic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_10rank_2d_generic)};
static PyObject *__pyx_pw_6pandas_5algos_11rank_2d_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_in_arr = 0;
  PyObject *__pyx_v_axis = 0;
  PyObject *__pyx_v_ties_method = 0;
  PyObject *__pyx_v_ascending = 0;
  PyObject *__pyx_v_na_option = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rank_2d_generic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__in_arr,&__pyx_n_s__axis,&__pyx_n_s__ties_method,&__pyx_n_s__ascending,&__pyx_n_s__na_option,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_n_s__average);
    values[3] = __pyx_k_27;
    values[4] = ((PyObject *)__pyx_n_s__keep);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__in_arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ties_method);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ascending);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__na_option);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rank_2d_generic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_in_arr = values[0];
    __pyx_v_axis = values[1];
    __pyx_v_ties_method = values[2];
    __pyx_v_ascending = values[3];
    __pyx_v_na_option = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rank_2d_generic", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.rank_2d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_10rank_2d_generic(__pyx_self, __pyx_v_in_arr, __pyx_v_axis, __pyx_v_ties_method, __pyx_v_ascending, __pyx_v_na_option);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":513
 *     __cmp__ = _return_true
 * 
 * def rank_2d_generic(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */

static PyObject *__pyx_pf_6pandas_5algos_10rank_2d_generic(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_in_arr, PyObject *__pyx_v_axis, PyObject *__pyx_v_ties_method, PyObject *__pyx_v_ascending, PyObject *__pyx_v_na_option) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_z;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_infs;
  Py_ssize_t __pyx_v_dups;
  PyArrayObject *__pyx_v_ranks = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_argsorted = 0;
  PyObject *__pyx_v_val = 0;
  PyObject *__pyx_v_nan_value = 0;
  __pyx_t_5numpy_float64_t __pyx_v_sum_ranks;
  int __pyx_v_tiebreak;
  int __pyx_v_keep_na;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v__as = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_argsorted;
  __Pyx_Buffer __pyx_pybuffer_argsorted;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ranks;
  __Pyx_Buffer __pyx_pybuffer_ranks;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyArrayObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_t_21;
  PyArrayObject *__pyx_t_22 = NULL;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __pyx_t_5numpy_int64_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  int __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  __pyx_t_5numpy_int64_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  __pyx_t_5numpy_int64_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  __pyx_t_5numpy_int64_t __pyx_t_47;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rank_2d_generic", 0);
  __Pyx_INCREF(__pyx_v_in_arr);
  __pyx_pybuffer_ranks.pybuffer.buf = NULL;
  __pyx_pybuffer_ranks.refcount = 0;
  __pyx_pybuffernd_ranks.data = NULL;
  __pyx_pybuffernd_ranks.rcbuffer = &__pyx_pybuffer_ranks;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_argsorted.pybuffer.buf = NULL;
  __pyx_pybuffer_argsorted.refcount = 0;
  __pyx_pybuffernd_argsorted.data = NULL;
  __pyx_pybuffernd_argsorted.rcbuffer = &__pyx_pybuffer_argsorted;

  /* "pandas/algos.pyx":520
 * 
 *     cdef:
 *         Py_ssize_t i, j, z, k, n, infs, dups = 0             # <<<<<<<<<<<<<<
 *         ndarray[float64_t, ndim=2] ranks
 *         ndarray[object, ndim=2] values
 */
  __pyx_v_dups = 0;

  /* "pandas/algos.pyx":525
 *         ndarray[int64_t, ndim=2] argsorted
 *         object val, nan_value
 *         float64_t sum_ranks = 0             # <<<<<<<<<<<<<<
 *         int tiebreak = 0
 *         bint keep_na = 0
 */
  __pyx_v_sum_ranks = 0.0;

  /* "pandas/algos.pyx":526
 *         object val, nan_value
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0             # <<<<<<<<<<<<<<
 *         bint keep_na = 0
 * 
 */
  __pyx_v_tiebreak = 0;

  /* "pandas/algos.pyx":527
 *         float64_t sum_ranks = 0
 *         int tiebreak = 0
 *         bint keep_na = 0             # <<<<<<<<<<<<<<
 * 
 *     tiebreak = tiebreakers[ties_method]
 */
  __pyx_v_keep_na = 0;

  /* "pandas/algos.pyx":529
 *         bint keep_na = 0
 * 
 *     tiebreak = tiebreakers[ties_method]             # <<<<<<<<<<<<<<
 * 
 *     keep_na = na_option == 'keep'
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__tiebreakers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_ties_method); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_tiebreak = __pyx_t_3;

  /* "pandas/algos.pyx":531
 *     tiebreak = tiebreakers[ties_method]
 * 
 *     keep_na = na_option == 'keep'             # <<<<<<<<<<<<<<
 * 
 *     in_arr = np.asarray(in_arr)
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__keep), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_keep_na = __pyx_t_4;

  /* "pandas/algos.pyx":533
 *     keep_na = na_option == 'keep'
 * 
 *     in_arr = np.asarray(in_arr)             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_in_arr);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_in_arr);
  __Pyx_GIVEREF(__pyx_v_in_arr);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_in_arr);
  __pyx_v_in_arr = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":535
 *     in_arr = np.asarray(in_arr)
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         values = in_arr.T.copy()
 *     else:
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":536
 * 
 *     if axis == 0:
 *         values = in_arr.T.copy()             # <<<<<<<<<<<<<<
 *     else:
 *         values = in_arr.copy()
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__T); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":538
 *         values = in_arr.T.copy()
 *     else:
 *         values = in_arr.copy()             # <<<<<<<<<<<<<<
 * 
 *     if values.dtype != np.object_:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_values = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":540
 *         values = in_arr.copy()
 * 
 *     if values.dtype != np.object_:             # <<<<<<<<<<<<<<
 *         values = values.astype('O')
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__object_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":541
 * 
 *     if values.dtype != np.object_:
 *         values = values.astype('O')             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
      __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_3 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_values));
    __pyx_v_values = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":543
 *         values = values.astype('O')
 * 
 *     if ascending ^ (na_option == 'top'):             # <<<<<<<<<<<<<<
 *         # always greater than everything
 *         nan_value = Infinity()
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_na_option, ((PyObject *)__pyx_n_s__top), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyNumber_Xor(__pyx_v_ascending, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":545
 *     if ascending ^ (na_option == 'top'):
 *         # always greater than everything
 *         nan_value = Infinity()             # <<<<<<<<<<<<<<
 *     else:
 *         nan_value = NegInfinity()
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__Infinity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_nan_value = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":547
 *         nan_value = Infinity()
 *     else:
 *         nan_value = NegInfinity()             # <<<<<<<<<<<<<<
 * 
 *     mask = lib.isnullobj2d(values)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NegInfinity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_nan_value = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":549
 *         nan_value = NegInfinity()
 * 
 *     mask = lib.isnullobj2d(values)             # <<<<<<<<<<<<<<
 *     np.putmask(values, mask, nan_value)
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__lib); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isnullobj2d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_mask = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":550
 * 
 *     mask = lib.isnullobj2d(values)
 *     np.putmask(values, mask, nan_value)             # <<<<<<<<<<<<<<
 * 
 *     n, k = (<object> values).shape
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__putmask); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __Pyx_INCREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  __Pyx_INCREF(__pyx_v_nan_value);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_nan_value);
  __Pyx_GIVEREF(__pyx_v_nan_value);
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":552
 *     np.putmask(values, mask, nan_value)
 * 
 *     n, k = (<object> values).shape             # <<<<<<<<<<<<<<
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_5 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_n = __pyx_t_12;
  __pyx_v_k = __pyx_t_13;

  /* "pandas/algos.pyx":553
 * 
 *     n, k = (<object> values).shape
 *     ranks = np.empty((n, k), dtype='f8')             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_10 = 0;
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__f8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer, (PyObject*)__pyx_v_ranks, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_ranks.diminfo[0].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ranks.diminfo[0].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ranks.diminfo[1].strides = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ranks.diminfo[1].shape = __pyx_pybuffernd_ranks.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_ranks = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":555
 *     ranks = np.empty((n, k), dtype='f8')
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         _as = values.argsort(1)
 *     except TypeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "pandas/algos.pyx":556
 * 
 *     try:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         values = in_arr
 */
      __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__argsort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v__as = __pyx_t_10;
      __pyx_t_10 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L15_try_end;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "pandas/algos.pyx":557
 *     try:
 *         _as = values.argsort(1)
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         values = in_arr
 *         for i in range(len(values)):
 */
    __pyx_t_3 = PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_3) {
      __Pyx_AddTraceback("pandas.algos.rank_2d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);

      /* "pandas/algos.pyx":558
 *         _as = values.argsort(1)
 *     except TypeError:
 *         values = in_arr             # <<<<<<<<<<<<<<
 *         for i in range(len(values)):
 *             ranks[i] = rank_1d_generic(in_arr[i],
 */
      if (!(likely(((__pyx_v_in_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_v_in_arr);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
        __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_3 < 0)) {
          PyErr_Fetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
          }
        }
        __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      }
      __pyx_t_6 = 0;
      __Pyx_INCREF(__pyx_v_in_arr);
      __Pyx_DECREF(((PyObject *)__pyx_v_values));
      __pyx_v_values = ((PyArrayObject *)__pyx_v_in_arr);

      /* "pandas/algos.pyx":559
 *     except TypeError:
 *         values = in_arr
 *         for i in range(len(values)):             # <<<<<<<<<<<<<<
 *             ranks[i] = rank_1d_generic(in_arr[i],
 *                                        ties_method=ties_method,
 */
      __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

        /* "pandas/algos.pyx":560
 *         values = in_arr
 *         for i in range(len(values)):
 *             ranks[i] = rank_1d_generic(in_arr[i],             # <<<<<<<<<<<<<<
 *                                        ties_method=ties_method,
 *                                        ascending=ascending)
 */
        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__rank_1d_generic); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_18 = __Pyx_GetItemInt(__pyx_v_in_arr, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_19);
        PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_18);
        __Pyx_GIVEREF(__pyx_t_18);
        __pyx_t_18 = 0;
        __pyx_t_18 = PyDict_New(); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_18));

        /* "pandas/algos.pyx":561
 *         for i in range(len(values)):
 *             ranks[i] = rank_1d_generic(in_arr[i],
 *                                        ties_method=ties_method,             # <<<<<<<<<<<<<<
 *                                        ascending=ascending)
 *         if axis == 0:
 */
        if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__ties_method), __pyx_v_ties_method) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}

        /* "pandas/algos.pyx":562
 *             ranks[i] = rank_1d_generic(in_arr[i],
 *                                        ties_method=ties_method,
 *                                        ascending=ascending)             # <<<<<<<<<<<<<<
 *         if axis == 0:
 *             return ranks.T
 */
        if (PyDict_SetItem(__pyx_t_18, ((PyObject *)__pyx_n_s__ascending), __pyx_v_ascending) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __pyx_t_20 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_19), ((PyObject *)__pyx_t_18)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;

        /* "pandas/algos.pyx":560
 *         values = in_arr
 *         for i in range(len(values)):
 *             ranks[i] = rank_1d_generic(in_arr[i],             # <<<<<<<<<<<<<<
 *                                        ties_method=ties_method,
 *                                        ascending=ascending)
 */
        if (__Pyx_SetItemInt(((PyObject *)__pyx_v_ranks), __pyx_v_i, __pyx_t_20, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      }

      /* "pandas/algos.pyx":563
 *                                        ties_method=ties_method,
 *                                        ascending=ascending)
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             return ranks.T
 *         else:
 */
      __pyx_t_20 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_20); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_20); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":564
 *                                        ascending=ascending)
 *         if axis == 0:
 *             return ranks.T             # <<<<<<<<<<<<<<
 *         else:
 *             return ranks
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_20 = PyObject_GetAttr(((PyObject *)__pyx_v_ranks), __pyx_n_s__T); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_r = __pyx_t_20;
        __pyx_t_20 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L11_except_return;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "pandas/algos.pyx":566
 *             return ranks.T
 *         else:
 *             return ranks             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
        __pyx_r = ((PyObject *)__pyx_v_ranks);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L11_except_return;
      }
      __pyx_L20:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L9_exception_handled;
    }
    __pyx_L10_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L11_except_return:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L0;
    __pyx_L9_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L15_try_end:;
  }

  /* "pandas/algos.pyx":568
 *             return ranks
 * 
 *     if not ascending:             # <<<<<<<<<<<<<<
 *         _as = _as[:, ::-1]
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ascending); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = (!__pyx_t_4);
  if (__pyx_t_21) {

    /* "pandas/algos.pyx":569
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_object(values, _as)
 */
    __pyx_t_2 = PyObject_GetItem(__pyx_v__as, ((PyObject *)__pyx_k_tuple_32)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v__as);
    __pyx_v__as = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "pandas/algos.pyx":571
 *         _as = _as[:, ::-1]
 * 
 *     values = _take_2d_object(values, _as)             # <<<<<<<<<<<<<<
 *     argsorted = _as.astype('i8')
 * 
 */
  __pyx_t_2 = __pyx_f_6pandas_5algos__take_2d_object(((PyArrayObject *)__pyx_v_values), __pyx_v__as); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_values));
  __pyx_v_values = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":572
 * 
 *     values = _take_2d_object(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v__as, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_22 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_argsorted.diminfo[0].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_argsorted.diminfo[0].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_argsorted.diminfo[1].strides = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_argsorted.diminfo[1].shape = __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_22 = 0;
  __pyx_v_argsorted = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":574
 *     argsorted = _as.astype('i8')
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         dups = sum_ranks = infs = 0
 *         for j in range(k):
 */
  __pyx_t_13 = __pyx_v_n;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/algos.pyx":575
 * 
 *     for i in range(n):
 *         dups = sum_ranks = infs = 0             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             val = values[i, j]
 */
    __pyx_v_dups = 0;
    __pyx_v_sum_ranks = 0;
    __pyx_v_infs = 0;

    /* "pandas/algos.pyx":576
 *     for i in range(n):
 *         dups = sum_ranks = infs = 0
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 *             if val is nan_value and keep_na:
 */
    __pyx_t_23 = __pyx_v_k;
    for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
      __pyx_v_j = __pyx_t_24;

      /* "pandas/algos.pyx":577
 *         dups = sum_ranks = infs = 0
 *         for j in range(k):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 *             if val is nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan
 */
      __pyx_t_25 = __pyx_v_i;
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
      if (__pyx_t_26 < 0) {
        __pyx_t_26 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 1;
      } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_1);
      __Pyx_XDECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "pandas/algos.pyx":578
 *         for j in range(k):
 *             val = values[i, j]
 *             if val is nan_value and keep_na:             # <<<<<<<<<<<<<<
 *                 ranks[i, argsorted[i, j]] = nan
 *                 infs += 1
 */
      __pyx_t_21 = (__pyx_v_val == __pyx_v_nan_value);
      if (__pyx_t_21) {
        __pyx_t_4 = __pyx_v_keep_na;
      } else {
        __pyx_t_4 = __pyx_t_21;
      }
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":579
 *             val = values[i, j]
 *             if val is nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan             # <<<<<<<<<<<<<<
 *                 infs += 1
 *                 continue
 */
        __pyx_t_27 = __pyx_v_i;
        __pyx_t_28 = __pyx_v_j;
        __pyx_t_3 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_29 = __pyx_v_i;
        __pyx_t_30 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_argsorted.diminfo[1].strides));
        __pyx_t_3 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_ranks.diminfo[0].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_30 < 0) {
          __pyx_t_30 += __pyx_pybuffernd_ranks.diminfo[1].shape;
          if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_ranks.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;

        /* "pandas/algos.pyx":580
 *             if val is nan_value and keep_na:
 *                 ranks[i, argsorted[i, j]] = nan
 *                 infs += 1             # <<<<<<<<<<<<<<
 *                 continue
 *             sum_ranks += (j - infs) + 1
 */
        __pyx_v_infs = (__pyx_v_infs + 1);

        /* "pandas/algos.pyx":581
 *                 ranks[i, argsorted[i, j]] = nan
 *                 infs += 1
 *                 continue             # <<<<<<<<<<<<<<
 *             sum_ranks += (j - infs) + 1
 *             dups += 1
 */
        goto __pyx_L24_continue;
        goto __pyx_L26;
      }
      __pyx_L26:;

      /* "pandas/algos.pyx":582
 *                 infs += 1
 *                 continue
 *             sum_ranks += (j - infs) + 1             # <<<<<<<<<<<<<<
 *             dups += 1
 *             if j == k - 1 or are_diff(values[i, j + 1], val):
 */
      __pyx_v_sum_ranks = (__pyx_v_sum_ranks + ((__pyx_v_j - __pyx_v_infs) + 1));

      /* "pandas/algos.pyx":583
 *                 continue
 *             sum_ranks += (j - infs) + 1
 *             dups += 1             # <<<<<<<<<<<<<<
 *             if j == k - 1 or are_diff(values[i, j + 1], val):
 *                 if tiebreak == TIEBREAK_AVERAGE:
 */
      __pyx_v_dups = (__pyx_v_dups + 1);

      /* "pandas/algos.pyx":584
 *             sum_ranks += (j - infs) + 1
 *             dups += 1
 *             if j == k - 1 or are_diff(values[i, j + 1], val):             # <<<<<<<<<<<<<<
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 */
      __pyx_t_4 = (__pyx_v_j == (__pyx_v_k - 1));
      if (!__pyx_t_4) {
        __pyx_t_31 = __pyx_v_i;
        __pyx_t_32 = (__pyx_v_j + 1);
        __pyx_t_3 = -1;
        if (__pyx_t_31 < 0) {
          __pyx_t_31 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_3 = 0;
        if (__pyx_t_32 < 0) {
          __pyx_t_32 += __pyx_pybuffernd_values.diminfo[1].shape;
          if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 1;
        } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_3 = 1;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        __pyx_t_2 = __pyx_f_6pandas_5algos_are_diff(__pyx_t_1, __pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_21 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_33 = __pyx_t_21;
      } else {
        __pyx_t_33 = __pyx_t_4;
      }
      if (__pyx_t_33) {

        /* "pandas/algos.pyx":585
 *             dups += 1
 *             if j == k - 1 or are_diff(values[i, j + 1], val):
 *                 if tiebreak == TIEBREAK_AVERAGE:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 */
        __pyx_t_33 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE);
        if (__pyx_t_33) {

          /* "pandas/algos.pyx":586
 *             if j == k - 1 or are_diff(values[i, j + 1], val):
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 */
          __pyx_t_34 = (__pyx_v_j + 1);
          for (__pyx_t_35 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
            __pyx_v_z = __pyx_t_35;

            /* "pandas/algos.pyx":587
 *                 if tiebreak == TIEBREAK_AVERAGE:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 */
            if (unlikely(__pyx_v_dups == 0)) {
              PyErr_Format(PyExc_ZeroDivisionError, "float division");
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_36 = __pyx_v_i;
            __pyx_t_37 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_36 < 0) {
              __pyx_t_36 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_36 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_37 < 0) {
              __pyx_t_37 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_37 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_38 = __pyx_v_i;
            __pyx_t_39 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_38 < 0) {
              __pyx_t_38 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_38 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_39 < 0) {
              __pyx_t_39 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_39 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_sum_ranks / __pyx_v_dups);
          }
          goto __pyx_L28;
        }

        /* "pandas/algos.pyx":588
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 */
        __pyx_t_33 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MIN);
        if (__pyx_t_33) {

          /* "pandas/algos.pyx":589
 *                         ranks[i, argsorted[i, z]] = sum_ranks / dups
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 */
          __pyx_t_34 = (__pyx_v_j + 1);
          for (__pyx_t_35 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
            __pyx_v_z = __pyx_t_35;

            /* "pandas/algos.pyx":590
 *                 elif tiebreak == TIEBREAK_MIN:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 */
            __pyx_t_40 = __pyx_v_i;
            __pyx_t_41 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_40 < 0) {
              __pyx_t_40 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_40 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_41 < 0) {
              __pyx_t_41 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_41 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_43 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_42 < 0) {
              __pyx_t_42 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_42 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_43 < 0) {
              __pyx_t_43 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_43 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_ranks.diminfo[1].strides) = ((__pyx_v_j - __pyx_v_dups) + 2);
          }
          goto __pyx_L28;
        }

        /* "pandas/algos.pyx":591
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:             # <<<<<<<<<<<<<<
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 */
        __pyx_t_33 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_MAX);
        if (__pyx_t_33) {

          /* "pandas/algos.pyx":592
 *                         ranks[i, argsorted[i, z]] = j - dups + 2
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):             # <<<<<<<<<<<<<<
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 */
          __pyx_t_34 = (__pyx_v_j + 1);
          for (__pyx_t_35 = ((__pyx_v_j - __pyx_v_dups) + 1); __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
            __pyx_v_z = __pyx_t_35;

            /* "pandas/algos.pyx":593
 *                 elif tiebreak == TIEBREAK_MAX:
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1             # <<<<<<<<<<<<<<
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     raise ValueError('first not supported for '
 */
            __pyx_t_44 = __pyx_v_i;
            __pyx_t_45 = __pyx_v_z;
            __pyx_t_3 = -1;
            if (__pyx_t_44 < 0) {
              __pyx_t_44 += __pyx_pybuffernd_argsorted.diminfo[0].shape;
              if (unlikely(__pyx_t_44 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_argsorted.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_45 < 0) {
              __pyx_t_45 += __pyx_pybuffernd_argsorted.diminfo[1].shape;
              if (unlikely(__pyx_t_45 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_argsorted.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_46 = __pyx_v_i;
            __pyx_t_47 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_argsorted.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_argsorted.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_argsorted.diminfo[1].strides));
            __pyx_t_3 = -1;
            if (__pyx_t_46 < 0) {
              __pyx_t_46 += __pyx_pybuffernd_ranks.diminfo[0].shape;
              if (unlikely(__pyx_t_46 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_ranks.diminfo[0].shape)) __pyx_t_3 = 0;
            if (__pyx_t_47 < 0) {
              __pyx_t_47 += __pyx_pybuffernd_ranks.diminfo[1].shape;
              if (unlikely(__pyx_t_47 < 0)) __pyx_t_3 = 1;
            } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_ranks.diminfo[1].shape)) __pyx_t_3 = 1;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ranks.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_ranks.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_ranks.diminfo[1].strides) = (__pyx_v_j + 1);
          }
          goto __pyx_L28;
        }

        /* "pandas/algos.pyx":594
 *                     for z in range(j - dups + 1, j + 1):
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:             # <<<<<<<<<<<<<<
 *                     raise ValueError('first not supported for '
 *                                      'non-numeric data')
 */
        __pyx_t_33 = (__pyx_v_tiebreak == __pyx_v_6pandas_5algos_TIEBREAK_FIRST);
        if (__pyx_t_33) {

          /* "pandas/algos.pyx":595
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     raise ValueError('first not supported for '             # <<<<<<<<<<<<<<
 *                                      'non-numeric data')
 *                 sum_ranks = dups = 0
 */
          __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_Raise(__pyx_t_2, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          goto __pyx_L28;
        }
        __pyx_L28:;

        /* "pandas/algos.pyx":597
 *                     raise ValueError('first not supported for '
 *                                      'non-numeric data')
 *                 sum_ranks = dups = 0             # <<<<<<<<<<<<<<
 * 
 *     if axis == 0:
 */
        __pyx_v_sum_ranks = 0;
        __pyx_v_dups = 0;
        goto __pyx_L27;
      }
      __pyx_L27:;
      __pyx_L24_continue:;
    }
  }

  /* "pandas/algos.pyx":599
 *                 sum_ranks = dups = 0
 * 
 *     if axis == 0:             # <<<<<<<<<<<<<<
 *         return ranks.T
 *     else:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_axis, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_33 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_33 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_33) {

    /* "pandas/algos.pyx":600
 * 
 *     if axis == 0:
 *         return ranks.T             # <<<<<<<<<<<<<<
 *     else:
 *         return ranks
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_ranks), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L35;
  }
  /*else*/ {

    /* "pandas/algos.pyx":602
 *         return ranks.T
 *     else:
 *         return ranks             # <<<<<<<<<<<<<<
 * 
 * # def _take_indexer_2d(ndarray[float64_t, ndim=2] values,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_ranks));
    __pyx_r = ((PyObject *)__pyx_v_ranks);
    goto __pyx_L0;
  }
  __pyx_L35:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.rank_2d_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_argsorted.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ranks.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ranks);
  __Pyx_XDECREF((PyObject *)__pyx_v_values);
  __Pyx_XDECREF((PyObject *)__pyx_v_argsorted);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_nan_value);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v__as);
  __Pyx_XDECREF(__pyx_v_in_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_13diff_2d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_13diff_2d_float64 = {__Pyx_NAMESTR("diff_2d_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_13diff_2d_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_13diff_2d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_arr = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_ssize_t __pyx_v_periods;
  int __pyx_v_axis;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diff_2d_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__out,&__pyx_n_s__periods,&__pyx_n_s__axis,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_float64", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__periods)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_float64", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_float64", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diff_2d_float64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_arr = ((PyArrayObject *)values[0]);
    __pyx_v_out = ((PyArrayObject *)values[1]);
    __pyx_v_periods = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_periods == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_axis = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diff_2d_float64", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.diff_2d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_12diff_2d_float64(__pyx_self, __pyx_v_arr, __pyx_v_out, __pyx_v_periods, __pyx_v_axis);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_float64(ndarray[float64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                     ndarray[float64_t, ndim=2] out,
 *                     Py_ssize_t periods, int axis):
 */

static PyObject *__pyx_pf_6pandas_5algos_12diff_2d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_sx;
  Py_ssize_t __pyx_v_sy;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("diff_2d_float64", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_arr.diminfo[1].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_arr.diminfo[1].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":627
 *         Py_ssize_t i, j, sx, sy
 * 
 *     sx, sy = (<object> arr).shape             # <<<<<<<<<<<<<<
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sx = __pyx_t_6;
  __pyx_v_sy = __pyx_t_7;

  /* "pandas/algos.pyx":628
 * 
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:             # <<<<<<<<<<<<<<
 *         if axis == 0:
 *             if periods >= 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__f_contiguous); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "pandas/algos.pyx":629
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":630
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":631
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/algos.pyx":633
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for j in range(sy):
 *                 for i in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L7:;

      /* "pandas/algos.pyx":634
 *             else:
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):             # <<<<<<<<<<<<<<
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_sy;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":635
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):
 *                 for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":636
 *             for j in range(sy):
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_11 = __pyx_v_i;
          __pyx_t_12 = __pyx_v_j;
          __pyx_t_13 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_16 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/algos.pyx":638
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":639
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "pandas/algos.pyx":641
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for j in range(start, stop):
 *                 for i in range(sx):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L12:;

      /* "pandas/algos.pyx":642
 *             else:
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":643
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):
 *                 for i in range(sx):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 */
        __pyx_t_9 = __pyx_v_sx;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":644
 *             for j in range(start, stop):
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 *     else:
 *         if axis == 0:
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_j;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":646
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":647
 *     else:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":648
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/algos.pyx":650
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for i in range(start, stop):
 *                 for j in range(sy):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L18:;

      /* "pandas/algos.pyx":651
 *             else:
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":652
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):
 *                 for j in range(sy):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_sy;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":653
 *             for i in range(start, stop):
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_25 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L17;
    }
    /*else*/ {

      /* "pandas/algos.pyx":655
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":656
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":658
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for i in range(sx):
 *                 for j in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L23:;

      /* "pandas/algos.pyx":659
 *             else:
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):             # <<<<<<<<<<<<<<
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_sx;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":660
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):
 *                 for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 * 
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":661
 *             for i in range(sx):
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_29 = __pyx_v_i;
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_i;
          __pyx_t_32 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_33 = __pyx_v_i;
          __pyx_t_34 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L17:;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.diff_2d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_15diff_2d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_15diff_2d_int64 = {__Pyx_NAMESTR("diff_2d_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_15diff_2d_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_15diff_2d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_arr = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_ssize_t __pyx_v_periods;
  int __pyx_v_axis;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diff_2d_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__out,&__pyx_n_s__periods,&__pyx_n_s__axis,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int64", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__periods)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int64", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int64", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diff_2d_int64") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_arr = ((PyArrayObject *)values[0]);
    __pyx_v_out = ((PyArrayObject *)values[1]);
    __pyx_v_periods = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_periods == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_axis = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diff_2d_int64", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.diff_2d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_14diff_2d_int64(__pyx_self, __pyx_v_arr, __pyx_v_out, __pyx_v_periods, __pyx_v_axis);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":665
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int64(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */

static PyObject *__pyx_pf_6pandas_5algos_14diff_2d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_sx;
  Py_ssize_t __pyx_v_sy;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("diff_2d_int64", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_arr.diminfo[1].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_arr.diminfo[1].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":671
 *         Py_ssize_t i, j, sx, sy
 * 
 *     sx, sy = (<object> arr).shape             # <<<<<<<<<<<<<<
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sx = __pyx_t_6;
  __pyx_v_sy = __pyx_t_7;

  /* "pandas/algos.pyx":672
 * 
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:             # <<<<<<<<<<<<<<
 *         if axis == 0:
 *             if periods >= 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__f_contiguous); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "pandas/algos.pyx":673
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":674
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":675
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/algos.pyx":677
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for j in range(sy):
 *                 for i in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L7:;

      /* "pandas/algos.pyx":678
 *             else:
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):             # <<<<<<<<<<<<<<
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_sy;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":679
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):
 *                 for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":680
 *             for j in range(sy):
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_11 = __pyx_v_i;
          __pyx_t_12 = __pyx_v_j;
          __pyx_t_13 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_16 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/algos.pyx":682
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":683
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "pandas/algos.pyx":685
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for j in range(start, stop):
 *                 for i in range(sx):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L12:;

      /* "pandas/algos.pyx":686
 *             else:
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":687
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):
 *                 for i in range(sx):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 */
        __pyx_t_9 = __pyx_v_sx;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":688
 *             for j in range(start, stop):
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 *     else:
 *         if axis == 0:
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_j;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":690
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":691
 *     else:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":692
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/algos.pyx":694
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for i in range(start, stop):
 *                 for j in range(sy):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L18:;

      /* "pandas/algos.pyx":695
 *             else:
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":696
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):
 *                 for j in range(sy):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_sy;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":697
 *             for i in range(start, stop):
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_25 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L17;
    }
    /*else*/ {

      /* "pandas/algos.pyx":699
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":700
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":702
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for i in range(sx):
 *                 for j in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L23:;

      /* "pandas/algos.pyx":703
 *             else:
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):             # <<<<<<<<<<<<<<
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_sx;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":704
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):
 *                 for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 * 
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":705
 *             for i in range(sx):
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_29 = __pyx_v_i;
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_i;
          __pyx_t_32 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_33 = __pyx_v_i;
          __pyx_t_34 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L17:;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.diff_2d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_17diff_2d_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_17diff_2d_int32 = {__Pyx_NAMESTR("diff_2d_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_17diff_2d_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_17diff_2d_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_arr = 0;
  PyArrayObject *__pyx_v_out = 0;
  Py_ssize_t __pyx_v_periods;
  int __pyx_v_axis;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diff_2d_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__out,&__pyx_n_s__periods,&__pyx_n_s__axis,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int32", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__periods)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int32", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diff_2d_int32", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diff_2d_int32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_arr = ((PyArrayObject *)values[0]);
    __pyx_v_out = ((PyArrayObject *)values[1]);
    __pyx_v_periods = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_periods == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_axis = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diff_2d_int32", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.diff_2d_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_16diff_2d_int32(__pyx_self, __pyx_v_arr, __pyx_v_out, __pyx_v_periods, __pyx_v_axis);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":710
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int32(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */

static PyObject *__pyx_pf_6pandas_5algos_16diff_2d_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr, PyArrayObject *__pyx_v_out, Py_ssize_t __pyx_v_periods, int __pyx_v_axis) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_sx;
  Py_ssize_t __pyx_v_sy;
  Py_ssize_t __pyx_v_start;
  Py_ssize_t __pyx_v_stop;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("diff_2d_int32", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_arr.diminfo[1].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_arr.diminfo[1].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":716
 *         Py_ssize_t i, j, sx, sy
 * 
 *     sx, sy = (<object> arr).shape             # <<<<<<<<<<<<<<
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sx = __pyx_t_6;
  __pyx_v_sy = __pyx_t_7;

  /* "pandas/algos.pyx":717
 * 
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:             # <<<<<<<<<<<<<<
 *         if axis == 0:
 *             if periods >= 0:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__f_contiguous); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_8) {

    /* "pandas/algos.pyx":718
 *     sx, sy = (<object> arr).shape
 *     if arr.flags.f_contiguous:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":719
 *     if arr.flags.f_contiguous:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":720
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/algos.pyx":722
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for j in range(sy):
 *                 for i in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L7:;

      /* "pandas/algos.pyx":723
 *             else:
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):             # <<<<<<<<<<<<<<
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_sy;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":724
 *                 start, stop = 0, sx + periods
 *             for j in range(sy):
 *                 for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":725
 *             for j in range(sy):
 *                 for i in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_11 = __pyx_v_i;
          __pyx_t_12 = __pyx_v_j;
          __pyx_t_13 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_16 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/algos.pyx":727
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":728
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L12;
      }
      /*else*/ {

        /* "pandas/algos.pyx":730
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for j in range(start, stop):
 *                 for i in range(sx):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L12:;

      /* "pandas/algos.pyx":731
 *             else:
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_j = __pyx_t_6;

        /* "pandas/algos.pyx":732
 *                 start, stop = 0, sy + periods
 *             for j in range(start, stop):
 *                 for i in range(sx):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 */
        __pyx_t_9 = __pyx_v_sx;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_i = __pyx_t_10;

          /* "pandas/algos.pyx":733
 *             for j in range(start, stop):
 *                 for i in range(sx):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 *     else:
 *         if axis == 0:
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_j;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":735
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 *     else:
 *         if axis == 0:             # <<<<<<<<<<<<<<
 *             if periods >= 0:
 *                 start, stop = periods, sx
 */
    __pyx_t_8 = (__pyx_v_axis == 0);
    if (__pyx_t_8) {

      /* "pandas/algos.pyx":736
 *     else:
 *         if axis == 0:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sx
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":737
 *         if axis == 0:
 *             if periods >= 0:
 *                 start, stop = periods, sx             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sx + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sx;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/algos.pyx":739
 *                 start, stop = periods, sx
 *             else:
 *                 start, stop = 0, sx + periods             # <<<<<<<<<<<<<<
 *             for i in range(start, stop):
 *                 for j in range(sy):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sx + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L18:;

      /* "pandas/algos.pyx":740
 *             else:
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):             # <<<<<<<<<<<<<<
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 */
      __pyx_t_7 = __pyx_v_stop;
      for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":741
 *                 start, stop = 0, sx + periods
 *             for i in range(start, stop):
 *                 for j in range(sy):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 */
        __pyx_t_9 = __pyx_v_sy;
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":742
 *             for i in range(start, stop):
 *                 for j in range(sy):
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]             # <<<<<<<<<<<<<<
 *         else:
 *             if periods >= 0:
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_25 = (__pyx_v_i - __pyx_v_periods);
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
      goto __pyx_L17;
    }
    /*else*/ {

      /* "pandas/algos.pyx":744
 *                     out[i, j] = arr[i, j] - arr[i - periods, j]
 *         else:
 *             if periods >= 0:             # <<<<<<<<<<<<<<
 *                 start, stop = periods, sy
 *             else:
 */
      __pyx_t_8 = (__pyx_v_periods >= 0);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":745
 *         else:
 *             if periods >= 0:
 *                 start, stop = periods, sy             # <<<<<<<<<<<<<<
 *             else:
 *                 start, stop = 0, sy + periods
 */
        __pyx_t_7 = __pyx_v_periods;
        __pyx_t_6 = __pyx_v_sy;
        __pyx_v_start = __pyx_t_7;
        __pyx_v_stop = __pyx_t_6;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":747
 *                 start, stop = periods, sy
 *             else:
 *                 start, stop = 0, sy + periods             # <<<<<<<<<<<<<<
 *             for i in range(sx):
 *                 for j in range(start, stop):
 */
        __pyx_t_6 = 0;
        __pyx_t_7 = (__pyx_v_sy + __pyx_v_periods);
        __pyx_v_start = __pyx_t_6;
        __pyx_v_stop = __pyx_t_7;
      }
      __pyx_L23:;

      /* "pandas/algos.pyx":748
 *             else:
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):             # <<<<<<<<<<<<<<
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 */
      __pyx_t_7 = __pyx_v_sx;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
        __pyx_v_i = __pyx_t_6;

        /* "pandas/algos.pyx":749
 *                 start, stop = 0, sy + periods
 *             for i in range(sx):
 *                 for j in range(start, stop):             # <<<<<<<<<<<<<<
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]
 * 
 */
        __pyx_t_9 = __pyx_v_stop;
        for (__pyx_t_10 = __pyx_v_start; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
          __pyx_v_j = __pyx_t_10;

          /* "pandas/algos.pyx":750
 *             for i in range(sx):
 *                 for j in range(start, stop):
 *                     out[i, j] = arr[i, j] - arr[i, j - periods]             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_29 = __pyx_v_i;
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_i;
          __pyx_t_32 = (__pyx_v_j - __pyx_v_periods);
          __pyx_t_33 = __pyx_v_i;
          __pyx_t_34 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_arr.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_arr.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_arr.diminfo[1].strides)));
        }
      }
    }
    __pyx_L17:;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.diff_2d_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_19_check_minp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_19_check_minp = {__Pyx_NAMESTR("_check_minp"), (PyCFunction)__pyx_pw_6pandas_5algos_19_check_minp, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_19_check_minp(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_win = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_check_minp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__win,&__pyx_n_s__minp,&__pyx_n_s__N,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_check_minp", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_check_minp", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_check_minp") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __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_win = values[0];
    __pyx_v_minp = values[1];
    __pyx_v_N = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_check_minp", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos._check_minp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_18_check_minp(__pyx_self, __pyx_v_win, __pyx_v_minp, __pyx_v_N);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":764
 * # -
 * 
 * def _check_minp(win, minp, N):             # <<<<<<<<<<<<<<
 *     if minp > win:
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 */

static PyObject *__pyx_pf_6pandas_5algos_18_check_minp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_win, PyObject *__pyx_v_minp, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_check_minp", 0);
  __Pyx_INCREF(__pyx_v_minp);

  /* "pandas/algos.pyx":765
 * 
 * def _check_minp(win, minp, N):
 *     if minp > win:             # <<<<<<<<<<<<<<
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 *                         % (minp, win))
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_minp, __pyx_v_win, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":767
 *     if minp > win:
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 *                         % (minp, win))             # <<<<<<<<<<<<<<
 *     elif minp > N:
 *         minp = N + 1
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_minp);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_minp);
    __Pyx_GIVEREF(__pyx_v_minp);
    __Pyx_INCREF(__pyx_v_win);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_win);
    __Pyx_GIVEREF(__pyx_v_win);
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }

  /* "pandas/algos.pyx":768
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 *                         % (minp, win))
 *     elif minp > N:             # <<<<<<<<<<<<<<
 *         minp = N + 1
 *     elif minp == 0:
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_minp, __pyx_v_N, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":769
 *                         % (minp, win))
 *     elif minp > N:
 *         minp = N + 1             # <<<<<<<<<<<<<<
 *     elif minp == 0:
 *         minp = 1
 */
    __pyx_t_3 = PyNumber_Add(__pyx_v_N, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }

  /* "pandas/algos.pyx":770
 *     elif minp > N:
 *         minp = N + 1
 *     elif minp == 0:             # <<<<<<<<<<<<<<
 *         minp = 1
 *     elif minp < 0:
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_minp, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":771
 *         minp = N + 1
 *     elif minp == 0:
 *         minp = 1             # <<<<<<<<<<<<<<
 *     elif minp < 0:
 *         raise ValueError('min_periods must be >= 0')
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_int_1;
    goto __pyx_L3;
  }

  /* "pandas/algos.pyx":772
 *     elif minp == 0:
 *         minp = 1
 *     elif minp < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('min_periods must be >= 0')
 *     return minp
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_minp, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":773
 *         minp = 1
 *     elif minp < 0:
 *         raise ValueError('min_periods must be >= 0')             # <<<<<<<<<<<<<<
 *     return minp
 * 
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":774
 *     elif minp < 0:
 *         raise ValueError('min_periods must be >= 0')
 *     return minp             # <<<<<<<<<<<<<<
 * 
 * # original C implementation by N. Devillard.
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_minp);
  __pyx_r = __pyx_v_minp;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pandas.algos._check_minp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_21kth_smallest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_21kth_smallest = {__Pyx_NAMESTR("kth_smallest"), (PyCFunction)__pyx_pw_6pandas_5algos_21kth_smallest, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_21kth_smallest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_a = 0;
  Py_ssize_t __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kth_smallest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__k,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("kth_smallest", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "kth_smallest") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_a = ((PyArrayObject *)values[0]);
    __pyx_v_k = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_k == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("kth_smallest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.kth_smallest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_20kth_smallest(__pyx_self, __pyx_v_a, __pyx_v_k);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":791
 * #               Series: Prentice-Hall Series in Automatic Computation
 * 
 * def kth_smallest(ndarray[double_t] a, Py_ssize_t k):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i,j,l,m,n
 */

static PyObject *__pyx_pf_6pandas_5algos_20kth_smallest(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, Py_ssize_t __pyx_v_k) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_l;
  Py_ssize_t __pyx_v_m;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_double_t __pyx_v_x;
  __pyx_t_5numpy_double_t __pyx_v_t;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_a;
  __Pyx_Buffer __pyx_pybuffer_a;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("kth_smallest", 0);
  __pyx_pybuffer_a.pybuffer.buf = NULL;
  __pyx_pybuffer_a.refcount = 0;
  __pyx_pybuffernd_a.data = NULL;
  __pyx_pybuffernd_a.rcbuffer = &__pyx_pybuffer_a;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a.rcbuffer->pybuffer, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_a.diminfo[0].strides = __pyx_pybuffernd_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a.diminfo[0].shape = __pyx_pybuffernd_a.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":796
 *         double_t x, t
 * 
 *     n = len(a)             # <<<<<<<<<<<<<<
 * 
 *     l = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_a)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":798
 *     n = len(a)
 * 
 *     l = 0             # <<<<<<<<<<<<<<
 *     m = n-1
 *     while (l<m):
 */
  __pyx_v_l = 0;

  /* "pandas/algos.pyx":799
 * 
 *     l = 0
 *     m = n-1             # <<<<<<<<<<<<<<
 *     while (l<m):
 *         x = a[k]
 */
  __pyx_v_m = (__pyx_v_n - 1);

  /* "pandas/algos.pyx":800
 *     l = 0
 *     m = n-1
 *     while (l<m):             # <<<<<<<<<<<<<<
 *         x = a[k]
 *         i = l
 */
  while (1) {
    __pyx_t_2 = (__pyx_v_l < __pyx_v_m);
    if (!__pyx_t_2) break;

    /* "pandas/algos.pyx":801
 *     m = n-1
 *     while (l<m):
 *         x = a[k]             # <<<<<<<<<<<<<<
 *         i = l
 *         j = m
 */
    __pyx_t_1 = __pyx_v_k;
    __pyx_t_3 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_a.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
    if (unlikely(__pyx_t_3 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_3);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_x = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a.diminfo[0].strides));

    /* "pandas/algos.pyx":802
 *     while (l<m):
 *         x = a[k]
 *         i = l             # <<<<<<<<<<<<<<
 *         j = m
 * 
 */
    __pyx_v_i = __pyx_v_l;

    /* "pandas/algos.pyx":803
 *         x = a[k]
 *         i = l
 *         j = m             # <<<<<<<<<<<<<<
 * 
 *         while 1:
 */
    __pyx_v_j = __pyx_v_m;

    /* "pandas/algos.pyx":805
 *         j = m
 * 
 *         while 1:             # <<<<<<<<<<<<<<
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1
 */
    while (1) {
      if (!1) break;

      /* "pandas/algos.pyx":806
 * 
 *         while 1:
 *             while a[i] < x: i += 1             # <<<<<<<<<<<<<<
 *             while x < a[j]: j -= 1
 *             if i <= j:
 */
      while (1) {
        __pyx_t_4 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_4 < 0) {
          __pyx_t_4 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_a.diminfo[0].strides)) < __pyx_v_x);
        if (!__pyx_t_2) break;
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/algos.pyx":807
 *         while 1:
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1             # <<<<<<<<<<<<<<
 *             if i <= j:
 *                 t = a[i]
 */
      while (1) {
        __pyx_t_5 = __pyx_v_j;
        __pyx_t_3 = -1;
        if (__pyx_t_5 < 0) {
          __pyx_t_5 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_5 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = (__pyx_v_x < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_a.diminfo[0].strides)));
        if (!__pyx_t_2) break;
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/algos.pyx":808
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1
 *             if i <= j:             # <<<<<<<<<<<<<<
 *                 t = a[i]
 *                 a[i] = a[j]
 */
      __pyx_t_2 = (__pyx_v_i <= __pyx_v_j);
      if (__pyx_t_2) {

        /* "pandas/algos.pyx":809
 *             while x < a[j]: j -= 1
 *             if i <= j:
 *                 t = a[i]             # <<<<<<<<<<<<<<
 *                 a[i] = a[j]
 *                 a[j] = t
 */
        __pyx_t_6 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_6 < 0) {
          __pyx_t_6 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_6 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_a.diminfo[0].strides));

        /* "pandas/algos.pyx":810
 *             if i <= j:
 *                 t = a[i]
 *                 a[i] = a[j]             # <<<<<<<<<<<<<<
 *                 a[j] = t
 *                 i += 1; j -= 1
 */
        __pyx_t_7 = __pyx_v_j;
        __pyx_t_3 = -1;
        if (__pyx_t_7 < 0) {
          __pyx_t_7 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_7 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_8 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_8 < 0) {
          __pyx_t_8 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_a.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_a.diminfo[0].strides));

        /* "pandas/algos.pyx":811
 *                 t = a[i]
 *                 a[i] = a[j]
 *                 a[j] = t             # <<<<<<<<<<<<<<
 *                 i += 1; j -= 1
 * 
 */
        __pyx_t_9 = __pyx_v_j;
        __pyx_t_3 = -1;
        if (__pyx_t_9 < 0) {
          __pyx_t_9 += __pyx_pybuffernd_a.diminfo[0].shape;
          if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_a.diminfo[0].strides) = __pyx_v_t;

        /* "pandas/algos.pyx":812
 *                 a[i] = a[j]
 *                 a[j] = t
 *                 i += 1; j -= 1             # <<<<<<<<<<<<<<
 * 
 *             if i > j: break
 */
        __pyx_v_i = (__pyx_v_i + 1);
        __pyx_v_j = (__pyx_v_j - 1);
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "pandas/algos.pyx":814
 *                 i += 1; j -= 1
 * 
 *             if i > j: break             # <<<<<<<<<<<<<<
 * 
 *         if j < k: l = i
 */
      __pyx_t_2 = (__pyx_v_i > __pyx_v_j);
      if (__pyx_t_2) {
        goto __pyx_L6_break;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __pyx_L6_break:;

    /* "pandas/algos.pyx":816
 *             if i > j: break
 * 
 *         if j < k: l = i             # <<<<<<<<<<<<<<
 *         if k < i: m = j
 *     return a[k]
 */
    __pyx_t_2 = (__pyx_v_j < __pyx_v_k);
    if (__pyx_t_2) {
      __pyx_v_l = __pyx_v_i;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "pandas/algos.pyx":817
 * 
 *         if j < k: l = i
 *         if k < i: m = j             # <<<<<<<<<<<<<<
 *     return a[k]
 * 
 */
    __pyx_t_2 = (__pyx_v_k < __pyx_v_i);
    if (__pyx_t_2) {
      __pyx_v_m = __pyx_v_j;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "pandas/algos.pyx":818
 *         if j < k: l = i
 *         if k < i: m = j
 *     return a[k]             # <<<<<<<<<<<<<<
 * 
 * cdef inline kth_smallest_c(float64_t* a, Py_ssize_t k, Py_ssize_t n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = __pyx_v_k;
  __pyx_t_3 = -1;
  if (__pyx_t_10 < 0) {
    __pyx_t_10 += __pyx_pybuffernd_a.diminfo[0].shape;
    if (unlikely(__pyx_t_10 < 0)) __pyx_t_3 = 0;
  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_a.diminfo[0].shape)) __pyx_t_3 = 0;
  if (unlikely(__pyx_t_3 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_3);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_a.diminfo[0].strides))); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.kth_smallest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":820
 *     return a[k]
 * 
 * cdef inline kth_smallest_c(float64_t* a, Py_ssize_t k, Py_ssize_t n):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i,j,l,m
 */

static CYTHON_INLINE PyObject *__pyx_f_6pandas_5algos_kth_smallest_c(__pyx_t_5numpy_float64_t *__pyx_v_a, Py_ssize_t __pyx_v_k, Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_l;
  Py_ssize_t __pyx_v_m;
  __pyx_t_5numpy_double_t __pyx_v_x;
  __pyx_t_5numpy_double_t __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("kth_smallest_c", 0);

  /* "pandas/algos.pyx":825
 *         double_t x, t
 * 
 *     l = 0             # <<<<<<<<<<<<<<
 *     m = n-1
 *     while (l<m):
 */
  __pyx_v_l = 0;

  /* "pandas/algos.pyx":826
 * 
 *     l = 0
 *     m = n-1             # <<<<<<<<<<<<<<
 *     while (l<m):
 *         x = a[k]
 */
  __pyx_v_m = (__pyx_v_n - 1);

  /* "pandas/algos.pyx":827
 *     l = 0
 *     m = n-1
 *     while (l<m):             # <<<<<<<<<<<<<<
 *         x = a[k]
 *         i = l
 */
  while (1) {
    __pyx_t_1 = (__pyx_v_l < __pyx_v_m);
    if (!__pyx_t_1) break;

    /* "pandas/algos.pyx":828
 *     m = n-1
 *     while (l<m):
 *         x = a[k]             # <<<<<<<<<<<<<<
 *         i = l
 *         j = m
 */
    __pyx_v_x = (__pyx_v_a[__pyx_v_k]);

    /* "pandas/algos.pyx":829
 *     while (l<m):
 *         x = a[k]
 *         i = l             # <<<<<<<<<<<<<<
 *         j = m
 * 
 */
    __pyx_v_i = __pyx_v_l;

    /* "pandas/algos.pyx":830
 *         x = a[k]
 *         i = l
 *         j = m             # <<<<<<<<<<<<<<
 * 
 *         while 1:
 */
    __pyx_v_j = __pyx_v_m;

    /* "pandas/algos.pyx":832
 *         j = m
 * 
 *         while 1:             # <<<<<<<<<<<<<<
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1
 */
    while (1) {
      if (!1) break;

      /* "pandas/algos.pyx":833
 * 
 *         while 1:
 *             while a[i] < x: i += 1             # <<<<<<<<<<<<<<
 *             while x < a[j]: j -= 1
 *             if i <= j:
 */
      while (1) {
        __pyx_t_1 = ((__pyx_v_a[__pyx_v_i]) < __pyx_v_x);
        if (!__pyx_t_1) break;
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/algos.pyx":834
 *         while 1:
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1             # <<<<<<<<<<<<<<
 *             if i <= j:
 *                 t = a[i]
 */
      while (1) {
        __pyx_t_1 = (__pyx_v_x < (__pyx_v_a[__pyx_v_j]));
        if (!__pyx_t_1) break;
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/algos.pyx":835
 *             while a[i] < x: i += 1
 *             while x < a[j]: j -= 1
 *             if i <= j:             # <<<<<<<<<<<<<<
 *                 t = a[i]
 *                 a[i] = a[j]
 */
      __pyx_t_1 = (__pyx_v_i <= __pyx_v_j);
      if (__pyx_t_1) {

        /* "pandas/algos.pyx":836
 *             while x < a[j]: j -= 1
 *             if i <= j:
 *                 t = a[i]             # <<<<<<<<<<<<<<
 *                 a[i] = a[j]
 *                 a[j] = t
 */
        __pyx_v_t = (__pyx_v_a[__pyx_v_i]);

        /* "pandas/algos.pyx":837
 *             if i <= j:
 *                 t = a[i]
 *                 a[i] = a[j]             # <<<<<<<<<<<<<<
 *                 a[j] = t
 *                 i += 1; j -= 1
 */
        (__pyx_v_a[__pyx_v_i]) = (__pyx_v_a[__pyx_v_j]);

        /* "pandas/algos.pyx":838
 *                 t = a[i]
 *                 a[i] = a[j]
 *                 a[j] = t             # <<<<<<<<<<<<<<
 *                 i += 1; j -= 1
 * 
 */
        (__pyx_v_a[__pyx_v_j]) = __pyx_v_t;

        /* "pandas/algos.pyx":839
 *                 a[i] = a[j]
 *                 a[j] = t
 *                 i += 1; j -= 1             # <<<<<<<<<<<<<<
 * 
 *             if i > j: break
 */
        __pyx_v_i = (__pyx_v_i + 1);
        __pyx_v_j = (__pyx_v_j - 1);
        goto __pyx_L11;
      }
      __pyx_L11:;

      /* "pandas/algos.pyx":841
 *                 i += 1; j -= 1
 * 
 *             if i > j: break             # <<<<<<<<<<<<<<
 * 
 *         if j < k: l = i
 */
      __pyx_t_1 = (__pyx_v_i > __pyx_v_j);
      if (__pyx_t_1) {
        goto __pyx_L6_break;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
    __pyx_L6_break:;

    /* "pandas/algos.pyx":843
 *             if i > j: break
 * 
 *         if j < k: l = i             # <<<<<<<<<<<<<<
 *         if k < i: m = j
 *     return a[k]
 */
    __pyx_t_1 = (__pyx_v_j < __pyx_v_k);
    if (__pyx_t_1) {
      __pyx_v_l = __pyx_v_i;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "pandas/algos.pyx":844
 * 
 *         if j < k: l = i
 *         if k < i: m = j             # <<<<<<<<<<<<<<
 *     return a[k]
 * 
 */
    __pyx_t_1 = (__pyx_v_k < __pyx_v_i);
    if (__pyx_t_1) {
      __pyx_v_m = __pyx_v_j;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }

  /* "pandas/algos.pyx":845
 *         if j < k: l = i
 *         if k < i: m = j
 *     return a[k]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_a[__pyx_v_k])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pandas.algos.kth_smallest_c", __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_6pandas_5algos_23median(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_22median[] = "\n    A faster median\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_23median = {__Pyx_NAMESTR("median"), (PyCFunction)__pyx_pw_6pandas_5algos_23median, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_22median)};
static PyObject *__pyx_pw_6pandas_5algos_23median(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("median (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_22median(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":848
 * 
 * 
 * def median(ndarray arr):             # <<<<<<<<<<<<<<
 *     '''
 *     A faster median
 */

static PyObject *__pyx_pf_6pandas_5algos_22median(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  int __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("median", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_arr);

  /* "pandas/algos.pyx":852
 *     A faster median
 *     '''
 *     cdef int n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if len(arr) == 0:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":854
 *     cdef int n = len(arr)
 * 
 *     if len(arr) == 0:             # <<<<<<<<<<<<<<
 *         return np.NaN
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":855
 * 
 *     if len(arr) == 0:
 *         return np.NaN             # <<<<<<<<<<<<<<
 * 
 *     arr = arr.copy()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__NaN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":857
 *         return np.NaN
 * 
 *     arr = arr.copy()             # <<<<<<<<<<<<<<
 * 
 *     if n % 2:
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_arr));
  __pyx_v_arr = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":859
 *     arr = arr.copy()
 * 
 *     if n % 2:             # <<<<<<<<<<<<<<
 *         return kth_smallest(arr, n / 2)
 *     else:
 */
  __pyx_t_5 = __Pyx_mod_long(__pyx_v_n, 2);
  if (__pyx_t_5) {

    /* "pandas/algos.pyx":860
 * 
 *     if n % 2:
 *         return kth_smallest(arr, n / 2)             # <<<<<<<<<<<<<<
 *     else:
 *         return (kth_smallest(arr, n / 2) +
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong(__Pyx_div_long(__pyx_v_n, 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_arr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":862
 *         return kth_smallest(arr, n / 2)
 *     else:
 *         return (kth_smallest(arr, n / 2) +             # <<<<<<<<<<<<<<
 *                 kth_smallest(arr, n / 2 - 1)) / 2
 * 
 */
    __Pyx_XDECREF(__pyx_r);

    /* "pandas/algos.pyx":863
 *     else:
 *         return (kth_smallest(arr, n / 2) +
 *                 kth_smallest(arr, n / 2 - 1)) / 2             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "pandas/algos.pyx":862
 *         return kth_smallest(arr, n / 2)
 *     else:
 *         return (kth_smallest(arr, n / 2) +             # <<<<<<<<<<<<<<
 *                 kth_smallest(arr, n / 2 - 1)) / 2
 * 
 */
    __pyx_t_6 = PyInt_FromLong(__Pyx_div_long(__pyx_v_n, 2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_arr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

    /* "pandas/algos.pyx":863
 *     else:
 *         return (kth_smallest(arr, n / 2) +
 *                 kth_smallest(arr, n / 2 - 1)) / 2             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__kth_smallest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyInt_FromLong((__Pyx_div_long(__pyx_v_n, 2) - 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_arr));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_arr));
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pandas.algos.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_25max_subseq(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_25max_subseq = {__Pyx_NAMESTR("max_subseq"), (PyCFunction)__pyx_pw_6pandas_5algos_25max_subseq, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_25max_subseq(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("max_subseq (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_24max_subseq(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":868
 * # -------------- Min, Max subsequence
 * 
 * def max_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i=0,s=0,e=0,T,n
 */

static PyObject *__pyx_pf_6pandas_5algos_24max_subseq(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_s;
  Py_ssize_t __pyx_v_e;
  Py_ssize_t __pyx_v_T;
  Py_ssize_t __pyx_v_n;
  double __pyx_v_m;
  double __pyx_v_S;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("max_subseq", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":870
 * def max_subseq(ndarray[double_t] arr):
 *     cdef:
 *         Py_ssize_t i=0,s=0,e=0,T,n             # <<<<<<<<<<<<<<
 *         double m, S
 * 
 */
  __pyx_v_i = 0;
  __pyx_v_s = 0;
  __pyx_v_e = 0;

  /* "pandas/algos.pyx":873
 *         double m, S
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if len(arr) == 0:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":875
 *     n = len(arr)
 * 
 *     if len(arr) == 0:             # <<<<<<<<<<<<<<
 *         return (-1,-1,None)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 == 0);
  if (__pyx_t_2) {

    /* "pandas/algos.pyx":876
 * 
 *     if len(arr) == 0:
 *         return (-1,-1,None)             # <<<<<<<<<<<<<<
 * 
 *     m = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_k_tuple_38));
    __pyx_r = ((PyObject *)__pyx_k_tuple_38);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":878
 *         return (-1,-1,None)
 * 
 *     m = arr[0]             # <<<<<<<<<<<<<<
 *     S = m
 *     T = 0
 */
  __pyx_t_3 = 0;
  __pyx_t_4 = -1;
  if (__pyx_t_3 < 0) {
    __pyx_t_3 += __pyx_pybuffernd_arr.diminfo[0].shape;
    if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
  } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_4 = 0;
  if (unlikely(__pyx_t_4 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_arr.diminfo[0].strides));

  /* "pandas/algos.pyx":879
 * 
 *     m = arr[0]
 *     S = m             # <<<<<<<<<<<<<<
 *     T = 0
 * 
 */
  __pyx_v_S = __pyx_v_m;

  /* "pandas/algos.pyx":880
 *     m = arr[0]
 *     S = m
 *     T = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, n):
 */
  __pyx_v_T = 0;

  /* "pandas/algos.pyx":882
 *     T = 0
 * 
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         # S = max { S + A[i], A[i] )
 *         if (S > 0):
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/algos.pyx":884
 *     for i in range(1, n):
 *         # S = max { S + A[i], A[i] )
 *         if (S > 0):             # <<<<<<<<<<<<<<
 *             S = S + arr[i]
 *         else:
 */
    __pyx_t_2 = (__pyx_v_S > 0.0);
    if (__pyx_t_2) {

      /* "pandas/algos.pyx":885
 *         # S = max { S + A[i], A[i] )
 *         if (S > 0):
 *             S = S + arr[i]             # <<<<<<<<<<<<<<
 *         else:
 *             S = arr[i]
 */
      __pyx_t_6 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_6 < 0) {
        __pyx_t_6 += __pyx_pybuffernd_arr.diminfo[0].shape;
        if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_S = (__pyx_v_S + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides)));
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/algos.pyx":887
 *             S = S + arr[i]
 *         else:
 *             S = arr[i]             # <<<<<<<<<<<<<<
 *             T = i
 *         if S > m:
 */
      __pyx_t_7 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_7 < 0) {
        __pyx_t_7 += __pyx_pybuffernd_arr.diminfo[0].shape;
        if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_arr.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_S = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_arr.diminfo[0].strides));

      /* "pandas/algos.pyx":888
 *         else:
 *             S = arr[i]
 *             T = i             # <<<<<<<<<<<<<<
 *         if S > m:
 *             s = T
 */
      __pyx_v_T = __pyx_v_i;
    }
    __pyx_L6:;

    /* "pandas/algos.pyx":889
 *             S = arr[i]
 *             T = i
 *         if S > m:             # <<<<<<<<<<<<<<
 *             s = T
 *             e = i
 */
    __pyx_t_2 = (__pyx_v_S > __pyx_v_m);
    if (__pyx_t_2) {

      /* "pandas/algos.pyx":890
 *             T = i
 *         if S > m:
 *             s = T             # <<<<<<<<<<<<<<
 *             e = i
 *             m = S
 */
      __pyx_v_s = __pyx_v_T;

      /* "pandas/algos.pyx":891
 *         if S > m:
 *             s = T
 *             e = i             # <<<<<<<<<<<<<<
 *             m = S
 * 
 */
      __pyx_v_e = __pyx_v_i;

      /* "pandas/algos.pyx":892
 *             s = T
 *             e = i
 *             m = S             # <<<<<<<<<<<<<<
 * 
 *     return (s, e, m)
 */
      __pyx_v_m = __pyx_v_S;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "pandas/algos.pyx":894
 *             m = S
 * 
 *     return (s, e, m)             # <<<<<<<<<<<<<<
 * 
 * def min_subseq(ndarray[double_t] arr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_s); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_e); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_m); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_r = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.max_subseq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_27min_subseq(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_27min_subseq = {__Pyx_NAMESTR("min_subseq"), (PyCFunction)__pyx_pw_6pandas_5algos_27min_subseq, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_27min_subseq(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("min_subseq (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_26min_subseq(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":896
 *     return (s, e, m)
 * 
 * def min_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t s, e
 */

static PyObject *__pyx_pf_6pandas_5algos_26min_subseq(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_s;
  Py_ssize_t __pyx_v_e;
  double __pyx_v_m;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("min_subseq", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":901
 *         double m
 * 
 *     (s, e, m) = max_subseq(-arr)             # <<<<<<<<<<<<<<
 * 
 *     return (s, e, -m)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__max_subseq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Negative(((PyObject *)__pyx_v_arr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_s = __pyx_t_7;
  __pyx_v_e = __pyx_t_8;
  __pyx_v_m = __pyx_t_9;

  /* "pandas/algos.pyx":903
 *     (s, e, m) = max_subseq(-arr)
 * 
 *     return (s, e, -m)             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_e); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_m)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.min_subseq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_29roll_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_29roll_sum = {__Pyx_NAMESTR("roll_sum"), (PyCFunction)__pyx_pw_6pandas_5algos_29roll_sum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_29roll_sum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_sum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_sum", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_sum", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_sum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_sum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_28roll_sum(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":908
 * # Rolling sum
 * 
 * def roll_sum(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 */

static PyObject *__pyx_pf_6pandas_5algos_28roll_sum(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_sum_x;
  int __pyx_v_nobs;
  int __pyx_v_i;
  int __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_sum", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":909
 * 
 * def roll_sum(ndarray[double_t] input, int win, int minp):
 *     cdef double val, prev, sum_x = 0             # <<<<<<<<<<<<<<
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)
 */
  __pyx_v_sum_x = 0.0;

  /* "pandas/algos.pyx":910
 * def roll_sum(ndarray[double_t] input, int win, int minp):
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef int N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":911
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 *     cdef int N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":913
 *     cdef int N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, N)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":915
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":917
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":918
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_8 < 0) {
      __pyx_t_8 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":921
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_11 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_11) {

      /* "pandas/algos.pyx":922
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":923
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":925
 *             sum_x += val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_12 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_12 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_12 = 0;
    if (unlikely(__pyx_t_12 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_12);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":927
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":928
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_14 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_14 = 0;
    if (unlikely(__pyx_t_14 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_14);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":930
 *         val = input[i]
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_11 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_11) {

      /* "pandas/algos.pyx":931
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":932
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":934
 *             sum_x += val
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_11 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_11) {

      /* "pandas/algos.pyx":935
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_15 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":936
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 nobs -= 1
 */
      __pyx_t_11 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_11) {

        /* "pandas/algos.pyx":937
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev);

        /* "pandas/algos.pyx":938
 *             if prev == prev:
 *                 sum_x -= prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":940
 *                 nobs -= 1
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = sum_x
 *         else:
 */
    __pyx_t_11 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_11) {

      /* "pandas/algos.pyx":941
 * 
 *         if nobs >= minp:
 *             output[i] = sum_x             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_16 = 0;
      if (unlikely(__pyx_t_16 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_16);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_sum_x;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":943
 *             output[i] = sum_x
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_17 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_17 = 0;
      if (unlikely(__pyx_t_17 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_17);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;
  }

  /* "pandas/algos.pyx":945
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_31roll_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_31roll_mean = {__Pyx_NAMESTR("roll_mean"), (PyCFunction)__pyx_pw_6pandas_5algos_31roll_mean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_31roll_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_mean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_mean", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_mean", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_mean") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_mean", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_30roll_mean(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":950
 * # Rolling mean
 * 
 * def roll_mean(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_30roll_mean(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_result;
  double __pyx_v_sum_x;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_neg_ct;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_mean", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":953
 *                int win, int minp):
 *     cdef:
 *         double val, prev, result, sum_x = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t nobs = 0, i, neg_ct = 0
 *         Py_ssize_t N = len(input)
 */
  __pyx_v_sum_x = 0.0;

  /* "pandas/algos.pyx":954
 *     cdef:
 *         double val, prev, result, sum_x = 0
 *         Py_ssize_t nobs = 0, i, neg_ct = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t N = len(input)
 * 
 */
  __pyx_v_nobs = 0;
  __pyx_v_neg_ct = 0;

  /* "pandas/algos.pyx":955
 *         double val, prev, result, sum_x = 0
 *         Py_ssize_t nobs = 0, i, neg_ct = 0
 *         Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":957
 *         Py_ssize_t N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 *     minp = _check_minp(win, minp, N)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":958
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":960
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":961
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":964
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":965
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             if signbit(val):
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":966
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             if signbit(val):
 *                 neg_ct += 1
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);

      /* "pandas/algos.pyx":967
 *             nobs += 1
 *             sum_x += val
 *             if signbit(val):             # <<<<<<<<<<<<<<
 *                 neg_ct += 1
 * 
 */
      __pyx_t_8 = signbit(__pyx_v_val);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":968
 *             sum_x += val
 *             if signbit(val):
 *                 neg_ct += 1             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
        __pyx_v_neg_ct = (__pyx_v_neg_ct + 1);
        goto __pyx_L6;
      }
      __pyx_L6:;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":970
 *                 neg_ct += 1
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":972
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":973
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":975
 *         val = input[i]
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":976
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             if signbit(val):
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":977
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             if signbit(val):
 *                 neg_ct += 1
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);

      /* "pandas/algos.pyx":978
 *             nobs += 1
 *             sum_x += val
 *             if signbit(val):             # <<<<<<<<<<<<<<
 *                 neg_ct += 1
 * 
 */
      __pyx_t_8 = signbit(__pyx_v_val);
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":979
 *             sum_x += val
 *             if signbit(val):
 *                 neg_ct += 1             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
        __pyx_v_neg_ct = (__pyx_v_neg_ct + 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":981
 *                 neg_ct += 1
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":982
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":983
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 nobs -= 1
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":984
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 *                 if signbit(prev):
 */
        __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev);

        /* "pandas/algos.pyx":985
 *             if prev == prev:
 *                 sum_x -= prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 *                 if signbit(prev):
 *                     neg_ct -= 1
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);

        /* "pandas/algos.pyx":986
 *                 sum_x -= prev
 *                 nobs -= 1
 *                 if signbit(prev):             # <<<<<<<<<<<<<<
 *                     neg_ct -= 1
 * 
 */
        __pyx_t_8 = signbit(__pyx_v_prev);
        if (__pyx_t_8) {

          /* "pandas/algos.pyx":987
 *                 nobs -= 1
 *                 if signbit(prev):
 *                     neg_ct -= 1             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
          __pyx_v_neg_ct = (__pyx_v_neg_ct - 1);
          goto __pyx_L13;
        }
        __pyx_L13:;
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/algos.pyx":989
 *                     neg_ct -= 1
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             result = sum_x / nobs
 *             if neg_ct == 0 and result < 0:
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":990
 * 
 *         if nobs >= minp:
 *             result = sum_x / nobs             # <<<<<<<<<<<<<<
 *             if neg_ct == 0 and result < 0:
 *                 # all positive
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_result = (__pyx_v_sum_x / __pyx_v_nobs);

      /* "pandas/algos.pyx":991
 *         if nobs >= minp:
 *             result = sum_x / nobs
 *             if neg_ct == 0 and result < 0:             # <<<<<<<<<<<<<<
 *                 # all positive
 *                 output[i] = 0
 */
      __pyx_t_10 = (__pyx_v_neg_ct == 0);
      if (__pyx_t_10) {
        __pyx_t_15 = (__pyx_v_result < 0.0);
        __pyx_t_16 = __pyx_t_15;
      } else {
        __pyx_t_16 = __pyx_t_10;
      }
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":993
 *             if neg_ct == 0 and result < 0:
 *                 # all positive
 *                 output[i] = 0             # <<<<<<<<<<<<<<
 *             elif neg_ct == nobs and result > 0:
 *                 # all negative
 */
        __pyx_t_17 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_17 < 0) {
          __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = 0.0;
        goto __pyx_L15;
      }

      /* "pandas/algos.pyx":994
 *                 # all positive
 *                 output[i] = 0
 *             elif neg_ct == nobs and result > 0:             # <<<<<<<<<<<<<<
 *                 # all negative
 *                 output[i] = 0
 */
      __pyx_t_16 = (__pyx_v_neg_ct == __pyx_v_nobs);
      if (__pyx_t_16) {
        __pyx_t_10 = (__pyx_v_result > 0.0);
        __pyx_t_15 = __pyx_t_10;
      } else {
        __pyx_t_15 = __pyx_t_16;
      }
      if (__pyx_t_15) {

        /* "pandas/algos.pyx":996
 *             elif neg_ct == nobs and result > 0:
 *                 # all negative
 *                 output[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 output[i] = result
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_18 < 0) {
          __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = 0.0;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/algos.pyx":998
 *                 output[i] = 0
 *             else:
 *                 output[i] = result             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_19 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_result;
      }
      __pyx_L15:;
      goto __pyx_L14;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1000
 *                 output[i] = result
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L14:;
  }

  /* "pandas/algos.pyx":1002
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_33ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_32ewma[] = "\n    Compute exponentially-weighted moving average using center-of-mass.\n\n    Parameters\n    ----------\n    input : ndarray (float64 type)\n    com : float64\n\n    Returns\n    -------\n    y : ndarray\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_33ewma = {__Pyx_NAMESTR("ewma"), (PyCFunction)__pyx_pw_6pandas_5algos_33ewma, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_32ewma)};
static PyObject *__pyx_pw_6pandas_5algos_33ewma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  __pyx_t_5numpy_double_t __pyx_v_com;
  int __pyx_v_adjust;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ewma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__com,&__pyx_n_s__adjust,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__com)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ewma", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__adjust)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ewma", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ewma") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_com = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_com == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_adjust = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_adjust == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ewma", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.ewma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_32ewma(__pyx_self, __pyx_v_input, __pyx_v_com, __pyx_v_adjust);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1007
 * # Exponentially weighted moving average
 * 
 * def ewma(ndarray[double_t] input, double_t com, int adjust):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute exponentially-weighted moving average using center-of-mass.
 */

static PyObject *__pyx_pf_6pandas_5algos_32ewma(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, __pyx_t_5numpy_double_t __pyx_v_com, int __pyx_v_adjust) {
  double __pyx_v_cur;
  double __pyx_v_prev;
  double __pyx_v_neww;
  double __pyx_v_oldw;
  double __pyx_v_adj;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __pyx_t_5numpy_double_t __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  long __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  double __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ewma", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1023
 *     cdef double cur, prev, neww, oldw, adj
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1025
 *     cdef Py_ssize_t N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     if N == 0:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1027
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     if N == 0:             # <<<<<<<<<<<<<<
 *         return output
 * 
 */
  __pyx_t_7 = (__pyx_v_N == 0);
  if (__pyx_t_7) {

    /* "pandas/algos.pyx":1028
 * 
 *     if N == 0:
 *         return output             # <<<<<<<<<<<<<<
 * 
 *     neww = 1. / (1. + com)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_output));
    __pyx_r = ((PyObject *)__pyx_v_output);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":1030
 *         return output
 * 
 *     neww = 1. / (1. + com)             # <<<<<<<<<<<<<<
 *     oldw = 1. - neww
 *     adj = oldw
 */
  __pyx_t_8 = (1. + __pyx_v_com);
  if (unlikely(__pyx_t_8 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_neww = (1. / __pyx_t_8);

  /* "pandas/algos.pyx":1031
 * 
 *     neww = 1. / (1. + com)
 *     oldw = 1. - neww             # <<<<<<<<<<<<<<
 *     adj = oldw
 * 
 */
  __pyx_v_oldw = (1. - __pyx_v_neww);

  /* "pandas/algos.pyx":1032
 *     neww = 1. / (1. + com)
 *     oldw = 1. - neww
 *     adj = oldw             # <<<<<<<<<<<<<<
 * 
 *     if adjust:
 */
  __pyx_v_adj = __pyx_v_oldw;

  /* "pandas/algos.pyx":1034
 *     adj = oldw
 * 
 *     if adjust:             # <<<<<<<<<<<<<<
 *         output[0] = neww * input[0]
 *     else:
 */
  if (__pyx_v_adjust) {

    /* "pandas/algos.pyx":1035
 * 
 *     if adjust:
 *         output[0] = neww * input[0]             # <<<<<<<<<<<<<<
 *     else:
 *         output[0] = input[0]
 */
    __pyx_t_9 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_9 < 0) {
      __pyx_t_9 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_11 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = (__pyx_v_neww * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_input.diminfo[0].strides)));
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1037
 *         output[0] = neww * input[0]
 *     else:
 *         output[0] = input[0]             # <<<<<<<<<<<<<<
 * 
 *     for i from 1 <= i < N:
 */
    __pyx_t_12 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_12 < 0) {
      __pyx_t_12 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_13 = 0;
    __pyx_t_10 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_output.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_input.diminfo[0].strides));
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":1039
 *         output[0] = input[0]
 * 
 *     for i from 1 <= i < N:             # <<<<<<<<<<<<<<
 *         cur = input[i]
 *         prev = output[i - 1]
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1040
 * 
 *     for i from 1 <= i < N:
 *         cur = input[i]             # <<<<<<<<<<<<<<
 *         prev = output[i - 1]
 * 
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_10 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1041
 *     for i from 1 <= i < N:
 *         cur = input[i]
 *         prev = output[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         if cur == cur:
 */
    __pyx_t_15 = (__pyx_v_i - 1);
    __pyx_t_10 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
    if (unlikely(__pyx_t_10 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_10);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides));

    /* "pandas/algos.pyx":1043
 *         prev = output[i - 1]
 * 
 *         if cur == cur:             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 output[i] = oldw * prev + neww * cur
 */
    __pyx_t_7 = (__pyx_v_cur == __pyx_v_cur);
    if (__pyx_t_7) {

      /* "pandas/algos.pyx":1044
 * 
 *         if cur == cur:
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 output[i] = oldw * prev + neww * cur
 *             else:
 */
      __pyx_t_7 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_7) {

        /* "pandas/algos.pyx":1045
 *         if cur == cur:
 *             if prev == prev:
 *                 output[i] = oldw * prev + neww * cur             # <<<<<<<<<<<<<<
 *             else:
 *                 output[i] = neww * cur
 */
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_10 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_16 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
        if (unlikely(__pyx_t_10 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_10);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_output.diminfo[0].strides) = ((__pyx_v_oldw * __pyx_v_prev) + (__pyx_v_neww * __pyx_v_cur));
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1047
 *                 output[i] = oldw * prev + neww * cur
 *             else:
 *                 output[i] = neww * cur             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = prev
 */
        __pyx_t_17 = __pyx_v_i;
        __pyx_t_10 = -1;
        if (__pyx_t_17 < 0) {
          __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
        } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
        if (unlikely(__pyx_t_10 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_10);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = (__pyx_v_neww * __pyx_v_cur);
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1049
 *                 output[i] = neww * cur
 *         else:
 *             output[i] = prev             # <<<<<<<<<<<<<<
 * 
 *     if adjust:
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_10 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_prev;
    }
    __pyx_L7:;
  }

  /* "pandas/algos.pyx":1051
 *             output[i] = prev
 * 
 *     if adjust:             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < N:
 *             cur = input[i]
 */
  if (__pyx_v_adjust) {

    /* "pandas/algos.pyx":1052
 * 
 *     if adjust:
 *         for i from 0 <= i < N:             # <<<<<<<<<<<<<<
 *             cur = input[i]
 * 
 */
    __pyx_t_1 = __pyx_v_N;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

      /* "pandas/algos.pyx":1053
 *     if adjust:
 *         for i from 0 <= i < N:
 *             cur = input[i]             # <<<<<<<<<<<<<<
 * 
 *             if cur == cur:
 */
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_10 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_10 = 0;
      if (unlikely(__pyx_t_10 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_10);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1055
 *             cur = input[i]
 * 
 *             if cur == cur:             # <<<<<<<<<<<<<<
 *                 output[i] = output[i] / (1. - adj)
 *                 adj *= oldw
 */
      __pyx_t_7 = (__pyx_v_cur == __pyx_v_cur);
      if (__pyx_t_7) {

        /* "pandas/algos.pyx":1056
 * 
 *             if cur == cur:
 *                 output[i] = output[i] / (1. - adj)             # <<<<<<<<<<<<<<
 *                 adj *= oldw
 *             else:
 */
        __pyx_t_20 = __pyx_v_i;
        __pyx_t_10 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_20 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_20 < 0)) __pyx_t_10 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
        if (unlikely(__pyx_t_10 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_10);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_output.diminfo[0].strides));
        __pyx_t_21 = (1. - __pyx_v_adj);
        if (unlikely(__pyx_t_21 == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_22 = __pyx_v_i;
        __pyx_t_10 = -1;
        if (__pyx_t_22 < 0) {
          __pyx_t_22 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_22 < 0)) __pyx_t_10 = 0;
        } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
        if (unlikely(__pyx_t_10 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_10);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_output.diminfo[0].strides) = (__pyx_t_8 / __pyx_t_21);

        /* "pandas/algos.pyx":1057
 *             if cur == cur:
 *                 output[i] = output[i] / (1. - adj)
 *                 adj *= oldw             # <<<<<<<<<<<<<<
 *             else:
 *                 if i >= 1:
 */
        __pyx_v_adj = (__pyx_v_adj * __pyx_v_oldw);
        goto __pyx_L12;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1059
 *                 adj *= oldw
 *             else:
 *                 if i >= 1:             # <<<<<<<<<<<<<<
 *                     output[i] = output[i - 1]
 * 
 */
        __pyx_t_7 = (__pyx_v_i >= 1);
        if (__pyx_t_7) {

          /* "pandas/algos.pyx":1060
 *             else:
 *                 if i >= 1:
 *                     output[i] = output[i - 1]             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
          __pyx_t_23 = (__pyx_v_i - 1);
          __pyx_t_10 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_10 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
          if (unlikely(__pyx_t_10 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_10);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_24 = __pyx_v_i;
          __pyx_t_10 = -1;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_10 = 0;
          } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_10 = 0;
          if (unlikely(__pyx_t_10 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_10);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_output.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_output.diminfo[0].strides));
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
      __pyx_L12:;
    }
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "pandas/algos.pyx":1062
 *                     output[i] = output[i - 1]
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #----------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.ewma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_35nancorr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_35nancorr = {__Pyx_NAMESTR("nancorr"), (PyCFunction)__pyx_pw_6pandas_5algos_35nancorr, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_35nancorr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_cov = 0;
  PyObject *__pyx_v_minp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nancorr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mat,&__pyx_n_s__cov,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    values[1] = __pyx_k_39;

    /* "pandas/algos.pyx":1069
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def nancorr(ndarray[float64_t, ndim=2] mat, cov=False, minp=None):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, xi, yi, N, K
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mat)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cov);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nancorr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mat = ((PyArrayObject *)values[0]);
    __pyx_v_cov = values[1];
    __pyx_v_minp = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nancorr", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.nancorr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_5numpy_ndarray, 1, "mat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_34nancorr(__pyx_self, __pyx_v_mat, __pyx_v_cov, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6pandas_5algos_34nancorr(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mat, PyObject *__pyx_v_cov, PyObject *__pyx_v_minp) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_xi;
  Py_ssize_t __pyx_v_yi;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyArrayObject *__pyx_v_result = 0;
  PyArrayObject *__pyx_v_mask = 0;
  __pyx_t_5numpy_int64_t __pyx_v_nobs;
  __pyx_t_5numpy_float64_t __pyx_v_vx;
  __pyx_t_5numpy_float64_t __pyx_v_vy;
  __pyx_t_5numpy_float64_t __pyx_v_sumx;
  __pyx_t_5numpy_float64_t __pyx_v_sumy;
  __pyx_t_5numpy_float64_t __pyx_v_sumxx;
  __pyx_t_5numpy_float64_t __pyx_v_sumyy;
  __pyx_t_5numpy_float64_t __pyx_v_meanx;
  __pyx_t_5numpy_float64_t __pyx_v_meany;
  __pyx_t_5numpy_float64_t __pyx_v_divisor;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mat;
  __Pyx_Buffer __pyx_pybuffer_mat;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  __pyx_t_5numpy_uint8_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_uint8_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __pyx_t_5numpy_float64_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  double __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("nancorr", 0);
  __Pyx_INCREF(__pyx_v_minp);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  __pyx_pybuffer_mat.pybuffer.buf = NULL;
  __pyx_pybuffer_mat.refcount = 0;
  __pyx_pybuffernd_mat.data = NULL;
  __pyx_pybuffernd_mat.rcbuffer = &__pyx_pybuffer_mat;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mat.rcbuffer->pybuffer, (PyObject*)__pyx_v_mat, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mat.diminfo[0].strides = __pyx_pybuffernd_mat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mat.diminfo[0].shape = __pyx_pybuffernd_mat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mat.diminfo[1].strides = __pyx_pybuffernd_mat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mat.diminfo[1].shape = __pyx_pybuffernd_mat.rcbuffer->pybuffer.shape[1];

  /* "pandas/algos.pyx":1074
 *         ndarray[float64_t, ndim=2] result
 *         ndarray[uint8_t, ndim=2] mask
 *         int64_t nobs = 0             # <<<<<<<<<<<<<<
 *         float64_t vx, vy, sumx, sumy, sumxx, sumyy, meanx, meany, divisor
 * 
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1077
 *         float64_t vx, vy, sumx, sumy, sumxx, sumyy, meanx, meany, divisor
 * 
 *     N, K = (<object> mat).shape             # <<<<<<<<<<<<<<
 * 
 *     if minp is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_mat), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_6;
  __pyx_v_K = __pyx_t_7;

  /* "pandas/algos.pyx":1079
 *     N, K = (<object> mat).shape
 * 
 *     if minp is None:             # <<<<<<<<<<<<<<
 *         minp = 1
 * 
 */
  __pyx_t_8 = (__pyx_v_minp == Py_None);
  if (__pyx_t_8) {

    /* "pandas/algos.pyx":1080
 * 
 *     if minp is None:
 *         minp = 1             # <<<<<<<<<<<<<<
 * 
 *     result = np.empty((K, K), dtype=np.float64)
 */
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_DECREF(__pyx_v_minp);
    __pyx_v_minp = __pyx_int_1;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":1082
 *         minp = 1
 * 
 *     result = np.empty((K, K), dtype=np.float64)             # <<<<<<<<<<<<<<
 *     mask = np.isfinite(mat).view(np.uint8)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_K); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_K); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_11 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_result.diminfo[1].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_result.diminfo[1].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_10 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "pandas/algos.pyx":1083
 * 
 *     result = np.empty((K, K), dtype=np.float64)
 *     mask = np.isfinite(mat).view(np.uint8)             # <<<<<<<<<<<<<<
 * 
 *     for xi in range(K):
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__isfinite); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_mat));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_mat));
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__view); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__uint8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_11 < 0)) {
      PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      }
    }
    __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_mask = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":1085
 *     mask = np.isfinite(mat).view(np.uint8)
 * 
 *     for xi in range(K):             # <<<<<<<<<<<<<<
 *         for yi in range(xi + 1):
 *             nobs = sumxx = sumyy = sumx = sumy = 0
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_xi = __pyx_t_6;

    /* "pandas/algos.pyx":1086
 * 
 *     for xi in range(K):
 *         for yi in range(xi + 1):             # <<<<<<<<<<<<<<
 *             nobs = sumxx = sumyy = sumx = sumy = 0
 *             for i in range(N):
 */
    __pyx_t_16 = (__pyx_v_xi + 1);
    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
      __pyx_v_yi = __pyx_t_17;

      /* "pandas/algos.pyx":1087
 *     for xi in range(K):
 *         for yi in range(xi + 1):
 *             nobs = sumxx = sumyy = sumx = sumy = 0             # <<<<<<<<<<<<<<
 *             for i in range(N):
 *                 if mask[i, xi] and mask[i, yi]:
 */
      __pyx_v_nobs = 0;
      __pyx_v_sumxx = 0;
      __pyx_v_sumyy = 0;
      __pyx_v_sumx = 0;
      __pyx_v_sumy = 0;

      /* "pandas/algos.pyx":1088
 *         for yi in range(xi + 1):
 *             nobs = sumxx = sumyy = sumx = sumy = 0
 *             for i in range(N):             # <<<<<<<<<<<<<<
 *                 if mask[i, xi] and mask[i, yi]:
 *                     vx = mat[i, xi]
 */
      __pyx_t_18 = __pyx_v_N;
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
        __pyx_v_i = __pyx_t_19;

        /* "pandas/algos.pyx":1089
 *             nobs = sumxx = sumyy = sumx = sumy = 0
 *             for i in range(N):
 *                 if mask[i, xi] and mask[i, yi]:             # <<<<<<<<<<<<<<
 *                     vx = mat[i, xi]
 *                     vy = mat[i, yi]
 */
        __pyx_t_20 = __pyx_v_i;
        __pyx_t_21 = __pyx_v_xi;
        __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_mask.diminfo[1].strides));
        if (__pyx_t_22) {
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_yi;
          __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_mask.diminfo[1].strides));
          __pyx_t_8 = __pyx_t_25;
        } else {
          __pyx_t_8 = __pyx_t_22;
        }
        if (__pyx_t_8) {

          /* "pandas/algos.pyx":1090
 *             for i in range(N):
 *                 if mask[i, xi] and mask[i, yi]:
 *                     vx = mat[i, xi]             # <<<<<<<<<<<<<<
 *                     vy = mat[i, yi]
 *                     nobs += 1
 */
          __pyx_t_26 = __pyx_v_i;
          __pyx_t_27 = __pyx_v_xi;
          __pyx_v_vx = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mat.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_mat.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_mat.diminfo[1].strides));

          /* "pandas/algos.pyx":1091
 *                 if mask[i, xi] and mask[i, yi]:
 *                     vx = mat[i, xi]
 *                     vy = mat[i, yi]             # <<<<<<<<<<<<<<
 *                     nobs += 1
 *                     sumx += vx
 */
          __pyx_t_28 = __pyx_v_i;
          __pyx_t_29 = __pyx_v_yi;
          __pyx_v_vy = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mat.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_mat.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_mat.diminfo[1].strides));

          /* "pandas/algos.pyx":1092
 *                     vx = mat[i, xi]
 *                     vy = mat[i, yi]
 *                     nobs += 1             # <<<<<<<<<<<<<<
 *                     sumx += vx
 *                     sumy += vy
 */
          __pyx_v_nobs = (__pyx_v_nobs + 1);

          /* "pandas/algos.pyx":1093
 *                     vy = mat[i, yi]
 *                     nobs += 1
 *                     sumx += vx             # <<<<<<<<<<<<<<
 *                     sumy += vy
 * 
 */
          __pyx_v_sumx = (__pyx_v_sumx + __pyx_v_vx);

          /* "pandas/algos.pyx":1094
 *                     nobs += 1
 *                     sumx += vx
 *                     sumy += vy             # <<<<<<<<<<<<<<
 * 
 *             if nobs < minp:
 */
          __pyx_v_sumy = (__pyx_v_sumy + __pyx_v_vy);
          goto __pyx_L12;
        }
        __pyx_L12:;
      }

      /* "pandas/algos.pyx":1096
 *                     sumy += vy
 * 
 *             if nobs < minp:             # <<<<<<<<<<<<<<
 *                 result[xi, yi] = result[yi, xi] = np.NaN
 *             else:
 */
      __pyx_t_4 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_nobs); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_v_minp, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_8) {

        /* "pandas/algos.pyx":1097
 * 
 *             if nobs < minp:
 *                 result[xi, yi] = result[yi, xi] = np.NaN             # <<<<<<<<<<<<<<
 *             else:
 *                 meanx = sumx / nobs
 */
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NaN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_30 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_18 = __pyx_v_xi;
        __pyx_t_19 = __pyx_v_yi;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
        __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_30 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_31 = __pyx_v_yi;
        __pyx_t_32 = __pyx_v_xi;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1099
 *                 result[xi, yi] = result[yi, xi] = np.NaN
 *             else:
 *                 meanx = sumx / nobs             # <<<<<<<<<<<<<<
 *                 meany = sumy / nobs
 * 
 */
        if (unlikely(__pyx_v_nobs == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_meanx = (__pyx_v_sumx / __pyx_v_nobs);

        /* "pandas/algos.pyx":1100
 *             else:
 *                 meanx = sumx / nobs
 *                 meany = sumy / nobs             # <<<<<<<<<<<<<<
 * 
 *                 # now the cov numerator
 */
        if (unlikely(__pyx_v_nobs == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_meany = (__pyx_v_sumy / __pyx_v_nobs);

        /* "pandas/algos.pyx":1103
 * 
 *                 # now the cov numerator
 *                 sumx = 0             # <<<<<<<<<<<<<<
 * 
 *                 for i in range(N):
 */
        __pyx_v_sumx = 0.0;

        /* "pandas/algos.pyx":1105
 *                 sumx = 0
 * 
 *                 for i in range(N):             # <<<<<<<<<<<<<<
 *                     if mask[i, xi] and mask[i, yi]:
 *                         vx = mat[i, xi] - meanx
 */
        __pyx_t_33 = __pyx_v_N;
        for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) {
          __pyx_v_i = __pyx_t_34;

          /* "pandas/algos.pyx":1106
 * 
 *                 for i in range(N):
 *                     if mask[i, xi] and mask[i, yi]:             # <<<<<<<<<<<<<<
 *                         vx = mat[i, xi] - meanx
 *                         vy = mat[i, yi] - meany
 */
          __pyx_t_35 = __pyx_v_i;
          __pyx_t_36 = __pyx_v_xi;
          __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_mask.diminfo[1].strides));
          if (__pyx_t_22) {
            __pyx_t_37 = __pyx_v_i;
            __pyx_t_38 = __pyx_v_yi;
            __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_mask.diminfo[1].strides));
            __pyx_t_8 = __pyx_t_25;
          } else {
            __pyx_t_8 = __pyx_t_22;
          }
          if (__pyx_t_8) {

            /* "pandas/algos.pyx":1107
 *                 for i in range(N):
 *                     if mask[i, xi] and mask[i, yi]:
 *                         vx = mat[i, xi] - meanx             # <<<<<<<<<<<<<<
 *                         vy = mat[i, yi] - meany
 * 
 */
            __pyx_t_39 = __pyx_v_i;
            __pyx_t_40 = __pyx_v_xi;
            __pyx_v_vx = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mat.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_mat.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_mat.diminfo[1].strides)) - __pyx_v_meanx);

            /* "pandas/algos.pyx":1108
 *                     if mask[i, xi] and mask[i, yi]:
 *                         vx = mat[i, xi] - meanx
 *                         vy = mat[i, yi] - meany             # <<<<<<<<<<<<<<
 * 
 *                         sumx += vx * vy
 */
            __pyx_t_41 = __pyx_v_i;
            __pyx_t_42 = __pyx_v_yi;
            __pyx_v_vy = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mat.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_mat.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_mat.diminfo[1].strides)) - __pyx_v_meany);

            /* "pandas/algos.pyx":1110
 *                         vy = mat[i, yi] - meany
 * 
 *                         sumx += vx * vy             # <<<<<<<<<<<<<<
 *                         sumxx += vx * vx
 *                         sumyy += vy * vy
 */
            __pyx_v_sumx = (__pyx_v_sumx + (__pyx_v_vx * __pyx_v_vy));

            /* "pandas/algos.pyx":1111
 * 
 *                         sumx += vx * vy
 *                         sumxx += vx * vx             # <<<<<<<<<<<<<<
 *                         sumyy += vy * vy
 * 
 */
            __pyx_v_sumxx = (__pyx_v_sumxx + (__pyx_v_vx * __pyx_v_vx));

            /* "pandas/algos.pyx":1112
 *                         sumx += vx * vy
 *                         sumxx += vx * vx
 *                         sumyy += vy * vy             # <<<<<<<<<<<<<<
 * 
 *                 divisor = (nobs - 1.0) if cov else sqrt(sumxx * sumyy)
 */
            __pyx_v_sumyy = (__pyx_v_sumyy + (__pyx_v_vy * __pyx_v_vy));
            goto __pyx_L16;
          }
          __pyx_L16:;
        }

        /* "pandas/algos.pyx":1114
 *                         sumyy += vy * vy
 * 
 *                 divisor = (nobs - 1.0) if cov else sqrt(sumxx * sumyy)             # <<<<<<<<<<<<<<
 * 
 *                 if divisor != 0:
 */
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_cov); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_8) {
          __pyx_t_43 = (__pyx_v_nobs - 1.0);
        } else {
          __pyx_t_43 = sqrt((__pyx_v_sumxx * __pyx_v_sumyy));
        }
        __pyx_v_divisor = __pyx_t_43;

        /* "pandas/algos.pyx":1116
 *                 divisor = (nobs - 1.0) if cov else sqrt(sumxx * sumyy)
 * 
 *                 if divisor != 0:             # <<<<<<<<<<<<<<
 *                     result[xi, yi] = result[yi, xi] = sumx / divisor
 *                 else:
 */
        __pyx_t_8 = (__pyx_v_divisor != 0.0);
        if (__pyx_t_8) {

          /* "pandas/algos.pyx":1117
 * 
 *                 if divisor != 0:
 *                     result[xi, yi] = result[yi, xi] = sumx / divisor             # <<<<<<<<<<<<<<
 *                 else:
 *                     result[xi, yi] = result[yi, xi] = np.NaN
 */
          if (unlikely(__pyx_v_divisor == 0)) {
            PyErr_Format(PyExc_ZeroDivisionError, "float division");
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_30 = (__pyx_v_sumx / __pyx_v_divisor);
          __pyx_t_33 = __pyx_v_xi;
          __pyx_t_34 = __pyx_v_yi;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
          __pyx_t_44 = __pyx_v_yi;
          __pyx_t_45 = __pyx_v_xi;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
          goto __pyx_L17;
        }
        /*else*/ {

          /* "pandas/algos.pyx":1119
 *                     result[xi, yi] = result[yi, xi] = sumx / divisor
 *                 else:
 *                     result[xi, yi] = result[yi, xi] = np.NaN             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
          __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_30 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_46 = __pyx_v_xi;
          __pyx_t_47 = __pyx_v_yi;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
          __pyx_t_30 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_30 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_48 = __pyx_v_yi;
          __pyx_t_49 = __pyx_v_xi;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_result.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_result.diminfo[1].strides) = __pyx_t_30;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __pyx_L17:;
      }
      __pyx_L13:;
    }
  }

  /* "pandas/algos.pyx":1121
 *                     result[xi, yi] = result[yi, xi] = np.NaN
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * #----------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mat.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.nancorr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mat.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_minp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_37roll_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_37roll_var = {__Pyx_NAMESTR("roll_var"), (PyCFunction)__pyx_pw_6pandas_5algos_37roll_var, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_37roll_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  int __pyx_v_ddof;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_var (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,&__pyx_n_s__ddof,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_var", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_var", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ddof);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_var") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[3]) {
      __pyx_v_ddof = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_ddof == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_ddof = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_var", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_36roll_var(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_v_ddof);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1126
 * # Rolling variance
 * 
 * def roll_var(ndarray[double_t] input, int win, int minp, int ddof=1):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 *     cdef Py_ssize_t i
 */

static PyObject *__pyx_pf_6pandas_5algos_36roll_var(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, int __pyx_v_ddof) {
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_sum_x;
  double __pyx_v_sum_xx;
  double __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  double __pyx_t_16;
  double __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_var", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1127
 * 
 * def roll_var(ndarray[double_t] input, int win, int minp, int ddof=1):
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t N = len(input)
 */
  __pyx_v_sum_x = 0.0;
  __pyx_v_sum_xx = 0.0;
  __pyx_v_nobs = 0.0;

  /* "pandas/algos.pyx":1129
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1131
 *     cdef Py_ssize_t N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, N)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1133
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1135
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1136
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1139
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1140
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             sum_xx += val * val
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1.0);

      /* "pandas/algos.pyx":1141
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             sum_xx += val * val
 * 
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);

      /* "pandas/algos.pyx":1142
 *             nobs += 1
 *             sum_x += val
 *             sum_xx += val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_sum_xx = (__pyx_v_sum_xx + (__pyx_v_val * __pyx_v_val));
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1144
 *             sum_xx += val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1146
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1147
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1149
 *         val = input[i]
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             sum_x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1150
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             sum_x += val
 *             sum_xx += val * val
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1.0);

      /* "pandas/algos.pyx":1151
 *         if val == val:
 *             nobs += 1
 *             sum_x += val             # <<<<<<<<<<<<<<
 *             sum_xx += val * val
 * 
 */
      __pyx_v_sum_x = (__pyx_v_sum_x + __pyx_v_val);

      /* "pandas/algos.pyx":1152
 *             nobs += 1
 *             sum_x += val
 *             sum_xx += val * val             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
      __pyx_v_sum_xx = (__pyx_v_sum_xx + (__pyx_v_val * __pyx_v_val));
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1154
 *             sum_xx += val * val
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1155
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 sum_x -= prev
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1156
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1157
 *             prev = input[i - win]
 *             if prev == prev:
 *                 sum_x -= prev             # <<<<<<<<<<<<<<
 *                 sum_xx -= prev * prev
 *                 nobs -= 1
 */
        __pyx_v_sum_x = (__pyx_v_sum_x - __pyx_v_prev);

        /* "pandas/algos.pyx":1158
 *             if prev == prev:
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_v_sum_xx = (__pyx_v_sum_xx - (__pyx_v_prev * __pyx_v_prev));

        /* "pandas/algos.pyx":1159
 *                 sum_x -= prev
 *                 sum_xx -= prev * prev
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1.0);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1161
 *                 nobs -= 1
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             # pathological case
 *             if nobs == 1:
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1163
 *         if nobs >= minp:
 *             # pathological case
 *             if nobs == 1:             # <<<<<<<<<<<<<<
 *                 output[i] = 0
 *                 continue
 */
      __pyx_t_10 = (__pyx_v_nobs == 1.0);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1164
 *             # pathological case
 *             if nobs == 1:
 *                 output[i] = 0             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
        __pyx_t_15 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides) = 0.0;

        /* "pandas/algos.pyx":1165
 *             if nobs == 1:
 *                 output[i] = 0
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             val = (nobs * sum_xx - sum_x * sum_x) / (nobs * (nobs - ddof))
 */
        goto __pyx_L6_continue;
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "pandas/algos.pyx":1167
 *                 continue
 * 
 *             val = (nobs * sum_xx - sum_x * sum_x) / (nobs * (nobs - ddof))             # <<<<<<<<<<<<<<
 *             if val < 0:
 *                 val = 0
 */
      __pyx_t_16 = ((__pyx_v_nobs * __pyx_v_sum_xx) - (__pyx_v_sum_x * __pyx_v_sum_x));
      __pyx_t_17 = (__pyx_v_nobs * (__pyx_v_nobs - __pyx_v_ddof));
      if (unlikely(__pyx_t_17 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val = (__pyx_t_16 / __pyx_t_17);

      /* "pandas/algos.pyx":1168
 * 
 *             val = (nobs * sum_xx - sum_x * sum_x) / (nobs * (nobs - ddof))
 *             if val < 0:             # <<<<<<<<<<<<<<
 *                 val = 0
 * 
 */
      __pyx_t_10 = (__pyx_v_val < 0.0);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1169
 *             val = (nobs * sum_xx - sum_x * sum_x) / (nobs * (nobs - ddof))
 *             if val < 0:
 *                 val = 0             # <<<<<<<<<<<<<<
 * 
 *             output[i] = val
 */
        __pyx_v_val = 0.0;
        goto __pyx_L13;
      }
      __pyx_L13:;

      /* "pandas/algos.pyx":1171
 *                 val = 0
 * 
 *             output[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1173
 *             output[i] = val
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;
    __pyx_L6_continue:;
  }

  /* "pandas/algos.pyx":1175
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_39roll_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_39roll_skew = {__Pyx_NAMESTR("roll_skew"), (PyCFunction)__pyx_pw_6pandas_5algos_39roll_skew, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_39roll_skew(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_skew (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_skew", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_skew", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_skew") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_skew", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_skew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_38roll_skew(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1180
 * # Rolling skewness
 * 
 * def roll_skew(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_38roll_skew(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_x;
  double __pyx_v_xx;
  double __pyx_v_xxx;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  double __pyx_v_A;
  double __pyx_v_B;
  double __pyx_v_C;
  double __pyx_v_R;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_skew", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1182
 * def roll_skew(ndarray[double_t] input, int win, int minp):
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)
 */
  __pyx_v_x = 0.0;
  __pyx_v_xx = 0.0;
  __pyx_v_xxx = 0.0;

  /* "pandas/algos.pyx":1183
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0
 *     cdef Py_ssize_t nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1184
 *     cdef double x = 0, xx = 0, xxx = 0
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1186
 *     cdef Py_ssize_t N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     # 3 components of the skewness equation
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1191
 *     cdef double A, B, C, R
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1193
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1194
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1197
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1198
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1199
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x = (__pyx_v_x + __pyx_v_val);

      /* "pandas/algos.pyx":1200
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 * 
 */
      __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val));

      /* "pandas/algos.pyx":1201
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val));
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1203
 *             xxx += val * val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1205
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1206
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1208
 *         val = input[i]
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1209
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1210
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x = (__pyx_v_x + __pyx_v_val);

      /* "pandas/algos.pyx":1211
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 * 
 */
      __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val));

      /* "pandas/algos.pyx":1212
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
      __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val));
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1214
 *             xxx += val * val * val
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1215
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 x -= prev
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1216
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 x -= prev
 *                 xx -= prev * prev
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1217
 *             prev = input[i - win]
 *             if prev == prev:
 *                 x -= prev             # <<<<<<<<<<<<<<
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 */
        __pyx_v_x = (__pyx_v_x - __pyx_v_prev);

        /* "pandas/algos.pyx":1218
 *             if prev == prev:
 *                 x -= prev
 *                 xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 xxx -= prev * prev * prev
 * 
 */
        __pyx_v_xx = (__pyx_v_xx - (__pyx_v_prev * __pyx_v_prev));

        /* "pandas/algos.pyx":1219
 *                 x -= prev
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev             # <<<<<<<<<<<<<<
 * 
 *                 nobs -= 1
 */
        __pyx_v_xxx = (__pyx_v_xxx - ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev));

        /* "pandas/algos.pyx":1221
 *                 xxx -= prev * prev * prev
 * 
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1223
 *                 nobs -= 1
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             A = x / nobs
 *             B = xx / nobs - A * A
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1224
 * 
 *         if nobs >= minp:
 *             A = x / nobs             # <<<<<<<<<<<<<<
 *             B = xx / nobs - A * A
 *             C = xxx / nobs - A * A * A - 3 * A * B
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_A = (__pyx_v_x / __pyx_v_nobs);

      /* "pandas/algos.pyx":1225
 *         if nobs >= minp:
 *             A = x / nobs
 *             B = xx / nobs - A * A             # <<<<<<<<<<<<<<
 *             C = xxx / nobs - A * A * A - 3 * A * B
 * 
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - (__pyx_v_A * __pyx_v_A));

      /* "pandas/algos.pyx":1226
 *             A = x / nobs
 *             B = xx / nobs - A * A
 *             C = xxx / nobs - A * A * A - 3 * A * B             # <<<<<<<<<<<<<<
 * 
 *             R = sqrt(B)
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_C = (((__pyx_v_xxx / __pyx_v_nobs) - ((__pyx_v_A * __pyx_v_A) * __pyx_v_A)) - ((3.0 * __pyx_v_A) * __pyx_v_B));

      /* "pandas/algos.pyx":1228
 *             C = xxx / nobs - A * A * A - 3 * A * B
 * 
 *             R = sqrt(B)             # <<<<<<<<<<<<<<
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /
 */
      __pyx_v_R = sqrt(__pyx_v_B);

      /* "pandas/algos.pyx":1230
 *             R = sqrt(B)
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /             # <<<<<<<<<<<<<<
 *                          ((nobs-2) * R * R * R))
 *         else:
 */
      __pyx_t_15 = (sqrt((__pyx_v_nobs * (__pyx_v_nobs - 1.))) * __pyx_v_C);

      /* "pandas/algos.pyx":1231
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /
 *                          ((nobs-2) * R * R * R))             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_16 = ((((__pyx_v_nobs - 2) * __pyx_v_R) * __pyx_v_R) * __pyx_v_R);
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "pandas/algos.pyx":1230
 *             R = sqrt(B)
 * 
 *             output[i] = ((sqrt(nobs * (nobs - 1.)) * C) /             # <<<<<<<<<<<<<<
 *                          ((nobs-2) * R * R * R))
 *         else:
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = (__pyx_t_15 / __pyx_t_16);
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1233
 *                          ((nobs-2) * R * R * R))
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;
  }

  /* "pandas/algos.pyx":1235
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_skew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_41roll_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_41roll_kurt = {__Pyx_NAMESTR("roll_kurt"), (PyCFunction)__pyx_pw_6pandas_5algos_41roll_kurt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_41roll_kurt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_kurt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_kurt", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_kurt", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_kurt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_kurt", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_kurt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_40roll_kurt(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1241
 * 
 * 
 * def roll_kurt(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev
 */

static PyObject *__pyx_pf_6pandas_5algos_40roll_kurt(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  double __pyx_v_val;
  double __pyx_v_prev;
  double __pyx_v_x;
  double __pyx_v_xx;
  double __pyx_v_xxx;
  double __pyx_v_xxxx;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  double __pyx_v_A;
  double __pyx_v_B;
  double __pyx_v_C;
  double __pyx_v_D;
  double __pyx_v_R;
  double __pyx_v_K;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_kurt", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1244
 *                int win, int minp):
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)
 */
  __pyx_v_x = 0.0;
  __pyx_v_xx = 0.0;
  __pyx_v_xxx = 0.0;
  __pyx_v_xxxx = 0.0;

  /* "pandas/algos.pyx":1245
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0
 *     cdef Py_ssize_t nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t N = len(input)
 * 
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1246
 *     cdef double x = 0, xx = 0, xxx = 0, xxxx = 0
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1248
 *     cdef Py_ssize_t N = len(input)
 * 
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     # 5 components of the kurtosis equation
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1253
 *     cdef double A, B, C, D, R, K
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1255
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1256
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1259
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 * 
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1260
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 * 
 *             # seriously don't ask me why this is faster
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1263
 * 
 *             # seriously don't ask me why this is faster
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x = (__pyx_v_x + __pyx_v_val);

      /* "pandas/algos.pyx":1264
 *             # seriously don't ask me why this is faster
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 *             xxxx += val * val * val * val
 */
      __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val));

      /* "pandas/algos.pyx":1265
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 *             xxxx += val * val * val * val
 * 
 */
      __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val));

      /* "pandas/algos.pyx":1266
 *             xx += val * val
 *             xxx += val * val * val
 *             xxxx += val * val * val * val             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_v_xxxx = (__pyx_v_xxxx + (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val));
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1268
 *             xxxx += val * val * val * val
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1270
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1271
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1273
 *         val = input[i]
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             x += val
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1274
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             x += val
 *             xx += val * val
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1275
 *         if val == val:
 *             nobs += 1
 *             x += val             # <<<<<<<<<<<<<<
 *             xx += val * val
 *             xxx += val * val * val
 */
      __pyx_v_x = (__pyx_v_x + __pyx_v_val);

      /* "pandas/algos.pyx":1276
 *             nobs += 1
 *             x += val
 *             xx += val * val             # <<<<<<<<<<<<<<
 *             xxx += val * val * val
 *             xxxx += val * val * val * val
 */
      __pyx_v_xx = (__pyx_v_xx + (__pyx_v_val * __pyx_v_val));

      /* "pandas/algos.pyx":1277
 *             x += val
 *             xx += val * val
 *             xxx += val * val * val             # <<<<<<<<<<<<<<
 *             xxxx += val * val * val * val
 * 
 */
      __pyx_v_xxx = (__pyx_v_xxx + ((__pyx_v_val * __pyx_v_val) * __pyx_v_val));

      /* "pandas/algos.pyx":1278
 *             xx += val * val
 *             xxx += val * val * val
 *             xxxx += val * val * val * val             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
      __pyx_v_xxxx = (__pyx_v_xxxx + (((__pyx_v_val * __pyx_v_val) * __pyx_v_val) * __pyx_v_val));
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1280
 *             xxxx += val * val * val * val
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 *             if prev == prev:
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1281
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 *             if prev == prev:
 *                 x -= prev
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1282
 *         if i > win - 1:
 *             prev = input[i - win]
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 x -= prev
 *                 xx -= prev * prev
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1283
 *             prev = input[i - win]
 *             if prev == prev:
 *                 x -= prev             # <<<<<<<<<<<<<<
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 */
        __pyx_v_x = (__pyx_v_x - __pyx_v_prev);

        /* "pandas/algos.pyx":1284
 *             if prev == prev:
 *                 x -= prev
 *                 xx -= prev * prev             # <<<<<<<<<<<<<<
 *                 xxx -= prev * prev * prev
 *                 xxxx -= prev * prev * prev * prev
 */
        __pyx_v_xx = (__pyx_v_xx - (__pyx_v_prev * __pyx_v_prev));

        /* "pandas/algos.pyx":1285
 *                 x -= prev
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev             # <<<<<<<<<<<<<<
 *                 xxxx -= prev * prev * prev * prev
 * 
 */
        __pyx_v_xxx = (__pyx_v_xxx - ((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev));

        /* "pandas/algos.pyx":1286
 *                 xx -= prev * prev
 *                 xxx -= prev * prev * prev
 *                 xxxx -= prev * prev * prev * prev             # <<<<<<<<<<<<<<
 * 
 *                 nobs -= 1
 */
        __pyx_v_xxxx = (__pyx_v_xxxx - (((__pyx_v_prev * __pyx_v_prev) * __pyx_v_prev) * __pyx_v_prev));

        /* "pandas/algos.pyx":1288
 *                 xxxx -= prev * prev * prev * prev
 * 
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1290
 *                 nobs -= 1
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             A = x / nobs
 *             R = A * A
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1291
 * 
 *         if nobs >= minp:
 *             A = x / nobs             # <<<<<<<<<<<<<<
 *             R = A * A
 *             B = xx / nobs - R
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_A = (__pyx_v_x / __pyx_v_nobs);

      /* "pandas/algos.pyx":1292
 *         if nobs >= minp:
 *             A = x / nobs
 *             R = A * A             # <<<<<<<<<<<<<<
 *             B = xx / nobs - R
 *             R = R * A
 */
      __pyx_v_R = (__pyx_v_A * __pyx_v_A);

      /* "pandas/algos.pyx":1293
 *             A = x / nobs
 *             R = A * A
 *             B = xx / nobs - R             # <<<<<<<<<<<<<<
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_B = ((__pyx_v_xx / __pyx_v_nobs) - __pyx_v_R);

      /* "pandas/algos.pyx":1294
 *             R = A * A
 *             B = xx / nobs - R
 *             R = R * A             # <<<<<<<<<<<<<<
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A
 */
      __pyx_v_R = (__pyx_v_R * __pyx_v_A);

      /* "pandas/algos.pyx":1295
 *             B = xx / nobs - R
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B             # <<<<<<<<<<<<<<
 *             R = R * A
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_C = (((__pyx_v_xxx / __pyx_v_nobs) - __pyx_v_R) - ((3.0 * __pyx_v_A) * __pyx_v_B));

      /* "pandas/algos.pyx":1296
 *             R = R * A
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A             # <<<<<<<<<<<<<<
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 * 
 */
      __pyx_v_R = (__pyx_v_R * __pyx_v_A);

      /* "pandas/algos.pyx":1297
 *             C = xxx / nobs - R - 3 * A * B
 *             R = R * A
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A             # <<<<<<<<<<<<<<
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)
 */
      if (unlikely(__pyx_v_nobs == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_D = ((((__pyx_v_xxxx / __pyx_v_nobs) - __pyx_v_R) - (((6.0 * __pyx_v_B) * __pyx_v_A) * __pyx_v_A)) - ((4.0 * __pyx_v_C) * __pyx_v_A));

      /* "pandas/algos.pyx":1299
 *             D = xxxx / nobs - R - 6*B*A*A - 4*C*A
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)             # <<<<<<<<<<<<<<
 *             K = K / ((nobs - 2.)*(nobs-3.))
 * 
 */
      __pyx_t_15 = (((__pyx_v_nobs * __pyx_v_nobs) - 1.) * __pyx_v_D);
      __pyx_t_16 = (__pyx_v_B * __pyx_v_B);
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_K = ((__pyx_t_15 / __pyx_t_16) - (3.0 * pow((__pyx_v_nobs - 1.), 2.0)));

      /* "pandas/algos.pyx":1300
 * 
 *             K = (nobs * nobs - 1.)*D/(B*B) - 3*((nobs-1.)**2)
 *             K = K / ((nobs - 2.)*(nobs-3.))             # <<<<<<<<<<<<<<
 * 
 *             output[i] = K
 */
      __pyx_t_16 = ((__pyx_v_nobs - 2.) * (__pyx_v_nobs - 3.));
      if (unlikely(__pyx_t_16 == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_K = (__pyx_v_K / __pyx_t_16);

      /* "pandas/algos.pyx":1302
 *             K = K / ((nobs - 2.)*(nobs-3.))
 * 
 *             output[i] = K             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_K;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1304
 *             output[i] = K
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;
  }

  /* "pandas/algos.pyx":1306
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * #-------------------------------------------------------------------------------
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_kurt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1313
 * ctypedef double_t (* skiplist_f)(object sl, int n, int p)
 * 
 * cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op):             # <<<<<<<<<<<<<<
 *     cdef ndarray[double_t] input = arg
 *     cdef double val, prev, midpoint
 */

static PyObject *__pyx_f_6pandas_5algos__roll_skiplist_op(PyArrayObject *__pyx_v_arg, int __pyx_v_win, int __pyx_v_minp, __pyx_t_6pandas_5algos_skiplist_f __pyx_v_op) {
  PyArrayObject *__pyx_v_input = 0;
  double __pyx_v_val;
  double __pyx_v_prev;
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_skiplist = 0;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_roll_skiplist_op", 0);
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;

  /* "pandas/algos.pyx":1314
 * 
 * cdef _roll_skiplist_op(ndarray arg, int win, int minp, skiplist_f op):
 *     cdef ndarray[double_t] input = arg             # <<<<<<<<<<<<<<
 *     cdef double val, prev, midpoint
 *     cdef IndexableSkiplist skiplist
 */
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_arg), &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_input = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_input.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];
    }
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_arg));
  __pyx_v_input = ((PyArrayObject *)__pyx_v_arg);

  /* "pandas/algos.pyx":1317
 *     cdef double val, prev, midpoint
 *     cdef IndexableSkiplist skiplist
 *     cdef Py_ssize_t nobs = 0, i             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t N = len(input)
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1319
 *     cdef Py_ssize_t nobs = 0, i
 * 
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1320
 * 
 *     cdef Py_ssize_t N = len(input)
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     skiplist = IndexableSkiplist(win)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1322
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     skiplist = IndexableSkiplist(win)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, N)
 */
  __pyx_t_5 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_5algos_IndexableSkiplist)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_skiplist = ((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1324
 *     skiplist = IndexableSkiplist(win)
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1326
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1327
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1330
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1331
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1332
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1334
 *             skiplist.insert(val)
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1336
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1337
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1339
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 * 
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1340
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 * 
 *             if prev == prev:
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1342
 *             prev = input[i - win]
 * 
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 skiplist.remove(prev)
 *                 nobs -= 1
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1343
 * 
 *             if prev == prev:
 *                 skiplist.remove(prev)             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->remove(__pyx_v_skiplist, __pyx_v_prev, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pandas/algos.pyx":1344
 *             if prev == prev:
 *                 skiplist.remove(prev)
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1346
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1347
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1348
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         output[i] = op(skiplist, nobs, minp)
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/algos.pyx":1350
 *             skiplist.insert(val)
 * 
 *         output[i] = op(skiplist, nobs, minp)             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_op(((PyObject *)__pyx_v_skiplist), __pyx_v_nobs, __pyx_v_minp);
  }

  /* "pandas/algos.pyx":1352
 *         output[i] = op(skiplist, nobs, minp)
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * from skiplist cimport *
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos._roll_skiplist_op", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_input);
  __Pyx_XDECREF((PyObject *)__pyx_v_skiplist);
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_43roll_median_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_43roll_median_c = {__Pyx_NAMESTR("roll_median_c"), (PyCFunction)__pyx_pw_6pandas_5algos_43roll_median_c, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_43roll_median_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_arg = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_median_c (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arg,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_median_c", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_median_c", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_median_c") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __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_arg = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_median_c", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_median_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arg), __pyx_ptype_5numpy_ndarray, 1, "arg", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_42roll_median_c(__pyx_self, __pyx_v_arg, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1356
 * from skiplist cimport *
 * 
 * def roll_median_c(ndarray[float64_t] arg, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, res, prev
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_42roll_median_c(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arg, int __pyx_v_win, int __pyx_v_minp) {
  double __pyx_v_val;
  double __pyx_v_res;
  double __pyx_v_prev;
  int __pyx_v_ret;
  skiplist_t *__pyx_v_sl;
  Py_ssize_t __pyx_v_midpoint;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arg;
  __Pyx_Buffer __pyx_pybuffer_arg;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_median_c", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_arg.pybuffer.buf = NULL;
  __pyx_pybuffer_arg.refcount = 0;
  __pyx_pybuffernd_arg.data = NULL;
  __pyx_pybuffernd_arg.rcbuffer = &__pyx_pybuffer_arg;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arg.rcbuffer->pybuffer, (PyObject*)__pyx_v_arg, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arg.diminfo[0].strides = __pyx_pybuffernd_arg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arg.diminfo[0].shape = __pyx_pybuffernd_arg.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1359
 *     cdef double val, res, prev
 *     cdef:
 *         int ret=0             # <<<<<<<<<<<<<<
 *         skiplist_t *sl
 *         Py_ssize_t midpoint, nobs = 0, i
 */
  __pyx_v_ret = 0;

  /* "pandas/algos.pyx":1361
 *         int ret=0
 *         skiplist_t *sl
 *         Py_ssize_t midpoint, nobs = 0, i             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1364
 * 
 * 
 *     cdef Py_ssize_t N = len(arg)             # <<<<<<<<<<<<<<
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arg)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1365
 * 
 *     cdef Py_ssize_t N = len(arg)
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     sl = skiplist_init(win)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1367
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     sl = skiplist_init(win)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, N)
 */
  __pyx_v_sl = skiplist_init(__pyx_v_win);

  /* "pandas/algos.pyx":1369
 *     sl = skiplist_init(win)
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1371
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = arg[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1372
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = arg[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_arg.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_arg.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arg.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_arg.diminfo[0].strides));

    /* "pandas/algos.pyx":1375
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist_insert(sl, val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1376
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist_insert(sl, val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1377
 *         if val == val:
 *             nobs += 1
 *             skiplist_insert(sl, val)             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      skiplist_insert(__pyx_v_sl, __pyx_v_val);
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1379
 *             skiplist_insert(sl, val)
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1381
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = arg[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1382
 * 
 *     for i from minp - 1 <= i < N:
 *         val = arg[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_arg.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_arg.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arg.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_arg.diminfo[0].strides));

    /* "pandas/algos.pyx":1384
 *         val = arg[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = arg[i - win]
 * 
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1385
 * 
 *         if i > win - 1:
 *             prev = arg[i - win]             # <<<<<<<<<<<<<<
 * 
 *             if prev == prev:
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_arg.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_arg.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arg.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_arg.diminfo[0].strides));

      /* "pandas/algos.pyx":1387
 *             prev = arg[i - win]
 * 
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 skiplist_remove(sl, prev)
 *                 nobs -= 1
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1388
 * 
 *             if prev == prev:
 *                 skiplist_remove(sl, prev)             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        skiplist_remove(__pyx_v_sl, __pyx_v_prev);

        /* "pandas/algos.pyx":1389
 *             if prev == prev:
 *                 skiplist_remove(sl, prev)
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1391
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist_insert(sl, val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1392
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist_insert(sl, val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1393
 *         if val == val:
 *             nobs += 1
 *             skiplist_insert(sl, val)             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      skiplist_insert(__pyx_v_sl, __pyx_v_val);
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/algos.pyx":1395
 *             skiplist_insert(sl, val)
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             midpoint = nobs / 2
 *             if nobs % 2:
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1396
 * 
 *         if nobs >= minp:
 *             midpoint = nobs / 2             # <<<<<<<<<<<<<<
 *             if nobs % 2:
 *                 res = skiplist_get(sl, midpoint, &ret)
 */
      __pyx_v_midpoint = __Pyx_div_Py_ssize_t(__pyx_v_nobs, 2);

      /* "pandas/algos.pyx":1397
 *         if nobs >= minp:
 *             midpoint = nobs / 2
 *             if nobs % 2:             # <<<<<<<<<<<<<<
 *                 res = skiplist_get(sl, midpoint, &ret)
 *             else:
 */
      __pyx_t_15 = __Pyx_mod_Py_ssize_t(__pyx_v_nobs, 2);
      if (__pyx_t_15) {

        /* "pandas/algos.pyx":1398
 *             midpoint = nobs / 2
 *             if nobs % 2:
 *                 res = skiplist_get(sl, midpoint, &ret)             # <<<<<<<<<<<<<<
 *             else:
 *                 res = (skiplist_get(sl, midpoint, &ret) +
 */
        __pyx_v_res = skiplist_get(__pyx_v_sl, __pyx_v_midpoint, (&__pyx_v_ret));
        goto __pyx_L12;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1401
 *             else:
 *                 res = (skiplist_get(sl, midpoint, &ret) +
 *                        skiplist_get(sl, (midpoint - 1), &ret)) / 2             # <<<<<<<<<<<<<<
 *         else:
 *             res = NaN
 */
        __pyx_v_res = ((skiplist_get(__pyx_v_sl, __pyx_v_midpoint, (&__pyx_v_ret)) + skiplist_get(__pyx_v_sl, (__pyx_v_midpoint - 1), (&__pyx_v_ret))) / 2.0);
      }
      __pyx_L12:;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1403
 *                        skiplist_get(sl, (midpoint - 1), &ret)) / 2
 *         else:
 *             res = NaN             # <<<<<<<<<<<<<<
 * 
 *         output[i] = res
 */
      __pyx_v_res = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;

    /* "pandas/algos.pyx":1405
 *             res = NaN
 * 
 *         output[i] = res             # <<<<<<<<<<<<<<
 * 
 *     skiplist_destroy(sl)
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_15 < 0) {
      __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_res;
  }

  /* "pandas/algos.pyx":1407
 *         output[i] = res
 * 
 *     skiplist_destroy(sl)             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
  skiplist_destroy(__pyx_v_sl);

  /* "pandas/algos.pyx":1409
 *     skiplist_destroy(sl)
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * def roll_median_cython(ndarray input, int win, int minp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arg.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_median_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arg.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_45roll_median_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_44roll_median_cython[] = "\n    O(N log(window)) implementation using skip list\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_45roll_median_cython = {__Pyx_NAMESTR("roll_median_cython"), (PyCFunction)__pyx_pw_6pandas_5algos_45roll_median_cython, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_44roll_median_cython)};
static PyObject *__pyx_pw_6pandas_5algos_45roll_median_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_median_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_median_cython", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_median_cython", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_median_cython") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_median_cython", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_median_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_44roll_median_cython(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1411
 *     return output
 * 
 * def roll_median_cython(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */

static PyObject *__pyx_pf_6pandas_5algos_44roll_median_cython(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_median_cython", 0);

  /* "pandas/algos.pyx":1415
 *     O(N log(window)) implementation using skip list
 *     '''
 *     return _roll_skiplist_op(input, win, minp, _get_median)             # <<<<<<<<<<<<<<
 * 
 * # Unfortunately had to resort to some hackery here, would like for
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos__roll_skiplist_op(__pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_f_6pandas_5algos__get_median); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.roll_median_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1420
 * # Cython to be able to get this right.
 * 
 * cdef double_t _get_median(object sl, int nobs, int minp):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t midpoint
 *     cdef IndexableSkiplist skiplist = <IndexableSkiplist> sl
 */

static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_median(PyObject *__pyx_v_sl, int __pyx_v_nobs, int __pyx_v_minp) {
  Py_ssize_t __pyx_v_midpoint;
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_skiplist = 0;
  __pyx_t_5numpy_double_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __pyx_t_5numpy_double_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_median", 0);

  /* "pandas/algos.pyx":1422
 * cdef double_t _get_median(object sl, int nobs, int minp):
 *     cdef Py_ssize_t midpoint
 *     cdef IndexableSkiplist skiplist = <IndexableSkiplist> sl             # <<<<<<<<<<<<<<
 *     if nobs >= minp:
 *         midpoint = nobs / 2
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_sl)));
  __pyx_v_skiplist = ((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_v_sl);

  /* "pandas/algos.pyx":1423
 *     cdef Py_ssize_t midpoint
 *     cdef IndexableSkiplist skiplist = <IndexableSkiplist> sl
 *     if nobs >= minp:             # <<<<<<<<<<<<<<
 *         midpoint = nobs / 2
 *         if nobs % 2:
 */
  __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp);
  if (__pyx_t_1) {

    /* "pandas/algos.pyx":1424
 *     cdef IndexableSkiplist skiplist = <IndexableSkiplist> sl
 *     if nobs >= minp:
 *         midpoint = nobs / 2             # <<<<<<<<<<<<<<
 *         if nobs % 2:
 *             return skiplist.get(midpoint)
 */
    __pyx_v_midpoint = __Pyx_div_long(__pyx_v_nobs, 2);

    /* "pandas/algos.pyx":1425
 *     if nobs >= minp:
 *         midpoint = nobs / 2
 *         if nobs % 2:             # <<<<<<<<<<<<<<
 *             return skiplist.get(midpoint)
 *         else:
 */
    __pyx_t_2 = __Pyx_mod_long(__pyx_v_nobs, 2);
    if (__pyx_t_2) {

      /* "pandas/algos.pyx":1426
 *         midpoint = nobs / 2
 *         if nobs % 2:
 *             return skiplist.get(midpoint)             # <<<<<<<<<<<<<<
 *         else:
 *             return (skiplist.get(midpoint) +
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, __pyx_v_midpoint, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1428
 *             return skiplist.get(midpoint)
 *         else:
 *             return (skiplist.get(midpoint) +             # <<<<<<<<<<<<<<
 *                     skiplist.get(midpoint - 1)) / 2
 *     else:
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, __pyx_v_midpoint, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);

      /* "pandas/algos.pyx":1429
 *         else:
 *             return (skiplist.get(midpoint) +
 *                     skiplist.get(midpoint - 1)) / 2             # <<<<<<<<<<<<<<
 *     else:
 *         return NaN
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, (__pyx_v_midpoint - 1), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_4;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1431
 *                     skiplist.get(midpoint - 1)) / 2
 *     else:
 *         return NaN             # <<<<<<<<<<<<<<
 * 
 * #----------------------------------------------------------------------
 */
    __pyx_r = __pyx_v_6pandas_5algos_NaN;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("pandas.algos._get_median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_skiplist);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_47roll_max2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_46roll_max2[] = "Moving max of 1d array of dtype=float64 along axis=0 ignoring NaNs.";
static PyMethodDef __pyx_mdef_6pandas_5algos_47roll_max2 = {__Pyx_NAMESTR("roll_max2"), (PyCFunction)__pyx_pw_6pandas_5algos_47roll_max2, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_46roll_max2)};
static PyObject *__pyx_pw_6pandas_5algos_47roll_max2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_a = 0;
  int __pyx_v_window;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_max2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__window,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_max2", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_max2", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_max2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __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_a = ((PyArrayObject *)values[0]);
    __pyx_v_window = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_window == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_max2", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_max2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_46roll_max2(__pyx_self, __pyx_v_a, __pyx_v_window, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_max2(ndarray[float64_t] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving max of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */

static PyObject *__pyx_pf_6pandas_5algos_46roll_max2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, int __pyx_v_window, int __pyx_v_minp) {
  __pyx_t_5numpy_float64_t __pyx_v_ai;
  __pyx_t_5numpy_float64_t __pyx_v_aold;
  Py_ssize_t __pyx_v_count;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_ring;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_minpair;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_end;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_last;
  Py_ssize_t __pyx_v_i0;
  npy_intp *__pyx_v_dim;
  Py_ssize_t __pyx_v_n0;
  npy_intp *__pyx_v_dims;
  PyArrayObject *__pyx_v_y = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_a;
  __Pyx_Buffer __pyx_pybuffer_a;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  npy_intp __pyx_t_1[1];
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  double __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  long __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_max2", 0);
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_a.pybuffer.buf = NULL;
  __pyx_pybuffer_a.refcount = 0;
  __pyx_pybuffernd_a.data = NULL;
  __pyx_pybuffernd_a.rcbuffer = &__pyx_pybuffer_a;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a.rcbuffer->pybuffer, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_a.diminfo[0].strides = __pyx_pybuffernd_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a.diminfo[0].shape = __pyx_pybuffernd_a.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1457
 *     cdef Py_ssize_t i0
 *     cdef np.npy_intp *dim
 *     dim = PyArray_DIMS(a)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t n0 = dim[0]
 *     cdef np.npy_intp *dims = [n0]
 */
  __pyx_v_dim = PyArray_DIMS(((PyArrayObject *)__pyx_v_a));

  /* "pandas/algos.pyx":1458
 *     cdef np.npy_intp *dim
 *     dim = PyArray_DIMS(a)
 *     cdef Py_ssize_t n0 = dim[0]             # <<<<<<<<<<<<<<
 *     cdef np.npy_intp *dims = [n0]
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 */
  __pyx_v_n0 = (__pyx_v_dim[0]);

  /* "pandas/algos.pyx":1459
 *     dim = PyArray_DIMS(a)
 *     cdef Py_ssize_t n0 = dim[0]
 *     cdef np.npy_intp *dims = [n0]             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 * 		NPY_float64, 0)
 */
  __pyx_t_1[0] = __pyx_v_n0;
  __pyx_v_dims = __pyx_t_1;

  /* "pandas/algos.pyx":1461
 *     cdef np.npy_intp *dims = [n0]
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 * 		NPY_float64, 0)             # <<<<<<<<<<<<<<
 * 
 *     if window < 1:
 */
  __pyx_t_2 = PyArray_EMPTY(1, __pyx_v_dims, NPY_FLOAT64, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_y = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1463
 * 		NPY_float64, 0)
 * 
 *     if window < 1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid window size %d'
 *                          % (window))
 */
  __pyx_t_4 = (__pyx_v_window < 1);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1465
 *     if window < 1:
 *         raise ValueError('Invalid window size %d'
 *                          % (window))             # <<<<<<<<<<<<<<
 * 
 *     if minp > window:
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":1467
 *                          % (window))
 * 
 *     if minp > window:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid min_periods size %d greater than window %d'
 *                         % (minp, window))
 */
  __pyx_t_4 = (__pyx_v_minp > __pyx_v_window);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1469
 *     if minp > window:
 *         raise ValueError('Invalid min_periods size %d greater than window %d'
 *                         % (minp, window))             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(window, minp, n0)
 */
    __pyx_t_5 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_41), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":1471
 *                         % (minp, window))
 * 
 *     minp = _check_minp(window, minp, n0)             # <<<<<<<<<<<<<<
 * 
 *     window = min(window, n0)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_n0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_minp = __pyx_t_9;

  /* "pandas/algos.pyx":1473
 *     minp = _check_minp(window, minp, n0)
 * 
 *     window = min(window, n0)             # <<<<<<<<<<<<<<
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 */
  __pyx_t_10 = __pyx_v_n0;
  __pyx_t_9 = __pyx_v_window;
  if ((__pyx_t_10 < __pyx_t_9)) {
    __pyx_t_11 = __pyx_t_10;
  } else {
    __pyx_t_11 = __pyx_t_9;
  }
  __pyx_v_window = __pyx_t_11;

  /* "pandas/algos.pyx":1475
 *     window = min(window, n0)
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))             # <<<<<<<<<<<<<<
 *     end = ring + window
 *     last = ring
 */
  __pyx_v_ring = ((struct __pyx_t_6pandas_5algos_pairs *)malloc((__pyx_v_window * (sizeof(struct __pyx_t_6pandas_5algos_pairs)))));

  /* "pandas/algos.pyx":1476
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 *     end = ring + window             # <<<<<<<<<<<<<<
 *     last = ring
 * 
 */
  __pyx_v_end = (__pyx_v_ring + __pyx_v_window);

  /* "pandas/algos.pyx":1477
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 *     end = ring + window
 *     last = ring             # <<<<<<<<<<<<<<
 * 
 *     minpair = ring
 */
  __pyx_v_last = __pyx_v_ring;

  /* "pandas/algos.pyx":1479
 *     last = ring
 * 
 *     minpair = ring             # <<<<<<<<<<<<<<
 *     ai = a[0]
 *     if ai == ai:
 */
  __pyx_v_minpair = __pyx_v_ring;

  /* "pandas/algos.pyx":1480
 * 
 *     minpair = ring
 *     ai = a[0]             # <<<<<<<<<<<<<<
 *     if ai == ai:
 *         minpair.value = ai
 */
  __pyx_t_12 = 0;
  __pyx_v_ai = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_a.diminfo[0].strides));

  /* "pandas/algos.pyx":1481
 *     minpair = ring
 *     ai = a[0]
 *     if ai == ai:             # <<<<<<<<<<<<<<
 *         minpair.value = ai
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ai == __pyx_v_ai);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1482
 *     ai = a[0]
 *     if ai == ai:
 *         minpair.value = ai             # <<<<<<<<<<<<<<
 *     else:
 *         minpair.value = MINfloat64
 */
    __pyx_v_minpair->value = __pyx_v_ai;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1484
 *         minpair.value = ai
 *     else:
 *         minpair.value = MINfloat64             # <<<<<<<<<<<<<<
 *     minpair.death = window
 * 
 */
    __pyx_v_minpair->value = __pyx_v_6pandas_5algos_MINfloat64;
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":1485
 *     else:
 *         minpair.value = MINfloat64
 *     minpair.death = window             # <<<<<<<<<<<<<<
 * 
 *     count = 0
 */
  __pyx_v_minpair->death = __pyx_v_window;

  /* "pandas/algos.pyx":1487
 *     minpair.death = window
 * 
 *     count = 0             # <<<<<<<<<<<<<<
 *     for i0 in range(n0):
 *         ai = a[i0]
 */
  __pyx_v_count = 0;

  /* "pandas/algos.pyx":1488
 * 
 *     count = 0
 *     for i0 in range(n0):             # <<<<<<<<<<<<<<
 *         ai = a[i0]
 *         if ai == ai:
 */
  __pyx_t_11 = __pyx_v_n0;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10+=1) {
    __pyx_v_i0 = __pyx_t_10;

    /* "pandas/algos.pyx":1489
 *     count = 0
 *     for i0 in range(n0):
 *         ai = a[i0]             # <<<<<<<<<<<<<<
 *         if ai == ai:
 *             count += 1
 */
    __pyx_t_13 = __pyx_v_i0;
    __pyx_v_ai = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_a.diminfo[0].strides));

    /* "pandas/algos.pyx":1490
 *     for i0 in range(n0):
 *         ai = a[i0]
 *         if ai == ai:             # <<<<<<<<<<<<<<
 *             count += 1
 *         else:
 */
    __pyx_t_4 = (__pyx_v_ai == __pyx_v_ai);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1491
 *         ai = a[i0]
 *         if ai == ai:
 *             count += 1             # <<<<<<<<<<<<<<
 *         else:
 *             ai = MINfloat64
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1493
 *             count += 1
 *         else:
 *             ai = MINfloat64             # <<<<<<<<<<<<<<
 *         if i0 >= window:
 *             aold = a[i0 - window]
 */
      __pyx_v_ai = __pyx_v_6pandas_5algos_MINfloat64;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1494
 *         else:
 *             ai = MINfloat64
 *         if i0 >= window:             # <<<<<<<<<<<<<<
 *             aold = a[i0 - window]
 *             if aold == aold:
 */
    __pyx_t_4 = (__pyx_v_i0 >= __pyx_v_window);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1495
 *             ai = MINfloat64
 *         if i0 >= window:
 *             aold = a[i0 - window]             # <<<<<<<<<<<<<<
 *             if aold == aold:
 *                 count -= 1
 */
      __pyx_t_14 = (__pyx_v_i0 - __pyx_v_window);
      __pyx_v_aold = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_a.diminfo[0].strides));

      /* "pandas/algos.pyx":1496
 *         if i0 >= window:
 *             aold = a[i0 - window]
 *             if aold == aold:             # <<<<<<<<<<<<<<
 *                 count -= 1
 *         if minpair.death == i0:
 */
      __pyx_t_4 = (__pyx_v_aold == __pyx_v_aold);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1497
 *             aold = a[i0 - window]
 *             if aold == aold:
 *                 count -= 1             # <<<<<<<<<<<<<<
 *         if minpair.death == i0:
 *             minpair += 1
 */
        __pyx_v_count = (__pyx_v_count - 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1498
 *             if aold == aold:
 *                 count -= 1
 *         if minpair.death == i0:             # <<<<<<<<<<<<<<
 *             minpair += 1
 *             if minpair >= end:
 */
    __pyx_t_4 = (__pyx_v_minpair->death == __pyx_v_i0);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1499
 *                 count -= 1
 *         if minpair.death == i0:
 *             minpair += 1             # <<<<<<<<<<<<<<
 *             if minpair >= end:
 *                 minpair = ring
 */
      __pyx_v_minpair = (__pyx_v_minpair + 1);

      /* "pandas/algos.pyx":1500
 *         if minpair.death == i0:
 *             minpair += 1
 *             if minpair >= end:             # <<<<<<<<<<<<<<
 *                 minpair = ring
 *         if ai >= minpair.value:
 */
      __pyx_t_4 = (__pyx_v_minpair >= __pyx_v_end);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1501
 *             minpair += 1
 *             if minpair >= end:
 *                 minpair = ring             # <<<<<<<<<<<<<<
 *         if ai >= minpair.value:
 *             minpair.value = ai
 */
        __pyx_v_minpair = __pyx_v_ring;
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/algos.pyx":1502
 *             if minpair >= end:
 *                 minpair = ring
 *         if ai >= minpair.value:             # <<<<<<<<<<<<<<
 *             minpair.value = ai
 *             minpair.death = i0 + window
 */
    __pyx_t_4 = (__pyx_v_ai >= __pyx_v_minpair->value);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1503
 *                 minpair = ring
 *         if ai >= minpair.value:
 *             minpair.value = ai             # <<<<<<<<<<<<<<
 *             minpair.death = i0 + window
 *             last = minpair
 */
      __pyx_v_minpair->value = __pyx_v_ai;

      /* "pandas/algos.pyx":1504
 *         if ai >= minpair.value:
 *             minpair.value = ai
 *             minpair.death = i0 + window             # <<<<<<<<<<<<<<
 *             last = minpair
 *         else:
 */
      __pyx_v_minpair->death = (__pyx_v_i0 + __pyx_v_window);

      /* "pandas/algos.pyx":1505
 *             minpair.value = ai
 *             minpair.death = i0 + window
 *             last = minpair             # <<<<<<<<<<<<<<
 *         else:
 *             while last.value <= ai:
 */
      __pyx_v_last = __pyx_v_minpair;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1507
 *             last = minpair
 *         else:
 *             while last.value <= ai:             # <<<<<<<<<<<<<<
 *                 if last == ring:
 *                     last = end
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_last->value <= __pyx_v_ai);
        if (!__pyx_t_4) break;

        /* "pandas/algos.pyx":1508
 *         else:
 *             while last.value <= ai:
 *                 if last == ring:             # <<<<<<<<<<<<<<
 *                     last = end
 *                 last -= 1
 */
        __pyx_t_4 = (__pyx_v_last == __pyx_v_ring);
        if (__pyx_t_4) {

          /* "pandas/algos.pyx":1509
 *             while last.value <= ai:
 *                 if last == ring:
 *                     last = end             # <<<<<<<<<<<<<<
 *                 last -= 1
 *             last += 1
 */
          __pyx_v_last = __pyx_v_end;
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "pandas/algos.pyx":1510
 *                 if last == ring:
 *                     last = end
 *                 last -= 1             # <<<<<<<<<<<<<<
 *             last += 1
 *             if last == end:
 */
        __pyx_v_last = (__pyx_v_last - 1);
      }

      /* "pandas/algos.pyx":1511
 *                     last = end
 *                 last -= 1
 *             last += 1             # <<<<<<<<<<<<<<
 *             if last == end:
 *                 last = ring
 */
      __pyx_v_last = (__pyx_v_last + 1);

      /* "pandas/algos.pyx":1512
 *                 last -= 1
 *             last += 1
 *             if last == end:             # <<<<<<<<<<<<<<
 *                 last = ring
 *             last.value = ai
 */
      __pyx_t_4 = (__pyx_v_last == __pyx_v_end);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1513
 *             last += 1
 *             if last == end:
 *                 last = ring             # <<<<<<<<<<<<<<
 *             last.value = ai
 *             last.death = i0 + window
 */
        __pyx_v_last = __pyx_v_ring;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/algos.pyx":1514
 *             if last == end:
 *                 last = ring
 *             last.value = ai             # <<<<<<<<<<<<<<
 *             last.death = i0 + window
 *         if count >= minp:
 */
      __pyx_v_last->value = __pyx_v_ai;

      /* "pandas/algos.pyx":1515
 *                 last = ring
 *             last.value = ai
 *             last.death = i0 + window             # <<<<<<<<<<<<<<
 *         if count >= minp:
 *             y[i0] = minpair.value
 */
      __pyx_v_last->death = (__pyx_v_i0 + __pyx_v_window);
    }
    __pyx_L13:;

    /* "pandas/algos.pyx":1516
 *             last.value = ai
 *             last.death = i0 + window
 *         if count >= minp:             # <<<<<<<<<<<<<<
 *             y[i0] = minpair.value
 *         else:
 */
    __pyx_t_4 = (__pyx_v_count >= __pyx_v_minp);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1517
 *             last.death = i0 + window
 *         if count >= minp:
 *             y[i0] = minpair.value             # <<<<<<<<<<<<<<
 *         else:
 *             y[i0] = NaN
 */
      __pyx_t_15 = __pyx_v_minpair->value;
      __pyx_t_16 = __pyx_v_i0;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_t_15;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1519
 *             y[i0] = minpair.value
 *         else:
 *             y[i0] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i0 in range(minp - 1):
 */
      __pyx_t_17 = __pyx_v_i0;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L18:;
  }

  /* "pandas/algos.pyx":1521
 *             y[i0] = NaN
 * 
 *     for i0 in range(minp - 1):             # <<<<<<<<<<<<<<
 *         y[i0] = NaN
 * 
 */
  __pyx_t_18 = (__pyx_v_minp - 1);
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_18; __pyx_t_11+=1) {
    __pyx_v_i0 = __pyx_t_11;

    /* "pandas/algos.pyx":1522
 * 
 *     for i0 in range(minp - 1):
 *         y[i0] = NaN             # <<<<<<<<<<<<<<
 * 
 *     stdlib.free(ring)
 */
    __pyx_t_10 = __pyx_v_i0;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1524
 *         y[i0] = NaN
 * 
 *     stdlib.free(ring)             # <<<<<<<<<<<<<<
 *     return y
 * 
 */
  free(__pyx_v_ring);

  /* "pandas/algos.pyx":1525
 * 
 *     stdlib.free(ring)
 *     return y             # <<<<<<<<<<<<<<
 * 
 * def roll_max(ndarray input, int win, int minp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __pyx_r = ((PyObject *)__pyx_v_y);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_max2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_49roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_48roll_max[] = "\n    O(N log(window)) implementation using skip list\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_49roll_max = {__Pyx_NAMESTR("roll_max"), (PyCFunction)__pyx_pw_6pandas_5algos_49roll_max, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_48roll_max)};
static PyObject *__pyx_pw_6pandas_5algos_49roll_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_max (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_max", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_max", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_max") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_max", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_48roll_max(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1527
 *     return y
 * 
 * def roll_max(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */

static PyObject *__pyx_pf_6pandas_5algos_48roll_max(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_max", 0);

  /* "pandas/algos.pyx":1531
 *     O(N log(window)) implementation using skip list
 *     '''
 *     return _roll_skiplist_op(input, win, minp, _get_max)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos__roll_skiplist_op(__pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_f_6pandas_5algos__get_max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.roll_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1534
 * 
 * 
 * cdef double_t _get_max(object skiplist, int nobs, int minp):             # <<<<<<<<<<<<<<
 *     if nobs >= minp:
 *         return <IndexableSkiplist> skiplist.get(nobs - 1)
 */

static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_max(PyObject *__pyx_v_skiplist, int __pyx_v_nobs, int __pyx_v_minp) {
  __pyx_t_5numpy_double_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __pyx_t_5numpy_double_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_max", 0);

  /* "pandas/algos.pyx":1535
 * 
 * cdef double_t _get_max(object skiplist, int nobs, int minp):
 *     if nobs >= minp:             # <<<<<<<<<<<<<<
 *         return <IndexableSkiplist> skiplist.get(nobs - 1)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp);
  if (__pyx_t_1) {

    /* "pandas/algos.pyx":1536
 * cdef double_t _get_max(object skiplist, int nobs, int minp):
 *     if nobs >= minp:
 *         return <IndexableSkiplist> skiplist.get(nobs - 1)             # <<<<<<<<<<<<<<
 *     else:
 *         return NaN
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_skiplist, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_nobs - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_5;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1538
 *         return <IndexableSkiplist> skiplist.get(nobs - 1)
 *     else:
 *         return NaN             # <<<<<<<<<<<<<<
 * 
 * def roll_min(ndarray input, int win, int minp):
 */
    __pyx_r = __pyx_v_6pandas_5algos_NaN;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("pandas.algos._get_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_51roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_50roll_min[] = "\n    O(N log(window)) implementation using skip list\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_51roll_min = {__Pyx_NAMESTR("roll_min"), (PyCFunction)__pyx_pw_6pandas_5algos_51roll_min, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_50roll_min)};
static PyObject *__pyx_pw_6pandas_5algos_51roll_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_min (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_min", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_min", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_min") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __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_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_min", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_50roll_min(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1540
 *         return NaN
 * 
 * def roll_min(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */

static PyObject *__pyx_pf_6pandas_5algos_50roll_min(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_min", 0);

  /* "pandas/algos.pyx":1544
 *     O(N log(window)) implementation using skip list
 *     '''
 *     return _roll_skiplist_op(input, win, minp, _get_min)             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos__roll_skiplist_op(__pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_f_6pandas_5algos__get_min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.roll_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_53roll_min2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_52roll_min2[] = "Moving min of 1d array of dtype=float64 along axis=0 ignoring NaNs.";
static PyMethodDef __pyx_mdef_6pandas_5algos_53roll_min2 = {__Pyx_NAMESTR("roll_min2"), (PyCFunction)__pyx_pw_6pandas_5algos_53roll_min2, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_52roll_min2)};
static PyObject *__pyx_pw_6pandas_5algos_53roll_min2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_a = 0;
  int __pyx_v_window;
  int __pyx_v_minp;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_min2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__window,&__pyx_n_s__minp,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_min2", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_min2", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_min2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __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_a = ((PyArrayObject *)values[0]);
    __pyx_v_window = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_window == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_min2", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_min2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_52roll_min2(__pyx_self, __pyx_v_a, __pyx_v_window, __pyx_v_minp);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1548
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_min2(np.ndarray[np.float64_t, ndim=1] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving min of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */

static PyObject *__pyx_pf_6pandas_5algos_52roll_min2(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_a, int __pyx_v_window, int __pyx_v_minp) {
  __pyx_t_5numpy_float64_t __pyx_v_ai;
  __pyx_t_5numpy_float64_t __pyx_v_aold;
  Py_ssize_t __pyx_v_count;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_ring;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_minpair;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_end;
  struct __pyx_t_6pandas_5algos_pairs *__pyx_v_last;
  Py_ssize_t __pyx_v_i0;
  npy_intp *__pyx_v_dim;
  Py_ssize_t __pyx_v_n0;
  npy_intp *__pyx_v_dims;
  PyArrayObject *__pyx_v_y = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_a;
  __Pyx_Buffer __pyx_pybuffer_a;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_y;
  __Pyx_Buffer __pyx_pybuffer_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  npy_intp __pyx_t_1[1];
  PyObject *__pyx_t_2 = NULL;
  PyArrayObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  double __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  long __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_min2", 0);
  __pyx_pybuffer_y.pybuffer.buf = NULL;
  __pyx_pybuffer_y.refcount = 0;
  __pyx_pybuffernd_y.data = NULL;
  __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y;
  __pyx_pybuffer_a.pybuffer.buf = NULL;
  __pyx_pybuffer_a.refcount = 0;
  __pyx_pybuffernd_a.data = NULL;
  __pyx_pybuffernd_a.rcbuffer = &__pyx_pybuffer_a;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a.rcbuffer->pybuffer, (PyObject*)__pyx_v_a, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_a.diminfo[0].strides = __pyx_pybuffernd_a.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a.diminfo[0].shape = __pyx_pybuffernd_a.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1558
 *     cdef Py_ssize_t i0
 *     cdef np.npy_intp *dim
 *     dim = PyArray_DIMS(a)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t n0 = dim[0]
 *     cdef np.npy_intp *dims = [n0]
 */
  __pyx_v_dim = PyArray_DIMS(((PyArrayObject *)__pyx_v_a));

  /* "pandas/algos.pyx":1559
 *     cdef np.npy_intp *dim
 *     dim = PyArray_DIMS(a)
 *     cdef Py_ssize_t n0 = dim[0]             # <<<<<<<<<<<<<<
 *     cdef np.npy_intp *dims = [n0]
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 */
  __pyx_v_n0 = (__pyx_v_dim[0]);

  /* "pandas/algos.pyx":1560
 *     dim = PyArray_DIMS(a)
 *     cdef Py_ssize_t n0 = dim[0]
 *     cdef np.npy_intp *dims = [n0]             # <<<<<<<<<<<<<<
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 * 		NPY_float64, 0)
 */
  __pyx_t_1[0] = __pyx_v_n0;
  __pyx_v_dims = __pyx_t_1;

  /* "pandas/algos.pyx":1562
 *     cdef np.npy_intp *dims = [n0]
 *     cdef np.ndarray[np.float64_t, ndim=1] y = PyArray_EMPTY(1, dims,
 * 		NPY_float64, 0)             # <<<<<<<<<<<<<<
 * 
 *     if window < 1:
 */
  __pyx_t_2 = PyArray_EMPTY(1, __pyx_v_dims, NPY_FLOAT64, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_3 = 0;
  __pyx_v_y = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1564
 * 		NPY_float64, 0)
 * 
 *     if window < 1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid window size %d'
 *                          % (window))
 */
  __pyx_t_4 = (__pyx_v_window < 1);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1566
 *     if window < 1:
 *         raise ValueError('Invalid window size %d'
 *                          % (window))             # <<<<<<<<<<<<<<
 * 
 *     if minp > window:
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_40), __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":1568
 *                          % (window))
 * 
 *     if minp > window:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid min_periods size %d greater than window %d'
 *                         % (minp, window))
 */
  __pyx_t_4 = (__pyx_v_minp > __pyx_v_window);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1570
 *     if minp > window:
 *         raise ValueError('Invalid min_periods size %d greater than window %d'
 *                         % (minp, window))             # <<<<<<<<<<<<<<
 * 
 *     window = min(window, n0)
 */
    __pyx_t_5 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_41), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":1572
 *                         % (minp, window))
 * 
 *     window = min(window, n0)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(window, minp, n0)
 */
  __pyx_t_7 = __pyx_v_n0;
  __pyx_t_8 = __pyx_v_window;
  if ((__pyx_t_7 < __pyx_t_8)) {
    __pyx_t_9 = __pyx_t_7;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_v_window = __pyx_t_9;

  /* "pandas/algos.pyx":1574
 *     window = min(window, n0)
 * 
 *     minp = _check_minp(window, minp, n0)             # <<<<<<<<<<<<<<
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyInt_FromLong(__pyx_v_window); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_n0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1576
 *     minp = _check_minp(window, minp, n0)
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))             # <<<<<<<<<<<<<<
 *     end = ring + window
 *     last = ring
 */
  __pyx_v_ring = ((struct __pyx_t_6pandas_5algos_pairs *)malloc((__pyx_v_window * (sizeof(struct __pyx_t_6pandas_5algos_pairs)))));

  /* "pandas/algos.pyx":1577
 * 
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 *     end = ring + window             # <<<<<<<<<<<<<<
 *     last = ring
 * 
 */
  __pyx_v_end = (__pyx_v_ring + __pyx_v_window);

  /* "pandas/algos.pyx":1578
 *     ring = <pairs*>stdlib.malloc(window * sizeof(pairs))
 *     end = ring + window
 *     last = ring             # <<<<<<<<<<<<<<
 * 
 *     minpair = ring
 */
  __pyx_v_last = __pyx_v_ring;

  /* "pandas/algos.pyx":1580
 *     last = ring
 * 
 *     minpair = ring             # <<<<<<<<<<<<<<
 *     ai = a[0]
 *     if ai == ai:
 */
  __pyx_v_minpair = __pyx_v_ring;

  /* "pandas/algos.pyx":1581
 * 
 *     minpair = ring
 *     ai = a[0]             # <<<<<<<<<<<<<<
 *     if ai == ai:
 *         minpair.value = ai
 */
  __pyx_t_12 = 0;
  __pyx_v_ai = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_a.diminfo[0].strides));

  /* "pandas/algos.pyx":1582
 *     minpair = ring
 *     ai = a[0]
 *     if ai == ai:             # <<<<<<<<<<<<<<
 *         minpair.value = ai
 *     else:
 */
  __pyx_t_4 = (__pyx_v_ai == __pyx_v_ai);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1583
 *     ai = a[0]
 *     if ai == ai:
 *         minpair.value = ai             # <<<<<<<<<<<<<<
 *     else:
 *         minpair.value = MAXfloat64
 */
    __pyx_v_minpair->value = __pyx_v_ai;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1585
 *         minpair.value = ai
 *     else:
 *         minpair.value = MAXfloat64             # <<<<<<<<<<<<<<
 *     minpair.death = window
 * 
 */
    __pyx_v_minpair->value = __pyx_v_6pandas_5algos_MAXfloat64;
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":1586
 *     else:
 *         minpair.value = MAXfloat64
 *     minpair.death = window             # <<<<<<<<<<<<<<
 * 
 *     count = 0
 */
  __pyx_v_minpair->death = __pyx_v_window;

  /* "pandas/algos.pyx":1588
 *     minpair.death = window
 * 
 *     count = 0             # <<<<<<<<<<<<<<
 *     for i0 in range(n0):
 *         ai = a[i0]
 */
  __pyx_v_count = 0;

  /* "pandas/algos.pyx":1589
 * 
 *     count = 0
 *     for i0 in range(n0):             # <<<<<<<<<<<<<<
 *         ai = a[i0]
 *         if ai == ai:
 */
  __pyx_t_9 = __pyx_v_n0;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_9; __pyx_t_7+=1) {
    __pyx_v_i0 = __pyx_t_7;

    /* "pandas/algos.pyx":1590
 *     count = 0
 *     for i0 in range(n0):
 *         ai = a[i0]             # <<<<<<<<<<<<<<
 *         if ai == ai:
 *             count += 1
 */
    __pyx_t_13 = __pyx_v_i0;
    __pyx_v_ai = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_a.diminfo[0].strides));

    /* "pandas/algos.pyx":1591
 *     for i0 in range(n0):
 *         ai = a[i0]
 *         if ai == ai:             # <<<<<<<<<<<<<<
 *             count += 1
 *         else:
 */
    __pyx_t_4 = (__pyx_v_ai == __pyx_v_ai);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1592
 *         ai = a[i0]
 *         if ai == ai:
 *             count += 1             # <<<<<<<<<<<<<<
 *         else:
 *             ai = MAXfloat64
 */
      __pyx_v_count = (__pyx_v_count + 1);
      goto __pyx_L8;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1594
 *             count += 1
 *         else:
 *             ai = MAXfloat64             # <<<<<<<<<<<<<<
 *         if i0 >= window:
 *             aold = a[i0 - window]
 */
      __pyx_v_ai = __pyx_v_6pandas_5algos_MAXfloat64;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1595
 *         else:
 *             ai = MAXfloat64
 *         if i0 >= window:             # <<<<<<<<<<<<<<
 *             aold = a[i0 - window]
 *             if aold == aold:
 */
    __pyx_t_4 = (__pyx_v_i0 >= __pyx_v_window);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1596
 *             ai = MAXfloat64
 *         if i0 >= window:
 *             aold = a[i0 - window]             # <<<<<<<<<<<<<<
 *             if aold == aold:
 *                 count -= 1
 */
      __pyx_t_14 = (__pyx_v_i0 - __pyx_v_window);
      __pyx_v_aold = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_a.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_a.diminfo[0].strides));

      /* "pandas/algos.pyx":1597
 *         if i0 >= window:
 *             aold = a[i0 - window]
 *             if aold == aold:             # <<<<<<<<<<<<<<
 *                 count -= 1
 *         if minpair.death == i0:
 */
      __pyx_t_4 = (__pyx_v_aold == __pyx_v_aold);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1598
 *             aold = a[i0 - window]
 *             if aold == aold:
 *                 count -= 1             # <<<<<<<<<<<<<<
 *         if minpair.death == i0:
 *             minpair += 1
 */
        __pyx_v_count = (__pyx_v_count - 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1599
 *             if aold == aold:
 *                 count -= 1
 *         if minpair.death == i0:             # <<<<<<<<<<<<<<
 *             minpair += 1
 *             if minpair >= end:
 */
    __pyx_t_4 = (__pyx_v_minpair->death == __pyx_v_i0);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1600
 *                 count -= 1
 *         if minpair.death == i0:
 *             minpair += 1             # <<<<<<<<<<<<<<
 *             if minpair >= end:
 *                 minpair = ring
 */
      __pyx_v_minpair = (__pyx_v_minpair + 1);

      /* "pandas/algos.pyx":1601
 *         if minpair.death == i0:
 *             minpair += 1
 *             if minpair >= end:             # <<<<<<<<<<<<<<
 *                 minpair = ring
 *         if ai <= minpair.value:
 */
      __pyx_t_4 = (__pyx_v_minpair >= __pyx_v_end);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1602
 *             minpair += 1
 *             if minpair >= end:
 *                 minpair = ring             # <<<<<<<<<<<<<<
 *         if ai <= minpair.value:
 *             minpair.value = ai
 */
        __pyx_v_minpair = __pyx_v_ring;
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/algos.pyx":1603
 *             if minpair >= end:
 *                 minpair = ring
 *         if ai <= minpair.value:             # <<<<<<<<<<<<<<
 *             minpair.value = ai
 *             minpair.death = i0 + window
 */
    __pyx_t_4 = (__pyx_v_ai <= __pyx_v_minpair->value);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1604
 *                 minpair = ring
 *         if ai <= minpair.value:
 *             minpair.value = ai             # <<<<<<<<<<<<<<
 *             minpair.death = i0 + window
 *             last = minpair
 */
      __pyx_v_minpair->value = __pyx_v_ai;

      /* "pandas/algos.pyx":1605
 *         if ai <= minpair.value:
 *             minpair.value = ai
 *             minpair.death = i0 + window             # <<<<<<<<<<<<<<
 *             last = minpair
 *         else:
 */
      __pyx_v_minpair->death = (__pyx_v_i0 + __pyx_v_window);

      /* "pandas/algos.pyx":1606
 *             minpair.value = ai
 *             minpair.death = i0 + window
 *             last = minpair             # <<<<<<<<<<<<<<
 *         else:
 *             while last.value >= ai:
 */
      __pyx_v_last = __pyx_v_minpair;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1608
 *             last = minpair
 *         else:
 *             while last.value >= ai:             # <<<<<<<<<<<<<<
 *                 if last == ring:
 *                     last = end
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_last->value >= __pyx_v_ai);
        if (!__pyx_t_4) break;

        /* "pandas/algos.pyx":1609
 *         else:
 *             while last.value >= ai:
 *                 if last == ring:             # <<<<<<<<<<<<<<
 *                     last = end
 *                 last -= 1
 */
        __pyx_t_4 = (__pyx_v_last == __pyx_v_ring);
        if (__pyx_t_4) {

          /* "pandas/algos.pyx":1610
 *             while last.value >= ai:
 *                 if last == ring:
 *                     last = end             # <<<<<<<<<<<<<<
 *                 last -= 1
 *             last += 1
 */
          __pyx_v_last = __pyx_v_end;
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "pandas/algos.pyx":1611
 *                 if last == ring:
 *                     last = end
 *                 last -= 1             # <<<<<<<<<<<<<<
 *             last += 1
 *             if last == end:
 */
        __pyx_v_last = (__pyx_v_last - 1);
      }

      /* "pandas/algos.pyx":1612
 *                     last = end
 *                 last -= 1
 *             last += 1             # <<<<<<<<<<<<<<
 *             if last == end:
 *                 last = ring
 */
      __pyx_v_last = (__pyx_v_last + 1);

      /* "pandas/algos.pyx":1613
 *                 last -= 1
 *             last += 1
 *             if last == end:             # <<<<<<<<<<<<<<
 *                 last = ring
 *             last.value = ai
 */
      __pyx_t_4 = (__pyx_v_last == __pyx_v_end);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1614
 *             last += 1
 *             if last == end:
 *                 last = ring             # <<<<<<<<<<<<<<
 *             last.value = ai
 *             last.death = i0 + window
 */
        __pyx_v_last = __pyx_v_ring;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/algos.pyx":1615
 *             if last == end:
 *                 last = ring
 *             last.value = ai             # <<<<<<<<<<<<<<
 *             last.death = i0 + window
 *         if count >= minp:
 */
      __pyx_v_last->value = __pyx_v_ai;

      /* "pandas/algos.pyx":1616
 *                 last = ring
 *             last.value = ai
 *             last.death = i0 + window             # <<<<<<<<<<<<<<
 *         if count >= minp:
 *             y[i0] = minpair.value
 */
      __pyx_v_last->death = (__pyx_v_i0 + __pyx_v_window);
    }
    __pyx_L13:;

    /* "pandas/algos.pyx":1617
 *             last.value = ai
 *             last.death = i0 + window
 *         if count >= minp:             # <<<<<<<<<<<<<<
 *             y[i0] = minpair.value
 *         else:
 */
    __pyx_t_4 = (__pyx_v_count >= __pyx_v_minp);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1618
 *             last.death = i0 + window
 *         if count >= minp:
 *             y[i0] = minpair.value             # <<<<<<<<<<<<<<
 *         else:
 *             y[i0] = NaN
 */
      __pyx_t_15 = __pyx_v_minpair->value;
      __pyx_t_16 = __pyx_v_i0;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_t_15;
      goto __pyx_L18;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1620
 *             y[i0] = minpair.value
 *         else:
 *             y[i0] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i0 in range(minp - 1):
 */
      __pyx_t_17 = __pyx_v_i0;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L18:;
  }

  /* "pandas/algos.pyx":1622
 *             y[i0] = NaN
 * 
 *     for i0 in range(minp - 1):             # <<<<<<<<<<<<<<
 *         y[i0] = NaN
 * 
 */
  __pyx_t_18 = (__pyx_v_minp - 1);
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_18; __pyx_t_9+=1) {
    __pyx_v_i0 = __pyx_t_9;

    /* "pandas/algos.pyx":1623
 * 
 *     for i0 in range(minp - 1):
 *         y[i0] = NaN             # <<<<<<<<<<<<<<
 * 
 *     stdlib.free(ring)
 */
    __pyx_t_7 = __pyx_v_i0;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_y.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1625
 *         y[i0] = NaN
 * 
 *     stdlib.free(ring)             # <<<<<<<<<<<<<<
 *     return y
 * 
 */
  free(__pyx_v_ring);

  /* "pandas/algos.pyx":1626
 * 
 *     stdlib.free(ring)
 *     return y             # <<<<<<<<<<<<<<
 * 
 * cdef double_t _get_min(object skiplist, int nobs, int minp):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __pyx_r = ((PyObject *)__pyx_v_y);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_min2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1628
 *     return y
 * 
 * cdef double_t _get_min(object skiplist, int nobs, int minp):             # <<<<<<<<<<<<<<
 *     if nobs >= minp:
 *         return <IndexableSkiplist> skiplist.get(0)
 */

static __pyx_t_5numpy_double_t __pyx_f_6pandas_5algos__get_min(PyObject *__pyx_v_skiplist, int __pyx_v_nobs, int __pyx_v_minp) {
  __pyx_t_5numpy_double_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __pyx_t_5numpy_double_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_min", 0);

  /* "pandas/algos.pyx":1629
 * 
 * cdef double_t _get_min(object skiplist, int nobs, int minp):
 *     if nobs >= minp:             # <<<<<<<<<<<<<<
 *         return <IndexableSkiplist> skiplist.get(0)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_nobs >= __pyx_v_minp);
  if (__pyx_t_1) {

    /* "pandas/algos.pyx":1630
 * cdef double_t _get_min(object skiplist, int nobs, int minp):
 *     if nobs >= minp:
 *         return <IndexableSkiplist> skiplist.get(0)             # <<<<<<<<<<<<<<
 *     else:
 *         return NaN
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_skiplist, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1632
 *         return <IndexableSkiplist> skiplist.get(0)
 *     else:
 *         return NaN             # <<<<<<<<<<<<<<
 * 
 * def roll_quantile(ndarray[float64_t, cast=True] input, int win,
 */
    __pyx_r = __pyx_v_6pandas_5algos_NaN;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("pandas.algos._get_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_55roll_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_54roll_quantile[] = "\n    O(N log(window)) implementation using skip list\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_55roll_quantile = {__Pyx_NAMESTR("roll_quantile"), (PyCFunction)__pyx_pw_6pandas_5algos_55roll_quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_54roll_quantile)};
static PyObject *__pyx_pw_6pandas_5algos_55roll_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  double __pyx_v_quantile;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_quantile (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,&__pyx_n_s__quantile,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_quantile", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_quantile", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__quantile)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_quantile", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_quantile = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_quantile == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_quantile", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_quantile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_54roll_quantile(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_v_quantile);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1634
 *         return NaN
 * 
 * def roll_quantile(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                   int minp, double quantile):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_54roll_quantile(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, double __pyx_v_quantile) {
  double __pyx_v_val;
  double __pyx_v_prev;
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *__pyx_v_skiplist = 0;
  Py_ssize_t __pyx_v_nobs;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyArrayObject *__pyx_v_output = 0;
  PyObject *__pyx_v_idx = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  long __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_double_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_quantile", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1641
 *     cdef double val, prev, midpoint
 *     cdef IndexableSkiplist skiplist
 *     cdef Py_ssize_t nobs = 0, i             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t N = len(input)
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 */
  __pyx_v_nobs = 0;

  /* "pandas/algos.pyx":1642
 *     cdef IndexableSkiplist skiplist
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)             # <<<<<<<<<<<<<<
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/algos.pyx":1643
 *     cdef Py_ssize_t nobs = 0, i
 *     cdef Py_ssize_t N = len(input)
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     skiplist = IndexableSkiplist(win)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_output = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_output.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1645
 *     cdef ndarray[double_t] output = np.empty(N, dtype=float)
 * 
 *     skiplist = IndexableSkiplist(win)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, N)
 */
  __pyx_t_5 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_5algos_IndexableSkiplist)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_skiplist = ((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1647
 *     skiplist = IndexableSkiplist(win)
 * 
 *     minp = _check_minp(win, minp, N)             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < minp - 1:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_minp = __pyx_t_8;

  /* "pandas/algos.pyx":1649
 *     minp = _check_minp(win, minp, N)
 * 
 *     for i from 0 <= i < minp - 1:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_9 = (__pyx_v_minp - 1);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {

    /* "pandas/algos.pyx":1650
 * 
 *     for i from 0 <= i < minp - 1:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         # Not NaN
 */
    __pyx_t_1 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_1 < 0) {
      __pyx_t_1 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_1 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1653
 * 
 *         # Not NaN
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1654
 *         # Not NaN
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1655
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         output[i] = NaN
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1657
 *             skiplist.insert(val)
 * 
 *         output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from minp - 1 <= i < N:
 */
    __pyx_t_11 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_11 < 0) {
      __pyx_t_11 += __pyx_pybuffernd_output.diminfo[0].shape;
      if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
  }

  /* "pandas/algos.pyx":1659
 *         output[i] = NaN
 * 
 *     for i from minp - 1 <= i < N:             # <<<<<<<<<<<<<<
 *         val = input[i]
 * 
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_v_i = (__pyx_v_minp - 1); __pyx_v_i < __pyx_t_12; __pyx_v_i++) {

    /* "pandas/algos.pyx":1660
 * 
 *     for i from minp - 1 <= i < N:
 *         val = input[i]             # <<<<<<<<<<<<<<
 * 
 *         if i > win - 1:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_input.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_input.diminfo[0].strides));

    /* "pandas/algos.pyx":1662
 *         val = input[i]
 * 
 *         if i > win - 1:             # <<<<<<<<<<<<<<
 *             prev = input[i - win]
 * 
 */
    __pyx_t_10 = (__pyx_v_i > (__pyx_v_win - 1));
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1663
 * 
 *         if i > win - 1:
 *             prev = input[i - win]             # <<<<<<<<<<<<<<
 * 
 *             if prev == prev:
 */
      __pyx_t_14 = (__pyx_v_i - __pyx_v_win);
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_input.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_input.diminfo[0].strides));

      /* "pandas/algos.pyx":1665
 *             prev = input[i - win]
 * 
 *             if prev == prev:             # <<<<<<<<<<<<<<
 *                 skiplist.remove(prev)
 *                 nobs -= 1
 */
      __pyx_t_10 = (__pyx_v_prev == __pyx_v_prev);
      if (__pyx_t_10) {

        /* "pandas/algos.pyx":1666
 * 
 *             if prev == prev:
 *                 skiplist.remove(prev)             # <<<<<<<<<<<<<<
 *                 nobs -= 1
 * 
 */
        __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->remove(__pyx_v_skiplist, __pyx_v_prev, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "pandas/algos.pyx":1667
 *             if prev == prev:
 *                 skiplist.remove(prev)
 *                 nobs -= 1             # <<<<<<<<<<<<<<
 * 
 *         if val == val:
 */
        __pyx_v_nobs = (__pyx_v_nobs - 1);
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "pandas/algos.pyx":1669
 *                 nobs -= 1
 * 
 *         if val == val:             # <<<<<<<<<<<<<<
 *             nobs += 1
 *             skiplist.insert(val)
 */
    __pyx_t_10 = (__pyx_v_val == __pyx_v_val);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1670
 * 
 *         if val == val:
 *             nobs += 1             # <<<<<<<<<<<<<<
 *             skiplist.insert(val)
 * 
 */
      __pyx_v_nobs = (__pyx_v_nobs + 1);

      /* "pandas/algos.pyx":1671
 *         if val == val:
 *             nobs += 1
 *             skiplist.insert(val)             # <<<<<<<<<<<<<<
 * 
 *         if nobs >= minp:
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->insert(__pyx_v_skiplist, __pyx_v_val, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/algos.pyx":1673
 *             skiplist.insert(val)
 * 
 *         if nobs >= minp:             # <<<<<<<<<<<<<<
 *             idx = int((quantile / 1.) * (nobs - 1))
 *             output[i] = skiplist.get(idx)
 */
    __pyx_t_10 = (__pyx_v_nobs >= __pyx_v_minp);
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1674
 * 
 *         if nobs >= minp:
 *             idx = int((quantile / 1.) * (nobs - 1))             # <<<<<<<<<<<<<<
 *             output[i] = skiplist.get(idx)
 *         else:
 */
      __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_quantile / 1.) * (__pyx_v_nobs - 1))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_v_idx);
      __pyx_v_idx = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pandas/algos.pyx":1675
 *         if nobs >= minp:
 *             idx = int((quantile / 1.) * (nobs - 1))
 *             output[i] = skiplist.get(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = ((struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist *)__pyx_v_skiplist->__pyx_vtab)->get(__pyx_v_skiplist, __pyx_t_15, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_t_16;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1677
 *             output[i] = skiplist.get(idx)
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L11:;
  }

  /* "pandas/algos.pyx":1679
 *             output[i] = NaN
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * def roll_generic(ndarray[float64_t, cast=True] input, int win,
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_quantile", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_skiplist);
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_57roll_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_57roll_generic = {__Pyx_NAMESTR("roll_generic"), (PyCFunction)__pyx_pw_6pandas_5algos_57roll_generic, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_57roll_generic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  int __pyx_v_win;
  int __pyx_v_minp;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_generic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__win,&__pyx_n_s__minp,&__pyx_n_s__func,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__win)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_generic", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_generic", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_generic", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_generic") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_input = ((PyArrayObject *)values[0]);
    __pyx_v_win = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_win == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_func = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_generic", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_56roll_generic(__pyx_self, __pyx_v_input, __pyx_v_win, __pyx_v_minp, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1681
 *     return output
 * 
 * def roll_generic(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                  int minp, object func):
 *     cdef ndarray[double_t] output, counts, bufarr
 */

static PyObject *__pyx_pf_6pandas_5algos_56roll_generic(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, int __pyx_v_win, int __pyx_v_minp, PyObject *__pyx_v_func) {
  PyArrayObject *__pyx_v_output = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_bufarr = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_float64_t *__pyx_v_buf;
  __pyx_t_5numpy_float64_t *__pyx_v_oldbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bufarr;
  __Pyx_Buffer __pyx_pybuffer_bufarr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyArrayObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  __pyx_t_5numpy_double_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_generic", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_input);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_bufarr.pybuffer.buf = NULL;
  __pyx_pybuffer_bufarr.refcount = 0;
  __pyx_pybuffernd_bufarr.data = NULL;
  __pyx_pybuffernd_bufarr.rcbuffer = &__pyx_pybuffer_bufarr;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1687
 *     cdef float64_t *buf, *oldbuf
 * 
 *     if not input.flags.c_contiguous:             # <<<<<<<<<<<<<<
 *         input = input.copy('C')
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__c_contiguous); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1688
 * 
 *     if not input.flags.c_contiguous:
 *         input = input.copy('C')             # <<<<<<<<<<<<<<
 * 
 *     buf = <float64_t*> input.data
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_input), __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
      __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack);
      if (unlikely(__pyx_t_6 < 0)) {
        PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_input));
    __pyx_v_input = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":1690
 *         input = input.copy('C')
 * 
 *     buf = <float64_t*> input.data             # <<<<<<<<<<<<<<
 * 
 *     n = len(input)
 */
  __pyx_v_buf = ((__pyx_t_5numpy_float64_t *)__pyx_v_input->data);

  /* "pandas/algos.pyx":1692
 *     buf = <float64_t*> input.data
 * 
 *     n = len(input)             # <<<<<<<<<<<<<<
 *     if n == 0:
 *         return input
 */
  __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_10;

  /* "pandas/algos.pyx":1693
 * 
 *     n = len(input)
 *     if n == 0:             # <<<<<<<<<<<<<<
 *         return input
 * 
 */
  __pyx_t_4 = (__pyx_v_n == 0);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":1694
 *     n = len(input)
 *     if n == 0:
 *         return input             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(win, minp, n)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_input));
    __pyx_r = ((PyObject *)__pyx_v_input);
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":1696
 *         return input
 * 
 *     minp = _check_minp(win, minp, n)             # <<<<<<<<<<<<<<
 *     output = np.empty(n, dtype=float)
 *     counts = roll_sum(np.isfinite(input).astype(float), win, minp)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_2 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_12); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_v_minp = __pyx_t_6;

  /* "pandas/algos.pyx":1697
 * 
 *     minp = _check_minp(win, minp, n)
 *     output = np.empty(n, dtype=float)             # <<<<<<<<<<<<<<
 *     counts = roll_sum(np.isfinite(input).astype(float), win, minp)
 * 
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_11);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "pandas/algos.pyx":1698
 *     minp = _check_minp(win, minp, n)
 *     output = np.empty(n, dtype=float)
 *     counts = roll_sum(np.isfinite(input).astype(float), win, minp)             # <<<<<<<<<<<<<<
 * 
 *     bufarr = np.empty(win, dtype=float)
 */
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__roll_sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__isfinite); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_input));
  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_input));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_input));
  __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__astype); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)((PyObject*)(&PyFloat_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyFloat_Type))));
  __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_1 = 0;
  __pyx_t_13 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_counts = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/algos.pyx":1700
 *     counts = roll_sum(np.isfinite(input).astype(float), win, minp)
 * 
 *     bufarr = np.empty(win, dtype=float)             # <<<<<<<<<<<<<<
 *     oldbuf = <float64_t*> bufarr.data
 * 
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromLong(__pyx_v_win); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bufarr.rcbuffer->pybuffer);
    __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bufarr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_6 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bufarr.rcbuffer->pybuffer, (PyObject*)__pyx_v_bufarr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_8, __pyx_t_7);
      }
    }
    __pyx_pybuffernd_bufarr.diminfo[0].strides = __pyx_pybuffernd_bufarr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bufarr.diminfo[0].shape = __pyx_pybuffernd_bufarr.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_bufarr = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/algos.pyx":1701
 * 
 *     bufarr = np.empty(win, dtype=float)
 *     oldbuf = <float64_t*> bufarr.data             # <<<<<<<<<<<<<<
 * 
 *     n = len(input)
 */
  __pyx_v_oldbuf = ((__pyx_t_5numpy_float64_t *)__pyx_v_bufarr->data);

  /* "pandas/algos.pyx":1703
 *     oldbuf = <float64_t*> bufarr.data
 * 
 *     n = len(input)             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < int_min(win, n):
 *         if counts[i] >= minp:
 */
  __pyx_t_10 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_10;

  /* "pandas/algos.pyx":1704
 * 
 *     n = len(input)
 *     for i from 0 <= i < int_min(win, n):             # <<<<<<<<<<<<<<
 *         if counts[i] >= minp:
 *             output[i] = func(input[int_max(i - win + 1, 0) : i + 1])
 */
  __pyx_t_6 = __pyx_f_6pandas_5algos_int_min(__pyx_v_win, __pyx_v_n);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_6; __pyx_v_i++) {

    /* "pandas/algos.pyx":1705
 *     n = len(input)
 *     for i from 0 <= i < int_min(win, n):
 *         if counts[i] >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = func(input[int_max(i - win + 1, 0) : i + 1])
 *         else:
 */
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_15 = -1;
    if (__pyx_t_10 < 0) {
      __pyx_t_10 += __pyx_pybuffernd_counts.diminfo[0].shape;
      if (unlikely(__pyx_t_10 < 0)) __pyx_t_15 = 0;
    } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_15 = 0;
    if (unlikely(__pyx_t_15 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_15);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_counts.diminfo[0].strides)) >= __pyx_v_minp);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1706
 *     for i from 0 <= i < int_min(win, n):
 *         if counts[i] >= minp:
 *             output[i] = func(input[int_max(i - win + 1, 0) : i + 1])             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_13 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_input), __pyx_f_6pandas_5algos_int_max(((__pyx_v_i - __pyx_v_win) + 1), 0), (__pyx_v_i + 1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
      __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_16 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_15 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_t_16;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1708
 *             output[i] = func(input[int_max(i - win + 1, 0) : i + 1])
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     for i from win <= i < n:
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_15 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L7:;
  }

  /* "pandas/algos.pyx":1710
 *             output[i] = NaN
 * 
 *     for i from win <= i < n:             # <<<<<<<<<<<<<<
 *         buf = buf + 1
 *         bufarr.data = <char*> buf
 */
  __pyx_t_19 = __pyx_v_n;
  for (__pyx_v_i = __pyx_v_win; __pyx_v_i < __pyx_t_19; __pyx_v_i++) {

    /* "pandas/algos.pyx":1711
 * 
 *     for i from win <= i < n:
 *         buf = buf + 1             # <<<<<<<<<<<<<<
 *         bufarr.data = <char*> buf
 *         if counts[i] >= minp:
 */
    __pyx_v_buf = (__pyx_v_buf + 1);

    /* "pandas/algos.pyx":1712
 *     for i from win <= i < n:
 *         buf = buf + 1
 *         bufarr.data = <char*> buf             # <<<<<<<<<<<<<<
 *         if counts[i] >= minp:
 *             output[i] = func(bufarr)
 */
    __pyx_v_bufarr->data = ((char *)__pyx_v_buf);

    /* "pandas/algos.pyx":1713
 *         buf = buf + 1
 *         bufarr.data = <char*> buf
 *         if counts[i] >= minp:             # <<<<<<<<<<<<<<
 *             output[i] = func(bufarr)
 *         else:
 */
    __pyx_t_20 = __pyx_v_i;
    __pyx_t_6 = -1;
    if (__pyx_t_20 < 0) {
      __pyx_t_20 += __pyx_pybuffernd_counts.diminfo[0].shape;
      if (unlikely(__pyx_t_20 < 0)) __pyx_t_6 = 0;
    } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_6 = 0;
    if (unlikely(__pyx_t_6 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_6);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides)) >= __pyx_v_minp);
    if (__pyx_t_4) {

      /* "pandas/algos.pyx":1714
 *         bufarr.data = <char*> buf
 *         if counts[i] >= minp:
 *             output[i] = func(bufarr)             # <<<<<<<<<<<<<<
 *         else:
 *             output[i] = NaN
 */
      __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(((PyObject *)__pyx_v_bufarr));
      PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_bufarr));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_bufarr));
      __pyx_t_12 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
      __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_16 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_6 = -1;
      if (__pyx_t_21 < 0) {
        __pyx_t_21 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_21 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_t_16;
      goto __pyx_L10;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1716
 *             output[i] = func(bufarr)
 *         else:
 *             output[i] = NaN             # <<<<<<<<<<<<<<
 * 
 *     bufarr.data = <char*> oldbuf
 */
      __pyx_t_22 = __pyx_v_i;
      __pyx_t_6 = -1;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_pybuffernd_output.diminfo[0].shape;
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_6 = 0;
      } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_6 = 0;
      if (unlikely(__pyx_t_6 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_6);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
    }
    __pyx_L10:;
  }

  /* "pandas/algos.pyx":1718
 *             output[i] = NaN
 * 
 *     bufarr.data = <char*> oldbuf             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
  __pyx_v_bufarr->data = ((char *)__pyx_v_oldbuf);

  /* "pandas/algos.pyx":1720
 *     bufarr.data = <char*> oldbuf
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bufarr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_generic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bufarr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XDECREF((PyObject *)__pyx_v_counts);
  __Pyx_XDECREF((PyObject *)__pyx_v_bufarr);
  __Pyx_XDECREF((PyObject *)__pyx_v_input);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_59roll_window(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_58roll_window[] = "\n    Assume len(weights) << len(input)\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_59roll_window = {__Pyx_NAMESTR("roll_window"), (PyCFunction)__pyx_pw_6pandas_5algos_59roll_window, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_58roll_window)};
static PyObject *__pyx_pw_6pandas_5algos_59roll_window(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_input = 0;
  PyArrayObject *__pyx_v_weights = 0;
  int __pyx_v_minp;
  int __pyx_v_avg;
  int __pyx_v_avg_wgt;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("roll_window (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__input,&__pyx_n_s__weights,&__pyx_n_s__minp,&__pyx_n_s__avg,&__pyx_n_s__avg_wgt,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__input)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_window", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("roll_window", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__avg);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__avg_wgt);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "roll_window") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_input = ((PyArrayObject *)values[0]);
    __pyx_v_weights = ((PyArrayObject *)values[1]);
    __pyx_v_minp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_minp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    if (values[3]) {
      __pyx_v_avg = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_avg == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {

      /* "pandas/algos.pyx":1725
 * def roll_window(ndarray[float64_t, ndim=1, cast=True] input,
 *                 ndarray[float64_t, ndim=1, cast=True] weights,
 *                 int minp, bint avg=True, bint avg_wgt=False):             # <<<<<<<<<<<<<<
 *     """
 *     Assume len(weights) << len(input)
 */
      __pyx_v_avg = ((int)1);
    }
    if (values[4]) {
      __pyx_v_avg_wgt = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_avg_wgt == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_avg_wgt = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("roll_window", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.roll_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_input), __pyx_ptype_5numpy_ndarray, 1, "input", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_58roll_window(__pyx_self, __pyx_v_input, __pyx_v_weights, __pyx_v_minp, __pyx_v_avg, __pyx_v_avg_wgt);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1723
 * 
 * 
 * def roll_window(ndarray[float64_t, ndim=1, cast=True] input,             # <<<<<<<<<<<<<<
 *                 ndarray[float64_t, ndim=1, cast=True] weights,
 *                 int minp, bint avg=True, bint avg_wgt=False):
 */

static PyObject *__pyx_pf_6pandas_5algos_58roll_window(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_input, PyArrayObject *__pyx_v_weights, int __pyx_v_minp, int __pyx_v_avg, int __pyx_v_avg_wgt) {
  PyArrayObject *__pyx_v_output = 0;
  PyArrayObject *__pyx_v_tot_wgt = 0;
  PyArrayObject *__pyx_v_counts = 0;
  Py_ssize_t __pyx_v_in_i;
  Py_ssize_t __pyx_v_win_i;
  Py_ssize_t __pyx_v_win_n;
  Py_ssize_t __pyx_v_in_n;
  __pyx_t_5numpy_float64_t __pyx_v_val_in;
  __pyx_t_5numpy_float64_t __pyx_v_val_win;
  __pyx_t_5numpy_float64_t __pyx_v_c;
  __pyx_t_5numpy_float64_t __pyx_v_w;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_input;
  __Pyx_Buffer __pyx_pybuffer_input;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_output;
  __Pyx_Buffer __pyx_pybuffer_output;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_tot_wgt;
  __Pyx_Buffer __pyx_pybuffer_tot_wgt;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_weights;
  __Pyx_Buffer __pyx_pybuffer_weights;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("roll_window", 0);
  __pyx_pybuffer_output.pybuffer.buf = NULL;
  __pyx_pybuffer_output.refcount = 0;
  __pyx_pybuffernd_output.data = NULL;
  __pyx_pybuffernd_output.rcbuffer = &__pyx_pybuffer_output;
  __pyx_pybuffer_tot_wgt.pybuffer.buf = NULL;
  __pyx_pybuffer_tot_wgt.refcount = 0;
  __pyx_pybuffernd_tot_wgt.data = NULL;
  __pyx_pybuffernd_tot_wgt.rcbuffer = &__pyx_pybuffer_tot_wgt;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_input.pybuffer.buf = NULL;
  __pyx_pybuffer_input.refcount = 0;
  __pyx_pybuffernd_input.data = NULL;
  __pyx_pybuffernd_input.rcbuffer = &__pyx_pybuffer_input;
  __pyx_pybuffer_weights.pybuffer.buf = NULL;
  __pyx_pybuffer_weights.refcount = 0;
  __pyx_pybuffernd_weights.data = NULL;
  __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_input.rcbuffer->pybuffer, (PyObject*)__pyx_v_input, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_input.diminfo[0].strides = __pyx_pybuffernd_input.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_input.diminfo[0].shape = __pyx_pybuffernd_input.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1734
 *         float64_t val_in, val_win, c, w
 * 
 *     in_n = len(input)             # <<<<<<<<<<<<<<
 *     win_n = len(weights)
 *     output = np.zeros(in_n, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_input)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_in_n = __pyx_t_1;

  /* "pandas/algos.pyx":1735
 * 
 *     in_n = len(input)
 *     win_n = len(weights)             # <<<<<<<<<<<<<<
 *     output = np.zeros(in_n, dtype=float)
 *     counts = np.zeros(in_n, dtype=float)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_weights)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_win_n = __pyx_t_1;

  /* "pandas/algos.pyx":1736
 *     in_n = len(input)
 *     win_n = len(weights)
 *     output = np.zeros(in_n, dtype=float)             # <<<<<<<<<<<<<<
 *     counts = np.zeros(in_n, dtype=float)
 *     if avg:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_in_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_output.rcbuffer->pybuffer, (PyObject*)__pyx_v_output, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_output.diminfo[0].strides = __pyx_pybuffernd_output.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_output.diminfo[0].shape = __pyx_pybuffernd_output.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_output = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1737
 *     win_n = len(weights)
 *     output = np.zeros(in_n, dtype=float)
 *     counts = np.zeros(in_n, dtype=float)             # <<<<<<<<<<<<<<
 *     if avg:
 *         tot_wgt = np.zeros(in_n, dtype=float)
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_in_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_counts = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1738
 *     output = np.zeros(in_n, dtype=float)
 *     counts = np.zeros(in_n, dtype=float)
 *     if avg:             # <<<<<<<<<<<<<<
 *         tot_wgt = np.zeros(in_n, dtype=float)
 * 
 */
  if (__pyx_v_avg) {

    /* "pandas/algos.pyx":1739
 *     counts = np.zeros(in_n, dtype=float)
 *     if avg:
 *         tot_wgt = np.zeros(in_n, dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     minp = _check_minp(len(weights), minp, in_n)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_in_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer, (PyObject*)__pyx_v_tot_wgt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
      }
      __pyx_pybuffernd_tot_wgt.diminfo[0].strides = __pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tot_wgt.diminfo[0].shape = __pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = 0;
    __pyx_v_tot_wgt = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":1741
 *         tot_wgt = np.zeros(in_n, dtype=float)
 * 
 *     minp = _check_minp(len(weights), minp, in_n)             # <<<<<<<<<<<<<<
 * 
 *     if avg_wgt:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___check_minp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_weights)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_minp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_in_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_minp = __pyx_t_7;

  /* "pandas/algos.pyx":1743
 *     minp = _check_minp(len(weights), minp, in_n)
 * 
 *     if avg_wgt:             # <<<<<<<<<<<<<<
 *         for win_i from 0 <= win_i < win_n:
 *             val_win = weights[win_i]
 */
  if (__pyx_v_avg_wgt) {

    /* "pandas/algos.pyx":1744
 * 
 *     if avg_wgt:
 *         for win_i from 0 <= win_i < win_n:             # <<<<<<<<<<<<<<
 *             val_win = weights[win_i]
 *             if val_win != val_win:
 */
    __pyx_t_1 = __pyx_v_win_n;
    for (__pyx_v_win_i = 0; __pyx_v_win_i < __pyx_t_1; __pyx_v_win_i++) {

      /* "pandas/algos.pyx":1745
 *     if avg_wgt:
 *         for win_i from 0 <= win_i < win_n:
 *             val_win = weights[win_i]             # <<<<<<<<<<<<<<
 *             if val_win != val_win:
 *                 continue
 */
      __pyx_t_12 = __pyx_v_win_i;
      __pyx_t_7 = -1;
      if (__pyx_t_12 < 0) {
        __pyx_t_12 += __pyx_pybuffernd_weights.diminfo[0].shape;
        if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_weights.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val_win = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_weights.diminfo[0].strides));

      /* "pandas/algos.pyx":1746
 *         for win_i from 0 <= win_i < win_n:
 *             val_win = weights[win_i]
 *             if val_win != val_win:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_val_win != __pyx_v_val_win);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1747
 *             val_win = weights[win_i]
 *             if val_win != val_win:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:
 */
        goto __pyx_L5_continue;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/algos.pyx":1749
 *                 continue
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:             # <<<<<<<<<<<<<<
 *                 val_in = input[in_i]
 *                 if val_in == val_in:
 */
      __pyx_t_14 = ((__pyx_v_in_n - (__pyx_v_win_n - __pyx_v_win_i)) + 1);
      for (__pyx_v_in_i = 0; __pyx_v_in_i < __pyx_t_14; __pyx_v_in_i++) {

        /* "pandas/algos.pyx":1750
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:
 *                 val_in = input[in_i]             # <<<<<<<<<<<<<<
 *                 if val_in == val_in:
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 */
        __pyx_t_15 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_15 += __pyx_pybuffernd_input.diminfo[0].shape;
          if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_val_in = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_input.diminfo[0].strides));

        /* "pandas/algos.pyx":1751
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:
 *                 val_in = input[in_i]
 *                 if val_in == val_in:             # <<<<<<<<<<<<<<
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 */
        __pyx_t_13 = (__pyx_v_val_in == __pyx_v_val_in);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":1752
 *                 val_in = input[in_i]
 *                 if val_in == val_in:
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win             # <<<<<<<<<<<<<<
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 *                     tot_wgt[in_i + (win_n - win_i) - 1] += val_win
 */
          __pyx_t_16 = ((__pyx_v_in_i + (__pyx_v_win_n - __pyx_v_win_i)) - 1);
          __pyx_t_7 = -1;
          if (__pyx_t_16 < 0) {
            __pyx_t_16 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_16 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_output.diminfo[0].strides) += (__pyx_v_val_in * __pyx_v_val_win);

          /* "pandas/algos.pyx":1753
 *                 if val_in == val_in:
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 *                     counts[in_i + (win_n - win_i) - 1] += 1             # <<<<<<<<<<<<<<
 *                     tot_wgt[in_i + (win_n - win_i) - 1] += val_win
 * 
 */
          __pyx_t_17 = ((__pyx_v_in_i + (__pyx_v_win_n - __pyx_v_win_i)) - 1);
          __pyx_t_7 = -1;
          if (__pyx_t_17 < 0) {
            __pyx_t_17 += __pyx_pybuffernd_counts.diminfo[0].shape;
            if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1753; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1.0;

          /* "pandas/algos.pyx":1754
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 *                     tot_wgt[in_i + (win_n - win_i) - 1] += val_win             # <<<<<<<<<<<<<<
 * 
 *         for in_i from 0 <= in_i < in_n:
 */
          __pyx_t_18 = ((__pyx_v_in_i + (__pyx_v_win_n - __pyx_v_win_i)) - 1);
          __pyx_t_7 = -1;
          if (__pyx_t_18 < 0) {
            __pyx_t_18 += __pyx_pybuffernd_tot_wgt.diminfo[0].shape;
            if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_tot_wgt.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_tot_wgt.diminfo[0].strides) += __pyx_v_val_win;
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      __pyx_L5_continue:;
    }

    /* "pandas/algos.pyx":1756
 *                     tot_wgt[in_i + (win_n - win_i) - 1] += val_win
 * 
 *         for in_i from 0 <= in_i < in_n:             # <<<<<<<<<<<<<<
 *             c = counts[in_i]
 *             if c < minp:
 */
    __pyx_t_1 = __pyx_v_in_n;
    for (__pyx_v_in_i = 0; __pyx_v_in_i < __pyx_t_1; __pyx_v_in_i++) {

      /* "pandas/algos.pyx":1757
 * 
 *         for in_i from 0 <= in_i < in_n:
 *             c = counts[in_i]             # <<<<<<<<<<<<<<
 *             if c < minp:
 *                 output[in_i] = NaN
 */
      __pyx_t_14 = __pyx_v_in_i;
      __pyx_t_7 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_14 += __pyx_pybuffernd_counts.diminfo[0].shape;
        if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_c = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_counts.diminfo[0].strides));

      /* "pandas/algos.pyx":1758
 *         for in_i from 0 <= in_i < in_n:
 *             c = counts[in_i]
 *             if c < minp:             # <<<<<<<<<<<<<<
 *                 output[in_i] = NaN
 *             else:
 */
      __pyx_t_13 = (__pyx_v_c < __pyx_v_minp);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1759
 *             c = counts[in_i]
 *             if c < minp:
 *                 output[in_i] = NaN             # <<<<<<<<<<<<<<
 *             else:
 *                 w = tot_wgt[in_i]
 */
        __pyx_t_19 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_19 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1761
 *                 output[in_i] = NaN
 *             else:
 *                 w = tot_wgt[in_i]             # <<<<<<<<<<<<<<
 *                 if w == 0:
 *                     output[in_i] = NaN
 */
        __pyx_t_20 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_20 += __pyx_pybuffernd_tot_wgt.diminfo[0].shape;
          if (unlikely(__pyx_t_20 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_tot_wgt.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_w = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_tot_wgt.diminfo[0].strides));

        /* "pandas/algos.pyx":1762
 *             else:
 *                 w = tot_wgt[in_i]
 *                 if w == 0:             # <<<<<<<<<<<<<<
 *                     output[in_i] = NaN
 *                 else:
 */
        __pyx_t_13 = (__pyx_v_w == 0.0);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":1763
 *                 w = tot_wgt[in_i]
 *                 if w == 0:
 *                     output[in_i] = NaN             # <<<<<<<<<<<<<<
 *                 else:
 *                     output[in_i] /= tot_wgt[in_i]
 */
          __pyx_t_21 = __pyx_v_in_i;
          __pyx_t_7 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "pandas/algos.pyx":1765
 *                     output[in_i] = NaN
 *                 else:
 *                     output[in_i] /= tot_wgt[in_i]             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
          __pyx_t_22 = __pyx_v_in_i;
          __pyx_t_7 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_tot_wgt.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_tot_wgt.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_23 = __pyx_v_in_i;
          __pyx_t_7 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_output.diminfo[0].strides) /= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_tot_wgt.diminfo[0].strides));
        }
        __pyx_L14:;
      }
      __pyx_L13:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1768
 * 
 *     else:
 *         for win_i from 0 <= win_i < win_n:             # <<<<<<<<<<<<<<
 *             val_win = weights[win_i]
 *             if val_win != val_win:
 */
    __pyx_t_1 = __pyx_v_win_n;
    for (__pyx_v_win_i = 0; __pyx_v_win_i < __pyx_t_1; __pyx_v_win_i++) {

      /* "pandas/algos.pyx":1769
 *     else:
 *         for win_i from 0 <= win_i < win_n:
 *             val_win = weights[win_i]             # <<<<<<<<<<<<<<
 *             if val_win != val_win:
 *                 continue
 */
      __pyx_t_24 = __pyx_v_win_i;
      __pyx_t_7 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_pybuffernd_weights.diminfo[0].shape;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_weights.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val_win = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_weights.diminfo[0].strides));

      /* "pandas/algos.pyx":1770
 *         for win_i from 0 <= win_i < win_n:
 *             val_win = weights[win_i]
 *             if val_win != val_win:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_val_win != __pyx_v_val_win);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1771
 *             val_win = weights[win_i]
 *             if val_win != val_win:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:
 */
        goto __pyx_L15_continue;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/algos.pyx":1773
 *                 continue
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:             # <<<<<<<<<<<<<<
 *                 val_in = input[in_i]
 * 
 */
      __pyx_t_25 = ((__pyx_v_in_n - (__pyx_v_win_n - __pyx_v_win_i)) + 1);
      for (__pyx_v_in_i = 0; __pyx_v_in_i < __pyx_t_25; __pyx_v_in_i++) {

        /* "pandas/algos.pyx":1774
 * 
 *             for in_i from 0 <= in_i < in_n - (win_n - win_i) + 1:
 *                 val_in = input[in_i]             # <<<<<<<<<<<<<<
 * 
 *                 if val_in == val_in:
 */
        __pyx_t_26 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_input.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_input.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_val_in = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_input.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_input.diminfo[0].strides));

        /* "pandas/algos.pyx":1776
 *                 val_in = input[in_i]
 * 
 *                 if val_in == val_in:             # <<<<<<<<<<<<<<
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 */
        __pyx_t_13 = (__pyx_v_val_in == __pyx_v_val_in);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":1777
 * 
 *                 if val_in == val_in:
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win             # <<<<<<<<<<<<<<
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 * 
 */
          __pyx_t_27 = ((__pyx_v_in_i + (__pyx_v_win_n - __pyx_v_win_i)) - 1);
          __pyx_t_7 = -1;
          if (__pyx_t_27 < 0) {
            __pyx_t_27 += __pyx_pybuffernd_output.diminfo[0].shape;
            if (unlikely(__pyx_t_27 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_output.diminfo[0].strides) += (__pyx_v_val_in * __pyx_v_val_win);

          /* "pandas/algos.pyx":1778
 *                 if val_in == val_in:
 *                     output[in_i + (win_n - win_i) - 1] += val_in * val_win
 *                     counts[in_i + (win_n - win_i) - 1] += 1             # <<<<<<<<<<<<<<
 * 
 *         for in_i from 0 <= in_i < in_n:
 */
          __pyx_t_28 = ((__pyx_v_in_i + (__pyx_v_win_n - __pyx_v_win_i)) - 1);
          __pyx_t_7 = -1;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_pybuffernd_counts.diminfo[0].shape;
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_counts.diminfo[0].strides) += 1.0;
          goto __pyx_L20;
        }
        __pyx_L20:;
      }
      __pyx_L15_continue:;
    }

    /* "pandas/algos.pyx":1780
 *                     counts[in_i + (win_n - win_i) - 1] += 1
 * 
 *         for in_i from 0 <= in_i < in_n:             # <<<<<<<<<<<<<<
 *             c = counts[in_i]
 *             if c < minp:
 */
    __pyx_t_1 = __pyx_v_in_n;
    for (__pyx_v_in_i = 0; __pyx_v_in_i < __pyx_t_1; __pyx_v_in_i++) {

      /* "pandas/algos.pyx":1781
 * 
 *         for in_i from 0 <= in_i < in_n:
 *             c = counts[in_i]             # <<<<<<<<<<<<<<
 *             if c < minp:
 *                 output[in_i] = NaN
 */
      __pyx_t_25 = __pyx_v_in_i;
      __pyx_t_7 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_counts.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_c = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_counts.diminfo[0].strides));

      /* "pandas/algos.pyx":1782
 *         for in_i from 0 <= in_i < in_n:
 *             c = counts[in_i]
 *             if c < minp:             # <<<<<<<<<<<<<<
 *                 output[in_i] = NaN
 *             elif avg:
 */
      __pyx_t_13 = (__pyx_v_c < __pyx_v_minp);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1783
 *             c = counts[in_i]
 *             if c < minp:
 *                 output[in_i] = NaN             # <<<<<<<<<<<<<<
 *             elif avg:
 *                 output[in_i] /= c
 */
        __pyx_t_29 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_output.diminfo[0].strides) = __pyx_v_6pandas_5algos_NaN;
        goto __pyx_L23;
      }

      /* "pandas/algos.pyx":1784
 *             if c < minp:
 *                 output[in_i] = NaN
 *             elif avg:             # <<<<<<<<<<<<<<
 *                 output[in_i] /= c
 * 
 */
      if (__pyx_v_avg) {

        /* "pandas/algos.pyx":1785
 *                 output[in_i] = NaN
 *             elif avg:
 *                 output[in_i] /= c             # <<<<<<<<<<<<<<
 * 
 *     return output
 */
        __pyx_t_30 = __pyx_v_in_i;
        __pyx_t_7 = -1;
        if (__pyx_t_30 < 0) {
          __pyx_t_30 += __pyx_pybuffernd_output.diminfo[0].shape;
          if (unlikely(__pyx_t_30 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_output.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_pybuffernd_output.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_output.diminfo[0].strides) /= __pyx_v_c;
        goto __pyx_L23;
      }
      __pyx_L23:;
    }
  }
  __pyx_L4:;

  /* "pandas/algos.pyx":1787
 *                 output[in_i] /= c
 * 
 *     return output             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_output));
  __pyx_r = ((PyObject *)__pyx_v_output);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.roll_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_input.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_output.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tot_wgt.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_output);
  __Pyx_XDECREF((PyObject *)__pyx_v_tot_wgt);
  __Pyx_XDECREF((PyObject *)__pyx_v_counts);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_61is_lexsorted(PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_61is_lexsorted = {__Pyx_NAMESTR("is_lexsorted"), (PyCFunction)__pyx_pw_6pandas_5algos_61is_lexsorted, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_61is_lexsorted(PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_lexsorted (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_list_of_arrays), (&PyList_Type), 1, "list_of_arrays", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_60is_lexsorted(__pyx_self, ((PyObject*)__pyx_v_list_of_arrays));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1796
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
 *     cdef:
 *         int i
 */

static PyObject *__pyx_pf_6pandas_5algos_60is_lexsorted(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_list_of_arrays) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_nlevels;
  __pyx_t_5numpy_int64_t __pyx_v_k;
  __pyx_t_5numpy_int64_t __pyx_v_cur;
  __pyx_t_5numpy_int64_t __pyx_v_pre;
  PyArrayObject *__pyx_v_arr = 0;
  __pyx_t_5numpy_int64_t **__pyx_v_vecs;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_lexsorted", 0);

  /* "pandas/algos.pyx":1803
 *         ndarray arr
 * 
 *     nlevels = len(list_of_arrays)             # <<<<<<<<<<<<<<
 *     n = len(list_of_arrays[0])
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyList_GET_SIZE(((PyObject *)__pyx_v_list_of_arrays)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nlevels = __pyx_t_1;

  /* "pandas/algos.pyx":1804
 * 
 *     nlevels = len(list_of_arrays)
 *     n = len(list_of_arrays[0])             # <<<<<<<<<<<<<<
 * 
 *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))
 */
  if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = PyList_GET_ITEM(__pyx_v_list_of_arrays, 0);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":1806
 *     n = len(list_of_arrays[0])
 * 
 *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < nlevels:
 *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
 */
  __pyx_v_vecs = ((__pyx_t_5numpy_int64_t **)malloc((__pyx_v_nlevels * (sizeof(__pyx_t_5numpy_int64_t *)))));

  /* "pandas/algos.pyx":1807
 * 
 *     cdef int64_t **vecs = <int64_t**> malloc(nlevels * sizeof(int64_t*))
 *     for i from 0 <= i < nlevels:             # <<<<<<<<<<<<<<
 *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
 * 
 */
  __pyx_t_1 = __pyx_v_nlevels;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1810
 *         # vecs[i] = <int64_t *> (<ndarray> list_of_arrays[i]).data
 * 
 *         arr = list_of_arrays[i]             # <<<<<<<<<<<<<<
 *         vecs[i] = <int64_t *> arr.data
 *     # assume uniqueness??
 */
    if (unlikely(((PyObject *)__pyx_v_list_of_arrays) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (!(likely(((PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i), __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyList_GET_ITEM(__pyx_v_list_of_arrays, __pyx_v_i);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF(((PyObject *)__pyx_v_arr));
    __pyx_v_arr = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pandas/algos.pyx":1811
 * 
 *         arr = list_of_arrays[i]
 *         vecs[i] = <int64_t *> arr.data             # <<<<<<<<<<<<<<
 *     # assume uniqueness??
 * 
 */
    (__pyx_v_vecs[__pyx_v_i]) = ((__pyx_t_5numpy_int64_t *)__pyx_v_arr->data);
  }

  /* "pandas/algos.pyx":1814
 *     # assume uniqueness??
 * 
 *     for i from 1 <= i < n:             # <<<<<<<<<<<<<<
 *         for k from 0 <= k < nlevels:
 *             cur = vecs[k][i]
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1815
 * 
 *     for i from 1 <= i < n:
 *         for k from 0 <= k < nlevels:             # <<<<<<<<<<<<<<
 *             cur = vecs[k][i]
 *             pre = vecs[k][i-1]
 */
    __pyx_t_3 = __pyx_v_nlevels;
    for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) {

      /* "pandas/algos.pyx":1816
 *     for i from 1 <= i < n:
 *         for k from 0 <= k < nlevels:
 *             cur = vecs[k][i]             # <<<<<<<<<<<<<<
 *             pre = vecs[k][i-1]
 *             if cur == pre:
 */
      __pyx_v_cur = ((__pyx_v_vecs[__pyx_v_k])[__pyx_v_i]);

      /* "pandas/algos.pyx":1817
 *         for k from 0 <= k < nlevels:
 *             cur = vecs[k][i]
 *             pre = vecs[k][i-1]             # <<<<<<<<<<<<<<
 *             if cur == pre:
 *                 continue
 */
      __pyx_v_pre = ((__pyx_v_vecs[__pyx_v_k])[(__pyx_v_i - 1)]);

      /* "pandas/algos.pyx":1818
 *             cur = vecs[k][i]
 *             pre = vecs[k][i-1]
 *             if cur == pre:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif cur > pre:
 */
      __pyx_t_4 = (__pyx_v_cur == __pyx_v_pre);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1819
 *             pre = vecs[k][i-1]
 *             if cur == pre:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif cur > pre:
 *                 break
 */
        goto __pyx_L7_continue;
        goto __pyx_L9;
      }

      /* "pandas/algos.pyx":1820
 *             if cur == pre:
 *                 continue
 *             elif cur > pre:             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
      __pyx_t_4 = (__pyx_v_cur > __pyx_v_pre);
      if (__pyx_t_4) {

        /* "pandas/algos.pyx":1821
 *                 continue
 *             elif cur > pre:
 *                 break             # <<<<<<<<<<<<<<
 *             else:
 *                 return False
 */
        goto __pyx_L8_break;
        goto __pyx_L9;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1823
 *                 break
 *             else:
 *                 return False             # <<<<<<<<<<<<<<
 *     free(vecs)
 *     return True
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_r = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L0;
      }
      __pyx_L9:;
      __pyx_L7_continue:;
    }
    __pyx_L8_break:;
  }

  /* "pandas/algos.pyx":1824
 *             else:
 *                 return False
 *     free(vecs)             # <<<<<<<<<<<<<<
 *     return True
 * 
 */
  free(__pyx_v_vecs);

  /* "pandas/algos.pyx":1825
 *                 return False
 *     free(vecs)
 *     return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pandas.algos.is_lexsorted", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_63groupby_indices(PyObject *__pyx_self, PyObject *__pyx_v_values); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_63groupby_indices = {__Pyx_NAMESTR("groupby_indices"), (PyCFunction)__pyx_pw_6pandas_5algos_63groupby_indices, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_63groupby_indices(PyObject *__pyx_self, PyObject *__pyx_v_values) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_indices (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_62groupby_indices(__pyx_self, ((PyArrayObject *)__pyx_v_values));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1829
 * 
 * @cython.boundscheck(False)
 * def groupby_indices(ndarray values):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(values)
 */

static PyObject *__pyx_pf_6pandas_5algos_62groupby_indices(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyArrayObject *__pyx_v_labels = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_arr = 0;
  PyArrayObject *__pyx_v_seen = 0;
  __pyx_t_5numpy_int64_t __pyx_v_loc;
  PyObject *__pyx_v_ids = 0;
  __pyx_t_5numpy_int64_t __pyx_v_k;
  __pyx_t_5numpy_int64_t **__pyx_v_vecs;
  PyObject *__pyx_v_result = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_seen;
  __Pyx_Buffer __pyx_pybuffer_seen;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  __pyx_t_5numpy_int64_t __pyx_t_16;
  __pyx_t_5numpy_int64_t __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_indices", 0);
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  __pyx_pybuffer_seen.pybuffer.buf = NULL;
  __pyx_pybuffer_seen.refcount = 0;
  __pyx_pybuffernd_seen.data = NULL;
  __pyx_pybuffernd_seen.rcbuffer = &__pyx_pybuffer_seen;

  /* "pandas/algos.pyx":1831
 * def groupby_indices(ndarray values):
 *     cdef:
 *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] labels, counts, arr, seen
 *         int64_t loc
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":1834
 *         ndarray[int64_t] labels, counts, arr, seen
 *         int64_t loc
 *         dict ids = {}             # <<<<<<<<<<<<<<
 *         object val
 *         int64_t k
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_v_ids = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1838
 *         int64_t k
 * 
 *     ids, labels, counts = group_labels(values)             # <<<<<<<<<<<<<<
 *     seen = np.zeros_like(counts)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__group_labels); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_values));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_values));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_values));
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(PyDict_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_ids));
  __pyx_v_ids = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
    }
    __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = 0;
  __pyx_v_labels = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = 0;
  __pyx_v_counts = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1839
 * 
 *     ids, labels, counts = group_labels(values)
 *     seen = np.zeros_like(counts)             # <<<<<<<<<<<<<<
 * 
 *     # try not to get in trouble here...
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_counts));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_counts));
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_seen.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_seen.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_seen.rcbuffer->pybuffer, (PyObject*)__pyx_v_seen, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
    }
    __pyx_pybuffernd_seen.diminfo[0].strides = __pyx_pybuffernd_seen.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_seen.diminfo[0].shape = __pyx_pybuffernd_seen.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = 0;
  __pyx_v_seen = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1842
 * 
 *     # try not to get in trouble here...
 *     cdef int64_t **vecs = <int64_t **> malloc(len(ids) * sizeof(int64_t*))             # <<<<<<<<<<<<<<
 *     result = {}
 *     for i from 0 <= i < len(counts):
 */
  if (unlikely(((PyObject *)__pyx_v_ids) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = PyDict_Size(((PyObject *)__pyx_v_ids)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_vecs = ((__pyx_t_5numpy_int64_t **)malloc((__pyx_t_1 * (sizeof(__pyx_t_5numpy_int64_t *)))));

  /* "pandas/algos.pyx":1843
 *     # try not to get in trouble here...
 *     cdef int64_t **vecs = <int64_t **> malloc(len(ids) * sizeof(int64_t*))
 *     result = {}             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < len(counts):
 *         arr = np.empty(counts[i], dtype=np.int64)
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_v_result = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1844
 *     cdef int64_t **vecs = <int64_t **> malloc(len(ids) * sizeof(int64_t*))
 *     result = {}
 *     for i from 0 <= i < len(counts):             # <<<<<<<<<<<<<<
 *         arr = np.empty(counts[i], dtype=np.int64)
 *         result[ids[i]] = arr
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1845
 *     result = {}
 *     for i from 0 <= i < len(counts):
 *         arr = np.empty(counts[i], dtype=np.int64)             # <<<<<<<<<<<<<<
 *         result[ids[i]] = arr
 *         vecs[i] = <int64_t *> arr.data
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = __pyx_v_i;
    if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_counts.diminfo[0].shape;
    __pyx_t_2 = __Pyx_PyInt_to_py_npy_int64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_counts.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
      __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_9 < 0)) {
        PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        }
      }
      __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_8 = 0;
    __Pyx_XDECREF(((PyObject *)__pyx_v_arr));
    __pyx_v_arr = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pandas/algos.pyx":1846
 *     for i from 0 <= i < len(counts):
 *         arr = np.empty(counts[i], dtype=np.int64)
 *         result[ids[i]] = arr             # <<<<<<<<<<<<<<
 *         vecs[i] = <int64_t *> arr.data
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_ids) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ids), __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_6, ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "pandas/algos.pyx":1847
 *         arr = np.empty(counts[i], dtype=np.int64)
 *         result[ids[i]] = arr
 *         vecs[i] = <int64_t *> arr.data             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < n:
 */
    (__pyx_v_vecs[__pyx_v_i]) = ((__pyx_t_5numpy_int64_t *)__pyx_v_arr->data);
  }

  /* "pandas/algos.pyx":1849
 *         vecs[i] = <int64_t *> arr.data
 * 
 *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *         k = labels[i]
 * 
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1850
 * 
 *     for i from 0 <= i < n:
 *         k = labels[i]             # <<<<<<<<<<<<<<
 * 
 *         # was NaN
 */
    __pyx_t_14 = __pyx_v_i;
    if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_labels.diminfo[0].shape;
    __pyx_v_k = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

    /* "pandas/algos.pyx":1853
 * 
 *         # was NaN
 *         if k == -1:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_15 = (__pyx_v_k == -1);
    if (__pyx_t_15) {

      /* "pandas/algos.pyx":1854
 *         # was NaN
 *         if k == -1:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         loc = seen[k]
 */
      goto __pyx_L7_continue;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "pandas/algos.pyx":1856
 *             continue
 * 
 *         loc = seen[k]             # <<<<<<<<<<<<<<
 *         vecs[k][loc] = i
 *         seen[k] = loc + 1
 */
    __pyx_t_16 = __pyx_v_k;
    if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_seen.diminfo[0].shape;
    __pyx_v_loc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_seen.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_seen.diminfo[0].strides));

    /* "pandas/algos.pyx":1857
 * 
 *         loc = seen[k]
 *         vecs[k][loc] = i             # <<<<<<<<<<<<<<
 *         seen[k] = loc + 1
 * 
 */
    ((__pyx_v_vecs[__pyx_v_k])[__pyx_v_loc]) = __pyx_v_i;

    /* "pandas/algos.pyx":1858
 *         loc = seen[k]
 *         vecs[k][loc] = i
 *         seen[k] = loc + 1             # <<<<<<<<<<<<<<
 * 
 *     free(vecs)
 */
    __pyx_t_17 = __pyx_v_k;
    if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_seen.diminfo[0].shape;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_seen.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_seen.diminfo[0].strides) = (__pyx_v_loc + 1);
    __pyx_L7_continue:;
  }

  /* "pandas/algos.pyx":1860
 *         seen[k] = loc + 1
 * 
 *     free(vecs)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  free(__pyx_v_vecs);

  /* "pandas/algos.pyx":1862
 *     free(vecs)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_seen.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_seen.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_labels);
  __Pyx_XDECREF((PyObject *)__pyx_v_counts);
  __Pyx_XDECREF((PyObject *)__pyx_v_arr);
  __Pyx_XDECREF((PyObject *)__pyx_v_seen);
  __Pyx_XDECREF(__pyx_v_ids);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_65group_labels(PyObject *__pyx_self, PyObject *__pyx_v_values); /*proto*/
static char __pyx_doc_6pandas_5algos_64group_labels[] = "\n    Compute label vector from input values and associated useful data\n\n    Returns\n    -------\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_65group_labels = {__Pyx_NAMESTR("group_labels"), (PyCFunction)__pyx_pw_6pandas_5algos_65group_labels, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_64group_labels)};
static PyObject *__pyx_pw_6pandas_5algos_65group_labels(PyObject *__pyx_self, PyObject *__pyx_v_values) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_labels (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_64group_labels(__pyx_self, ((PyArrayObject *)__pyx_v_values));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1866
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def group_labels(ndarray[object] values):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute label vector from input values and associated useful data
 */

static PyObject *__pyx_pf_6pandas_5algos_64group_labels(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyArrayObject *__pyx_v_labels = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyObject *__pyx_v_ids = 0;
  PyObject *__pyx_v_reverse = 0;
  __pyx_t_5numpy_int64_t __pyx_v_idx;
  PyObject *__pyx_v_val = 0;
  __pyx_t_5numpy_int64_t __pyx_v_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  __pyx_t_5numpy_int64_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  __pyx_t_5numpy_int64_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_int64_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_labels", 0);
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1874
 *     '''
 *     cdef:
 *         Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] labels = np.empty(n, dtype=np.int64)
 *         ndarray[int64_t] counts = np.empty(n, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/algos.pyx":1875
 *     cdef:
 *         Py_ssize_t i, n = len(values)
 *         ndarray[int64_t] labels = np.empty(n, dtype=np.int64)             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] counts = np.empty(n, dtype=np.int64)
 *         dict ids = {}, reverse = {}
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_labels = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_labels = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/algos.pyx":1876
 *         Py_ssize_t i, n = len(values)
 *         ndarray[int64_t] labels = np.empty(n, dtype=np.int64)
 *         ndarray[int64_t] counts = np.empty(n, dtype=np.int64)             # <<<<<<<<<<<<<<
 *         dict ids = {}, reverse = {}
 *         int64_t idx
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_counts = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_counts = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1877
 *         ndarray[int64_t] labels = np.empty(n, dtype=np.int64)
 *         ndarray[int64_t] counts = np.empty(n, dtype=np.int64)
 *         dict ids = {}, reverse = {}             # <<<<<<<<<<<<<<
 *         int64_t idx
 *         object val
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_v_ids = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_v_reverse = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1880
 *         int64_t idx
 *         object val
 *         int64_t count = 0             # <<<<<<<<<<<<<<
 * 
 *     for i from 0 <= i < n:
 */
  __pyx_v_count = 0;

  /* "pandas/algos.pyx":1882
 *         int64_t count = 0
 * 
 *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *         val = values[i]
 * 
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "pandas/algos.pyx":1883
 * 
 *     for i from 0 <= i < n:
 *         val = values[i]             # <<<<<<<<<<<<<<
 * 
 *         # is NaN
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_5);
    __Pyx_XDECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pandas/algos.pyx":1886
 * 
 *         # is NaN
 *         if val != val:             # <<<<<<<<<<<<<<
 *             labels[i] = -1
 *             continue
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1887
 *         # is NaN
 *         if val != val:
 *             labels[i] = -1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_t_11 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_labels.diminfo[0].strides) = -1;

      /* "pandas/algos.pyx":1888
 *         if val != val:
 *             labels[i] = -1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         # for large number of groups, not doing try: except: makes a big
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/algos.pyx":1892
 *         # for large number of groups, not doing try: except: makes a big
 *         # difference
 *         if val in ids:             # <<<<<<<<<<<<<<
 *             idx = ids[val]
 *             labels[i] = idx
 */
    __pyx_t_10 = (__Pyx_PyDict_Contains(__pyx_v_val, ((PyObject *)__pyx_v_ids), Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_10) {

      /* "pandas/algos.pyx":1893
 *         # difference
 *         if val in ids:
 *             idx = ids[val]             # <<<<<<<<<<<<<<
 *             labels[i] = idx
 *             counts[idx] = counts[idx] + 1
 */
      __pyx_t_5 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_ids), __pyx_v_val); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_5); if (unlikely((__pyx_t_12 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_idx = __pyx_t_12;

      /* "pandas/algos.pyx":1894
 *         if val in ids:
 *             idx = ids[val]
 *             labels[i] = idx             # <<<<<<<<<<<<<<
 *             counts[idx] = counts[idx] + 1
 *         else:
 */
      __pyx_t_13 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_labels.diminfo[0].strides) = __pyx_v_idx;

      /* "pandas/algos.pyx":1895
 *             idx = ids[val]
 *             labels[i] = idx
 *             counts[idx] = counts[idx] + 1             # <<<<<<<<<<<<<<
 *         else:
 *             ids[val] = count
 */
      __pyx_t_12 = __pyx_v_idx;
      __pyx_t_14 = __pyx_v_idx;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_counts.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_counts.diminfo[0].strides)) + 1);
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/algos.pyx":1897
 *             counts[idx] = counts[idx] + 1
 *         else:
 *             ids[val] = count             # <<<<<<<<<<<<<<
 *             reverse[count] = val
 *             labels[i] = count
 */
      __pyx_t_5 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(((PyObject *)__pyx_v_ids), __pyx_v_val, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pandas/algos.pyx":1898
 *         else:
 *             ids[val] = count
 *             reverse[count] = val             # <<<<<<<<<<<<<<
 *             labels[i] = count
 *             counts[count] = 1
 */
      if (__Pyx_SetItemInt(((PyObject *)__pyx_v_reverse), __pyx_v_count, __pyx_v_val, sizeof(__pyx_t_5numpy_int64_t), __Pyx_PyInt_to_py_npy_int64) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "pandas/algos.pyx":1899
 *             ids[val] = count
 *             reverse[count] = val
 *             labels[i] = count             # <<<<<<<<<<<<<<
 *             counts[count] = 1
 *             count += 1
 */
      __pyx_t_15 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides) = __pyx_v_count;

      /* "pandas/algos.pyx":1900
 *             reverse[count] = val
 *             labels[i] = count
 *             counts[count] = 1             # <<<<<<<<<<<<<<
 *             count += 1
 * 
 */
      __pyx_t_16 = __pyx_v_count;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_counts.diminfo[0].strides) = 1;

      /* "pandas/algos.pyx":1901
 *             labels[i] = count
 *             counts[count] = 1
 *             count += 1             # <<<<<<<<<<<<<<
 * 
 *     return reverse, labels, counts[:count].copy()
 */
      __pyx_v_count = (__pyx_v_count + 1);
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/algos.pyx":1903
 *             count += 1
 * 
 *     return reverse, labels, counts[:count].copy()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_counts), 0, __pyx_v_count); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__copy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_reverse));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_reverse));
  __Pyx_INCREF(((PyObject *)__pyx_v_labels));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_labels));
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_labels", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_labels);
  __Pyx_XDECREF((PyObject *)__pyx_v_counts);
  __Pyx_XDECREF(__pyx_v_ids);
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_67groupsort_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_67groupsort_indexer = {__Pyx_NAMESTR("groupsort_indexer"), (PyCFunction)__pyx_pw_6pandas_5algos_67groupsort_indexer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_67groupsort_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  Py_ssize_t __pyx_v_ngroups;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupsort_indexer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__ngroups,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngroups)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupsort_indexer", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupsort_indexer") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_ngroups = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_ngroups == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupsort_indexer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupsort_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_66groupsort_indexer(__pyx_self, __pyx_v_index, __pyx_v_ngroups);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1908
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def groupsort_indexer(ndarray[int64_t] index, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, loc, label, n
 */

static PyObject *__pyx_pf_6pandas_5algos_66groupsort_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, Py_ssize_t __pyx_v_ngroups) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_label;
  Py_ssize_t __pyx_v_n;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_where = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_where;
  __Pyx_Buffer __pyx_pybuffer_where;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __pyx_t_5numpy_int64_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  __pyx_t_5numpy_int64_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupsort_indexer", 0);
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_where.pybuffer.buf = NULL;
  __pyx_pybuffer_where.refcount = 0;
  __pyx_pybuffernd_where.data = NULL;
  __pyx_pybuffernd_where.rcbuffer = &__pyx_pybuffer_where;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1914
 * 
 *     # count group sizes, location 0 for NA
 *     counts = np.zeros(ngroups + 1, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     n = len(index)
 *     for i from 0 <= i < n:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ngroups + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_counts = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":1915
 *     # count group sizes, location 0 for NA
 *     counts = np.zeros(ngroups + 1, dtype=np.int64)
 *     n = len(index)             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < n:
 *         counts[index[i] + 1] += 1
 */
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_11;

  /* "pandas/algos.pyx":1916
 *     counts = np.zeros(ngroups + 1, dtype=np.int64)
 *     n = len(index)
 *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *         counts[index[i] + 1] += 1
 * 
 */
  __pyx_t_11 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "pandas/algos.pyx":1917
 *     n = len(index)
 *     for i from 0 <= i < n:
 *         counts[index[i] + 1] += 1             # <<<<<<<<<<<<<<
 * 
 *     # mark the start of each contiguous group of like-indexed data
 */
    __pyx_t_12 = __pyx_v_i;
    __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_index.diminfo[0].strides)) + 1);
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;
  }

  /* "pandas/algos.pyx":1920
 * 
 *     # mark the start of each contiguous group of like-indexed data
 *     where = np.zeros(ngroups + 1, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     for i from 1 <= i < ngroups + 1:
 *         where[i] = where[i - 1] + counts[i - 1]
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_ngroups + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_where.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_where.rcbuffer->pybuffer, (PyObject*)__pyx_v_where, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_where.diminfo[0].strides = __pyx_pybuffernd_where.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_where.diminfo[0].shape = __pyx_pybuffernd_where.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_where = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/algos.pyx":1921
 *     # mark the start of each contiguous group of like-indexed data
 *     where = np.zeros(ngroups + 1, dtype=np.int64)
 *     for i from 1 <= i < ngroups + 1:             # <<<<<<<<<<<<<<
 *         where[i] = where[i - 1] + counts[i - 1]
 * 
 */
  __pyx_t_11 = (__pyx_v_ngroups + 1);
  for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "pandas/algos.pyx":1922
 *     where = np.zeros(ngroups + 1, dtype=np.int64)
 *     for i from 1 <= i < ngroups + 1:
 *         where[i] = where[i - 1] + counts[i - 1]             # <<<<<<<<<<<<<<
 * 
 *     # this is our indexer
 */
    __pyx_t_14 = (__pyx_v_i - 1);
    __pyx_t_15 = (__pyx_v_i - 1);
    __pyx_t_16 = __pyx_v_i;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_where.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_where.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_where.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_where.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides)));
  }

  /* "pandas/algos.pyx":1925
 * 
 *     # this is our indexer
 *     result = np.zeros(n, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < n:
 *         label = index[i] + 1
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1926
 *     # this is our indexer
 *     result = np.zeros(n, dtype=np.int64)
 *     for i from 0 <= i < n:             # <<<<<<<<<<<<<<
 *         label = index[i] + 1
 *         result[where[label]] = i
 */
  __pyx_t_11 = __pyx_v_n;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_11; __pyx_v_i++) {

    /* "pandas/algos.pyx":1927
 *     result = np.zeros(n, dtype=np.int64)
 *     for i from 0 <= i < n:
 *         label = index[i] + 1             # <<<<<<<<<<<<<<
 *         result[where[label]] = i
 *         where[label] += 1
 */
    __pyx_t_17 = __pyx_v_i;
    __pyx_v_label = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_index.diminfo[0].strides)) + 1);

    /* "pandas/algos.pyx":1928
 *     for i from 0 <= i < n:
 *         label = index[i] + 1
 *         result[where[label]] = i             # <<<<<<<<<<<<<<
 *         where[label] += 1
 * 
 */
    __pyx_t_18 = __pyx_v_label;
    __pyx_t_19 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_where.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_where.diminfo[0].strides));
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_i;

    /* "pandas/algos.pyx":1929
 *         label = index[i] + 1
 *         result[where[label]] = i
 *         where[label] += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, counts
 */
    __pyx_t_20 = __pyx_v_label;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_where.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_where.diminfo[0].strides) += 1;
  }

  /* "pandas/algos.pyx":1931
 *         where[label] += 1
 * 
 *     return result, counts             # <<<<<<<<<<<<<<
 * 
 * # TODO: aggregate multiple columns in single pass
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1931; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_counts));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_counts));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupsort_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_where.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_counts);
  __Pyx_XDECREF((PyObject *)__pyx_v_where);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_69group_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_68group_add[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_69group_add = {__Pyx_NAMESTR("group_add"), (PyCFunction)__pyx_pw_6pandas_5algos_69group_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_68group_add)};
static PyObject *__pyx_pw_6pandas_5algos_69group_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_add (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_add", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_68group_add(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1937
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_68group_add(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  long __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_add", 0);
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":1949
 *         ndarray[float64_t, ndim=2] sumx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1950
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":1952
 *     sumx = np.zeros_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":1954
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             lab = labels[i]
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":1955
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":1956
 *     if K > 1:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":1957
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1958
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":1960
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":1961
 * 
 *             counts[lab] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":1962
 *             counts[lab] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":1965
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":1966
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[lab, j] += val
 *     else:
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":1967
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":1969
 *                     sumx[lab, j] += val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":1970
 *     else:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":1971
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1972
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L12_continue;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "pandas/algos.pyx":1974
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":1975
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_25 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":1978
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1979
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[lab, 0] += val
 * 
 */
        __pyx_t_26 = __pyx_v_lab;
        __pyx_t_27 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":1980
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
        goto __pyx_L15;
      }
      __pyx_L15:;
      __pyx_L12_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":1982
 *                 sumx[lab, 0] += val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":1983
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_30 = __pyx_v_K;
    for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
      __pyx_v_j = __pyx_t_31;

      /* "pandas/algos.pyx":1984
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_32 = __pyx_v_i;
      __pyx_t_33 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":1985
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = sumx[i, j]
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_35 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "pandas/algos.pyx":1987
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = sumx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_36 = __pyx_v_i;
        __pyx_t_37 = __pyx_v_j;
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_sumx.diminfo[1].strides));
      }
      __pyx_L20:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_71group_prod(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_70group_prod[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_71group_prod = {__Pyx_NAMESTR("group_prod"), (PyCFunction)__pyx_pw_6pandas_5algos_71group_prod, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_70group_prod)};
static PyObject *__pyx_pw_6pandas_5algos_71group_prod(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_prod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_prod") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_prod", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_prod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_70group_prod(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":1992
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_70group_prod(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_prodx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_prodx;
  __Pyx_Buffer __pyx_pybuffer_prodx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  long __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_prod", 0);
  __pyx_pybuffer_prodx.pybuffer.buf = NULL;
  __pyx_pybuffer_prodx.refcount = 0;
  __pyx_pybuffernd_prodx.data = NULL;
  __pyx_pybuffernd_prodx.rcbuffer = &__pyx_pybuffer_prodx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2004
 *         ndarray[float64_t, ndim=2] prodx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     prodx = np.ones_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2004; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2005
 * 
 *     nobs = np.zeros_like(out)
 *     prodx = np.ones_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer, (PyObject*)__pyx_v_prodx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_prodx.diminfo[0].strides = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prodx.diminfo[0].shape = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_prodx.diminfo[1].strides = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_prodx.diminfo[1].shape = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_prodx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2007
 *     prodx = np.ones_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2009
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             lab = labels[i]
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":2010
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2011
 *     if K > 1:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2012
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2013
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":2015
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2016
 * 
 *             counts[lab] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":2017
 *             counts[lab] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2020
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     prodx[lab, j] *= val
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2021
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     prodx[lab, j] *= val
 *     else:
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2022
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     prodx[lab, j] *= val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_prodx.diminfo[1].strides) *= __pyx_v_val;
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2024
 *                     prodx[lab, j] *= val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2025
 *     else:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2026
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2027
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L12_continue;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "pandas/algos.pyx":2029
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2030
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_25 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2033
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 prodx[lab, 0] *= val
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2034
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 prodx[lab, 0] *= val
 * 
 */
        __pyx_t_26 = __pyx_v_lab;
        __pyx_t_27 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2035
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 prodx[lab, 0] *= val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_prodx.diminfo[1].strides) *= __pyx_v_val;
        goto __pyx_L15;
      }
      __pyx_L15:;
      __pyx_L12_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":2037
 *                 prodx[lab, 0] *= val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2038
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_30 = __pyx_v_K;
    for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
      __pyx_v_j = __pyx_t_31;

      /* "pandas/algos.pyx":2039
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_32 = __pyx_v_i;
      __pyx_t_33 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2040
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = prodx[i, j]
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_35 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2042
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = prodx[i, j]             # <<<<<<<<<<<<<<
 * 
 * #----------------------------------------------------------------------
 */
        __pyx_t_36 = __pyx_v_i;
        __pyx_t_37 = __pyx_v_j;
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_prodx.diminfo[1].strides));
      }
      __pyx_L20:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_prod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prodx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_73group_nth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_72group_nth[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_73group_nth = {__Pyx_NAMESTR("group_nth"), (PyCFunction)__pyx_pw_6pandas_5algos_73group_nth, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_72group_nth)};
static PyObject *__pyx_pw_6pandas_5algos_73group_nth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  __pyx_t_5numpy_int64_t __pyx_v_rank;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_nth (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,&__pyx_n_s__rank,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rank)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_nth") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
    __pyx_v_rank = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_rank == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_nth", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_nth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_72group_nth(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels, __pyx_v_rank);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2049
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_72group_nth(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels, __pyx_t_5numpy_int64_t __pyx_v_rank) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_nth", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2062
 *         ndarray[int64_t, ndim=2] nobs
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     resx = np.empty_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2063
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)
 *     resx = np.empty_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2065
 *     resx = np.empty_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     for i in range(N):
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_13;
  __pyx_v_K = __pyx_t_14;

  /* "pandas/algos.pyx":2067
 *     N, K = (<object> values).shape
 * 
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         lab = labels[i]
 *         if lab < 0:
 */
  __pyx_t_14 = __pyx_v_N;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2068
 * 
 *     for i in range(N):
 *         lab = labels[i]             # <<<<<<<<<<<<<<
 *         if lab < 0:
 *             continue
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides));

    /* "pandas/algos.pyx":2069
 *     for i in range(N):
 *         lab = labels[i]
 *         if lab < 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_16 = (__pyx_v_lab < 0);
    if (__pyx_t_16) {

      /* "pandas/algos.pyx":2070
 *         lab = labels[i]
 *         if lab < 0:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         counts[lab] += 1
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/algos.pyx":2072
 *             continue
 * 
 *         counts[lab] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_17 = __pyx_v_lab;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2073
 * 
 *         counts[lab] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2074
 *         counts[lab] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2077
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2078
 *             # not nan
 *             if val == val:
 *                 nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                 if nobs[lab, j] == rank:
 *                     resx[lab, j] = val
 */
        __pyx_t_22 = __pyx_v_lab;
        __pyx_t_23 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1;

        /* "pandas/algos.pyx":2079
 *             if val == val:
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:             # <<<<<<<<<<<<<<
 *                     resx[lab, j] = val
 * 
 */
        __pyx_t_24 = __pyx_v_lab;
        __pyx_t_25 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_nobs.diminfo[1].strides)) == __pyx_v_rank);
        if (__pyx_t_16) {

          /* "pandas/algos.pyx":2080
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:
 *                     resx[lab, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
          __pyx_t_26 = __pyx_v_lab;
          __pyx_t_27 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_resx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L11;
        }
        __pyx_L11:;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L5_continue:;
  }

  /* "pandas/algos.pyx":2082
 *                     resx[lab, j] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2082; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2083
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2084
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_28 = __pyx_v_i;
      __pyx_t_29 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2085
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_30 = __pyx_v_i;
        __pyx_t_31 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2087
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_32 = __pyx_v_i;
        __pyx_t_33 = __pyx_v_j;
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_35 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_resx.diminfo[1].strides));
      }
      __pyx_L16:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_nth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_75group_nth_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_74group_nth_object[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_75group_nth_object = {__Pyx_NAMESTR("group_nth_object"), (PyCFunction)__pyx_pw_6pandas_5algos_75group_nth_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_74group_nth_object)};
static PyObject *__pyx_pw_6pandas_5algos_75group_nth_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  __pyx_t_5numpy_int64_t __pyx_v_rank;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_nth_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,&__pyx_n_s__rank,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_object", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_object", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_object", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rank)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_object", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_nth_object") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
    __pyx_v_rank = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_rank == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2095; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_nth_object", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_nth_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2093; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_74group_nth_object(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels, __pyx_v_rank);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2091
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] counts,
 *                      ndarray[object, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_74group_nth_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels, __pyx_t_5numpy_int64_t __pyx_v_rank) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  PyObject *__pyx_v_val = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  PyArrayObject *__pyx_v_resx = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  PyObject **__pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_nth_object", 0);
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2106
 *         ndarray[object, ndim=2] resx
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2107
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)
 *     resx = np.empty((<object> out).shape, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2109
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     for i in range(N):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_13;
  __pyx_v_K = __pyx_t_14;

  /* "pandas/algos.pyx":2111
 *     N, K = (<object> values).shape
 * 
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         lab = labels[i]
 *         if lab < 0:
 */
  __pyx_t_14 = __pyx_v_N;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2112
 * 
 *     for i in range(N):
 *         lab = labels[i]             # <<<<<<<<<<<<<<
 *         if lab < 0:
 *             continue
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides));

    /* "pandas/algos.pyx":2113
 *     for i in range(N):
 *         lab = labels[i]
 *         if lab < 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_16 = (__pyx_v_lab < 0);
    if (__pyx_t_16) {

      /* "pandas/algos.pyx":2114
 *         lab = labels[i]
 *         if lab < 0:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         counts[lab] += 1
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/algos.pyx":2116
 *             continue
 * 
 *         counts[lab] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_17 = __pyx_v_lab;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2117
 * 
 *         counts[lab] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2118
 *         counts[lab] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __Pyx_XDECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pandas/algos.pyx":2121
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2122
 *             # not nan
 *             if val == val:
 *                 nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                 if nobs[lab, j] == rank:
 *                     resx[lab, j] = val
 */
        __pyx_t_22 = __pyx_v_lab;
        __pyx_t_23 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1;

        /* "pandas/algos.pyx":2123
 *             if val == val:
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:             # <<<<<<<<<<<<<<
 *                     resx[lab, j] = val
 * 
 */
        __pyx_t_24 = __pyx_v_lab;
        __pyx_t_25 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_nobs.diminfo[1].strides)) == __pyx_v_rank);
        if (__pyx_t_16) {

          /* "pandas/algos.pyx":2124
 *                 nobs[lab, j] += 1
 *                 if nobs[lab, j] == rank:
 *                     resx[lab, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
          __pyx_t_26 = __pyx_v_lab;
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_28 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_resx.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_28);
          __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_28);
          *__pyx_t_28 = __pyx_v_val;
          __Pyx_GIVEREF(*__pyx_t_28);
          goto __pyx_L11;
        }
        __pyx_L11:;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L5_continue:;
  }

  /* "pandas/algos.pyx":2126
 *                     resx[lab, j] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2127
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = <object> nan
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2128
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = <object> nan
 *             else:
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_30 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2129
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = <object> nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_6pandas_5algos_nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_31 = __pyx_v_i;
        __pyx_t_32 = __pyx_v_j;
        __pyx_t_28 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_28);
        __Pyx_INCREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(*__pyx_t_28);
        *__pyx_t_28 = ((PyObject *)__pyx_t_2);
        __Pyx_GIVEREF(*__pyx_t_28);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L16;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2131
 *                 out[i, j] = <object> nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_33 = __pyx_v_i;
        __pyx_t_34 = __pyx_v_j;
        __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __pyx_t_35 = __pyx_v_i;
        __pyx_t_36 = __pyx_v_j;
        __pyx_t_28 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_28);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_28);
        *__pyx_t_28 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_28);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L16:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_nth_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_77group_nth_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_76group_nth_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_77group_nth_bin = {__Pyx_NAMESTR("group_nth_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_77group_nth_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_76group_nth_bin)};
static PyObject *__pyx_pw_6pandas_5algos_77group_nth_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  __pyx_t_5numpy_int64_t __pyx_v_rank;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_nth_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,&__pyx_n_s__rank,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rank)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_nth_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
    __pyx_v_rank = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_rank == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_nth_bin", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_nth_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_76group_nth_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins, __pyx_v_rank);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2135
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_76group_nth_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins, __pyx_t_5numpy_int64_t __pyx_v_rank) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_nth_bin", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2147
 *         ndarray[float64_t, ndim=2] resx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     resx = np.empty_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2148
 * 
 *     nobs = np.zeros_like(out)
 *     resx = np.empty_like(out)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2150
 *     resx = np.empty_like(out)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2151
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2153
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2155
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2157
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2158
 * 
 *     b = 0
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2159
 *     b = 0
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *             b += 1
 * 
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
      if (__pyx_t_12) {
        __pyx_t_15 = __pyx_v_b;
        __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
        __pyx_t_17 = __pyx_t_16;
      } else {
        __pyx_t_17 = __pyx_t_12;
      }
      if (!__pyx_t_17) break;

      /* "pandas/algos.pyx":2160
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1             # <<<<<<<<<<<<<<
 * 
 *         counts[b] += 1
 */
      __pyx_v_b = (__pyx_v_b + 1);
    }

    /* "pandas/algos.pyx":2162
 *             b += 1
 * 
 *         counts[b] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_18 = __pyx_v_b;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2163
 * 
 *         counts[b] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_19 = __pyx_v_K;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_j = __pyx_t_20;

      /* "pandas/algos.pyx":2164
 *         counts[b] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_22 = __pyx_v_j;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2167
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:
 */
      __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_17) {

        /* "pandas/algos.pyx":2168
 *             # not nan
 *             if val == val:
 *                 nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                 if nobs[b, j] == rank:
 *                     resx[b, j] = val
 */
        __pyx_t_23 = __pyx_v_b;
        __pyx_t_24 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2169
 *             if val == val:
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:             # <<<<<<<<<<<<<<
 *                     resx[b, j] = val
 * 
 */
        __pyx_t_25 = __pyx_v_b;
        __pyx_t_26 = __pyx_v_j;
        __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[1].strides)) == __pyx_v_rank);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":2170
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:
 *                     resx[b, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
          __pyx_t_27 = __pyx_v_b;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_resx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L13;
        }
        __pyx_L13:;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
  }

  /* "pandas/algos.pyx":2172
 *                     resx[b, j] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2173
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_19 = __pyx_v_K;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_j = __pyx_t_20;

      /* "pandas/algos.pyx":2174
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_30 = __pyx_v_j;
      __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_17) {

        /* "pandas/algos.pyx":2175
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_31 = __pyx_v_i;
        __pyx_t_32 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2177
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_33 = __pyx_v_i;
        __pyx_t_34 = __pyx_v_j;
        __pyx_t_35 = __pyx_v_i;
        __pyx_t_36 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_resx.diminfo[1].strides));
      }
      __pyx_L18:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_nth_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_79group_nth_bin_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_78group_nth_bin_object[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_79group_nth_bin_object = {__Pyx_NAMESTR("group_nth_bin_object"), (PyCFunction)__pyx_pw_6pandas_5algos_79group_nth_bin_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_78group_nth_bin_object)};
static PyObject *__pyx_pw_6pandas_5algos_79group_nth_bin_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  __pyx_t_5numpy_int64_t __pyx_v_rank;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_nth_bin_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,&__pyx_n_s__rank,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin_object", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin_object", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin_object", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rank)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_nth_bin_object", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_nth_bin_object") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
    __pyx_v_rank = __Pyx_PyInt_from_py_npy_int64(values[4]); if (unlikely((__pyx_v_rank == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_nth_bin_object", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_nth_bin_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_78group_nth_bin_object(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins, __pyx_v_rank);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2181
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                          ndarray[int64_t] counts,
 *                          ndarray[object, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_78group_nth_bin_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins, __pyx_t_5numpy_int64_t __pyx_v_rank) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  PyObject *__pyx_v_val = 0;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  PyObject **__pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_nth_bin_object", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2195
 *         ndarray[float64_t, ndim=2] nobs
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.float64)             # <<<<<<<<<<<<<<
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2196
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.float64)
 *     resx = np.empty((<object> out).shape, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2198
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = (__pyx_t_12 - 1);
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_14);
  if (__pyx_t_15) {

    /* "pandas/algos.pyx":2199
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_14;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2201
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_14 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2203
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_16 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_16 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_14;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2205
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2206
 * 
 *     b = 0
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "pandas/algos.pyx":2207
 *     b = 0
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *             b += 1
 * 
 */
    while (1) {
      __pyx_t_15 = (__pyx_v_b < (__pyx_v_ngroups - 1));
      if (__pyx_t_15) {
        __pyx_t_17 = __pyx_v_b;
        __pyx_t_18 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_bins.diminfo[0].strides)));
        __pyx_t_19 = __pyx_t_18;
      } else {
        __pyx_t_19 = __pyx_t_15;
      }
      if (!__pyx_t_19) break;

      /* "pandas/algos.pyx":2208
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1             # <<<<<<<<<<<<<<
 * 
 *         counts[b] += 1
 */
      __pyx_v_b = (__pyx_v_b + 1);
    }

    /* "pandas/algos.pyx":2210
 *             b += 1
 * 
 *         counts[b] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_20 = __pyx_v_b;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2211
 * 
 *         counts[b] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_21 = __pyx_v_K;
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
      __pyx_v_j = __pyx_t_22;

      /* "pandas/algos.pyx":2212
 *         counts[b] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_23 = __pyx_v_i;
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __Pyx_XDECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pandas/algos.pyx":2215
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_19) {

        /* "pandas/algos.pyx":2216
 *             # not nan
 *             if val == val:
 *                 nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                 if nobs[b, j] == rank:
 *                     resx[b, j] = val
 */
        __pyx_t_25 = __pyx_v_b;
        __pyx_t_26 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2217
 *             if val == val:
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:             # <<<<<<<<<<<<<<
 *                     resx[b, j] = val
 * 
 */
        __pyx_t_27 = __pyx_v_b;
        __pyx_t_28 = __pyx_v_j;
        __pyx_t_19 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[1].strides)) == __pyx_v_rank);
        if (__pyx_t_19) {

          /* "pandas/algos.pyx":2218
 *                 nobs[b, j] += 1
 *                 if nobs[b, j] == rank:
 *                     resx[b, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
          __pyx_t_29 = __pyx_v_b;
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_resx.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_31);
          __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_31);
          *__pyx_t_31 = __pyx_v_val;
          __Pyx_GIVEREF(*__pyx_t_31);
          goto __pyx_L13;
        }
        __pyx_L13:;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
  }

  /* "pandas/algos.pyx":2220
 *                     resx[b, j] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = __pyx_v_ngroups;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "pandas/algos.pyx":2221
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_21 = __pyx_v_K;
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
      __pyx_v_j = __pyx_t_22;

      /* "pandas/algos.pyx":2222
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_32 = __pyx_v_i;
      __pyx_t_33 = __pyx_v_j;
      __pyx_t_19 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_19) {

        /* "pandas/algos.pyx":2223
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_6pandas_5algos_nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_35 = __pyx_v_j;
        __pyx_t_31 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_31);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_31);
        *__pyx_t_31 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_31);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2225
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_36 = __pyx_v_i;
        __pyx_t_37 = __pyx_v_j;
        __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        __pyx_t_31 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_31);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_31);
        *__pyx_t_31 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_31);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L18:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_nth_bin_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_81group_last(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_80group_last[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_81group_last = {__Pyx_NAMESTR("group_last"), (PyCFunction)__pyx_pw_6pandas_5algos_81group_last, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_80group_last)};
static PyObject *__pyx_pw_6pandas_5algos_81group_last(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_last (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_last") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_last", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_last", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_80group_last(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_80group_last(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_last", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2242
 *         ndarray[int64_t, ndim=2] nobs
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     resx = np.empty_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2243
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)
 *     resx = np.empty_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2245
 *     resx = np.empty_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     for i in range(N):
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_1 = __pyx_t_12(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_13;
  __pyx_v_K = __pyx_t_14;

  /* "pandas/algos.pyx":2247
 *     N, K = (<object> values).shape
 * 
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         lab = labels[i]
 *         if lab < 0:
 */
  __pyx_t_14 = __pyx_v_N;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2248
 * 
 *     for i in range(N):
 *         lab = labels[i]             # <<<<<<<<<<<<<<
 *         if lab < 0:
 *             continue
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides));

    /* "pandas/algos.pyx":2249
 *     for i in range(N):
 *         lab = labels[i]
 *         if lab < 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_16 = (__pyx_v_lab < 0);
    if (__pyx_t_16) {

      /* "pandas/algos.pyx":2250
 *         lab = labels[i]
 *         if lab < 0:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         counts[lab] += 1
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/algos.pyx":2252
 *             continue
 * 
 *         counts[lab] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_17 = __pyx_v_lab;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2253
 * 
 *         counts[lab] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2254
 *         counts[lab] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2257
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, j] += 1
 *                 resx[lab, j] = val
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2258
 *             # not nan
 *             if val == val:
 *                 nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                 resx[lab, j] = val
 * 
 */
        __pyx_t_22 = __pyx_v_lab;
        __pyx_t_23 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1;

        /* "pandas/algos.pyx":2259
 *             if val == val:
 *                 nobs[lab, j] += 1
 *                 resx[lab, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
        __pyx_t_24 = __pyx_v_lab;
        __pyx_t_25 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_resx.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L5_continue:;
  }

  /* "pandas/algos.pyx":2261
 *                 resx[lab, j] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2262
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2263
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_26 = __pyx_v_i;
      __pyx_t_27 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2264
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_28 = __pyx_v_i;
        __pyx_t_29 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2266
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_30 = __pyx_v_i;
        __pyx_t_31 = __pyx_v_j;
        __pyx_t_32 = __pyx_v_i;
        __pyx_t_33 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_resx.diminfo[1].strides));
      }
      __pyx_L15:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_last", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_83group_last_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_82group_last_object[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_83group_last_object = {__Pyx_NAMESTR("group_last_object"), (PyCFunction)__pyx_pw_6pandas_5algos_83group_last_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_82group_last_object)};
static PyObject *__pyx_pw_6pandas_5algos_83group_last_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_last_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_object", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_object", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_object", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_last_object") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_last_object", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_last_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_82group_last_object(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2270
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                       ndarray[int64_t] counts,
 *                       ndarray[object, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_82group_last_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  PyObject *__pyx_v_val = 0;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  PyObject **__pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_last_object", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2284
 *         ndarray[int64_t, ndim=2] nobs
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2285
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.int64)
 *     resx = np.empty((<object> out).shape, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2287
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     for i in range(N):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_13;
  __pyx_v_K = __pyx_t_14;

  /* "pandas/algos.pyx":2289
 *     N, K = (<object> values).shape
 * 
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         lab = labels[i]
 *         if lab < 0:
 */
  __pyx_t_14 = __pyx_v_N;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2290
 * 
 *     for i in range(N):
 *         lab = labels[i]             # <<<<<<<<<<<<<<
 *         if lab < 0:
 *             continue
 */
    __pyx_t_15 = __pyx_v_i;
    __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_labels.diminfo[0].strides));

    /* "pandas/algos.pyx":2291
 *     for i in range(N):
 *         lab = labels[i]
 *         if lab < 0:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_16 = (__pyx_v_lab < 0);
    if (__pyx_t_16) {

      /* "pandas/algos.pyx":2292
 *         lab = labels[i]
 *         if lab < 0:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         counts[lab] += 1
 */
      goto __pyx_L5_continue;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/algos.pyx":2294
 *             continue
 * 
 *         counts[lab] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_17 = __pyx_v_lab;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2295
 * 
 *         counts[lab] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2296
 *         counts[lab] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __Pyx_XDECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pandas/algos.pyx":2299
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, j] += 1
 *                 resx[lab, j] = val
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2300
 *             # not nan
 *             if val == val:
 *                 nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                 resx[lab, j] = val
 * 
 */
        __pyx_t_22 = __pyx_v_lab;
        __pyx_t_23 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1;

        /* "pandas/algos.pyx":2301
 *             if val == val:
 *                 nobs[lab, j] += 1
 *                 resx[lab, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
        __pyx_t_24 = __pyx_v_lab;
        __pyx_t_25 = __pyx_v_j;
        __pyx_t_26 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_v_val;
        __Pyx_GIVEREF(*__pyx_t_26);
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L5_continue:;
  }

  /* "pandas/algos.pyx":2303
 *                 resx[lab, j] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "pandas/algos.pyx":2304
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_18 = __pyx_v_K;
    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
      __pyx_v_j = __pyx_t_19;

      /* "pandas/algos.pyx":2305
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2306
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_6pandas_5algos_nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_29 = __pyx_v_i;
        __pyx_t_30 = __pyx_v_j;
        __pyx_t_26 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_26);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2308
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_31 = __pyx_v_i;
        __pyx_t_32 = __pyx_v_j;
        __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __pyx_t_33 = __pyx_v_i;
        __pyx_t_34 = __pyx_v_j;
        __pyx_t_26 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_26);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L15:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_last_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_85group_last_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_84group_last_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_85group_last_bin = {__Pyx_NAMESTR("group_last_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_85group_last_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_84group_last_bin)};
static PyObject *__pyx_pw_6pandas_5algos_85group_last_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_last_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_last_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_last_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_last_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_84group_last_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2313
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_84group_last_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_last_bin", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2325
 *         ndarray[float64_t, ndim=2] resx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     resx = np.empty_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2326
 * 
 *     nobs = np.zeros_like(out)
 *     resx = np.empty_like(out)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2328
 *     resx = np.empty_like(out)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2329
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2331
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2333
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2335
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2336
 * 
 *     b = 0
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1
 */
  __pyx_t_9 = __pyx_v_N;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2337
 *     b = 0
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *             b += 1
 * 
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
      if (__pyx_t_12) {
        __pyx_t_15 = __pyx_v_b;
        __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
        __pyx_t_17 = __pyx_t_16;
      } else {
        __pyx_t_17 = __pyx_t_12;
      }
      if (!__pyx_t_17) break;

      /* "pandas/algos.pyx":2338
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1             # <<<<<<<<<<<<<<
 * 
 *         counts[b] += 1
 */
      __pyx_v_b = (__pyx_v_b + 1);
    }

    /* "pandas/algos.pyx":2340
 *             b += 1
 * 
 *         counts[b] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_18 = __pyx_v_b;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2341
 * 
 *         counts[b] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_19 = __pyx_v_K;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_j = __pyx_t_20;

      /* "pandas/algos.pyx":2342
 *         counts[b] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_21 = __pyx_v_i;
      __pyx_t_22 = __pyx_v_j;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2345
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, j] += 1
 *                 resx[b, j] = val
 */
      __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_17) {

        /* "pandas/algos.pyx":2346
 *             # not nan
 *             if val == val:
 *                 nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                 resx[b, j] = val
 * 
 */
        __pyx_t_23 = __pyx_v_b;
        __pyx_t_24 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2347
 *             if val == val:
 *                 nobs[b, j] += 1
 *                 resx[b, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_25 = __pyx_v_b;
        __pyx_t_26 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_resx.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
  }

  /* "pandas/algos.pyx":2349
 *                 resx[b, j] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2350
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_19 = __pyx_v_K;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
      __pyx_v_j = __pyx_t_20;

      /* "pandas/algos.pyx":2351
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_17) {

        /* "pandas/algos.pyx":2352
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_29 = __pyx_v_i;
        __pyx_t_30 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L17;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2354
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_31 = __pyx_v_i;
        __pyx_t_32 = __pyx_v_j;
        __pyx_t_33 = __pyx_v_i;
        __pyx_t_34 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_resx.diminfo[1].strides));
      }
      __pyx_L17:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_last_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_87group_last_bin_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_86group_last_bin_object[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_87group_last_bin_object = {__Pyx_NAMESTR("group_last_bin_object"), (PyCFunction)__pyx_pw_6pandas_5algos_87group_last_bin_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_86group_last_bin_object)};
static PyObject *__pyx_pw_6pandas_5algos_87group_last_bin_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_last_bin_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin_object", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin_object", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_last_bin_object", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_last_bin_object") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_last_bin_object", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_last_bin_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_86group_last_bin_object(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2358
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                           ndarray[int64_t] counts,
 *                           ndarray[object, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_86group_last_bin_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  PyObject *__pyx_v_val = 0;
  PyArrayObject *__pyx_v_resx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_resx;
  __Pyx_Buffer __pyx_pybuffer_resx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyArrayObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  PyObject *(*__pyx_t_16)(PyObject *);
  Py_ssize_t __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  PyObject **__pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_last_bin_object", 0);
  __pyx_pybuffer_resx.pybuffer.buf = NULL;
  __pyx_pybuffer_resx.refcount = 0;
  __pyx_pybuffernd_resx.data = NULL;
  __pyx_pybuffernd_resx.rcbuffer = &__pyx_pybuffer_resx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2372
 *         ndarray[float64_t, ndim=2] nobs
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.float64)             # <<<<<<<<<<<<<<
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/algos.pyx":2373
 * 
 *     nobs = np.zeros((<object> out).shape, dtype=np.float64)
 *     resx = np.empty((<object> out).shape, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_out), __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_resx.rcbuffer->pybuffer, (PyObject*)__pyx_v_resx, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_resx.diminfo[0].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resx.diminfo[0].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resx.diminfo[1].strides = __pyx_pybuffernd_resx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resx.diminfo[1].shape = __pyx_pybuffernd_resx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_11 = 0;
  __pyx_v_resx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2375
 *     resx = np.empty((<object> out).shape, dtype=object)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = (__pyx_t_12 - 1);
  __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_14);
  if (__pyx_t_15) {

    /* "pandas/algos.pyx":2376
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_14;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2378
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_14 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_14 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2380
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_16 = Py_TYPE(__pyx_t_1)->tp_iternext;
    index = 0; __pyx_t_5 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 1; __pyx_t_3 = __pyx_t_16(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_16 = NULL;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_16 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_14;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2382
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2383
 * 
 *     b = 0
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1
 */
  __pyx_t_12 = __pyx_v_N;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "pandas/algos.pyx":2384
 *     b = 0
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *             b += 1
 * 
 */
    while (1) {
      __pyx_t_15 = (__pyx_v_b < (__pyx_v_ngroups - 1));
      if (__pyx_t_15) {
        __pyx_t_17 = __pyx_v_b;
        __pyx_t_18 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_bins.diminfo[0].strides)));
        __pyx_t_19 = __pyx_t_18;
      } else {
        __pyx_t_19 = __pyx_t_15;
      }
      if (!__pyx_t_19) break;

      /* "pandas/algos.pyx":2385
 *     for i in range(N):
 *         while b < ngroups - 1 and i >= bins[b]:
 *             b += 1             # <<<<<<<<<<<<<<
 * 
 *         counts[b] += 1
 */
      __pyx_v_b = (__pyx_v_b + 1);
    }

    /* "pandas/algos.pyx":2387
 *             b += 1
 * 
 *         counts[b] += 1             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             val = values[i, j]
 */
    __pyx_t_20 = __pyx_v_b;
    *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

    /* "pandas/algos.pyx":2388
 * 
 *         counts[b] += 1
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             val = values[i, j]
 * 
 */
    __pyx_t_21 = __pyx_v_K;
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
      __pyx_v_j = __pyx_t_22;

      /* "pandas/algos.pyx":2389
 *         counts[b] += 1
 *         for j in range(K):
 *             val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_23 = __pyx_v_i;
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_values.diminfo[1].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __Pyx_XDECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pandas/algos.pyx":2392
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, j] += 1
 *                 resx[b, j] = val
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_19) {

        /* "pandas/algos.pyx":2393
 *             # not nan
 *             if val == val:
 *                 nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                 resx[b, j] = val
 * 
 */
        __pyx_t_25 = __pyx_v_b;
        __pyx_t_26 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2394
 *             if val == val:
 *                 nobs[b, j] += 1
 *                 resx[b, j] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_27 = __pyx_v_b;
        __pyx_t_28 = __pyx_v_j;
        __pyx_t_29 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_29);
        __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_29);
        *__pyx_t_29 = __pyx_v_val;
        __Pyx_GIVEREF(*__pyx_t_29);
        goto __pyx_L12;
      }
      __pyx_L12:;
    }
  }

  /* "pandas/algos.pyx":2396
 *                 resx[b, j] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = __pyx_v_ngroups;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "pandas/algos.pyx":2397
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_21 = __pyx_v_K;
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
      __pyx_v_j = __pyx_t_22;

      /* "pandas/algos.pyx":2398
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_30 = __pyx_v_i;
      __pyx_t_31 = __pyx_v_j;
      __pyx_t_19 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_19) {

        /* "pandas/algos.pyx":2399
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = resx[i, j]
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_6pandas_5algos_nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_32 = __pyx_v_i;
        __pyx_t_33 = __pyx_v_j;
        __pyx_t_29 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_29);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_29);
        *__pyx_t_29 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_29);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L17;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2401
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = resx[i, j]             # <<<<<<<<<<<<<<
 * 
 * #----------------------------------------------------------------------
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_35 = __pyx_v_j;
        __pyx_t_2 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_resx.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_resx.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_resx.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_2);
        __pyx_t_36 = __pyx_v_i;
        __pyx_t_37 = __pyx_v_j;
        __pyx_t_29 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_out.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_29);
        __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(*__pyx_t_29);
        *__pyx_t_29 = __pyx_t_2;
        __Pyx_GIVEREF(*__pyx_t_29);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L17:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_last_bin_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_resx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF((PyObject *)__pyx_v_resx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_89group_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_88group_min[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_89group_min = {__Pyx_NAMESTR("group_min"), (PyCFunction)__pyx_pw_6pandas_5algos_89group_min, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_88group_min)};
static PyObject *__pyx_pw_6pandas_5algos_89group_min(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_min (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_min") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_min", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_88group_min(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2409
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_88group_min(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_minx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_minx;
  __Pyx_Buffer __pyx_pybuffer_minx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  long __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  long __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_min", 0);
  __pyx_pybuffer_minx.pybuffer.buf = NULL;
  __pyx_pybuffer_minx.refcount = 0;
  __pyx_pybuffernd_minx.data = NULL;
  __pyx_pybuffernd_minx.rcbuffer = &__pyx_pybuffer_minx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2421
 *         ndarray[float64_t, ndim=2] minx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     minx = np.empty_like(out)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2423
 *     nobs = np.zeros_like(out)
 * 
 *     minx = np.empty_like(out)             # <<<<<<<<<<<<<<
 *     minx.fill(np.inf)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minx.rcbuffer->pybuffer, (PyObject*)__pyx_v_minx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_minx.diminfo[0].strides = __pyx_pybuffernd_minx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_minx.diminfo[0].shape = __pyx_pybuffernd_minx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_minx.diminfo[1].strides = __pyx_pybuffernd_minx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_minx.diminfo[1].shape = __pyx_pybuffernd_minx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_minx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2424
 * 
 *     minx = np.empty_like(out)
 *     minx.fill(np.inf)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_minx), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":2426
 *     minx.fill(np.inf)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2428
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             lab = labels[i]
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":2429
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2430
 *     if K > 1:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2431
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2432
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":2434
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2435
 * 
 *             counts[lab] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":2436
 *             counts[lab] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2439
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     if val < minx[lab, j]:
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2440
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     if val < minx[lab, j]:
 *                         minx[lab, j] = val
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2441
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     if val < minx[lab, j]:             # <<<<<<<<<<<<<<
 *                         minx[lab, j] = val
 *     else:
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          __pyx_t_13 = (__pyx_v_val < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_minx.diminfo[1].strides)));
          if (__pyx_t_13) {

            /* "pandas/algos.pyx":2442
 *                     nobs[lab, j] += 1
 *                     if val < minx[lab, j]:
 *                         minx[lab, j] = val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
            __pyx_t_24 = __pyx_v_lab;
            __pyx_t_25 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_minx.diminfo[1].strides) = __pyx_v_val;
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2444
 *                         minx[lab, j] = val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2445
 *     else:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2446
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2447
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L13_continue;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/algos.pyx":2449
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2450
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_26 = __pyx_v_i;
      __pyx_t_27 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2453
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 if val < minx[lab, 0]:
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2454
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 if val < minx[lab, 0]:
 *                     minx[lab, 0] = val
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2455
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 if val < minx[lab, 0]:             # <<<<<<<<<<<<<<
 *                     minx[lab, 0] = val
 * 
 */
        __pyx_t_30 = __pyx_v_lab;
        __pyx_t_31 = 0;
        __pyx_t_13 = (__pyx_v_val < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_minx.diminfo[1].strides)));
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2456
 *                 nobs[lab, 0] += 1
 *                 if val < minx[lab, 0]:
 *                     minx[lab, 0] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
          __pyx_t_32 = __pyx_v_lab;
          __pyx_t_33 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_minx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L17;
        }
        __pyx_L17:;
        goto __pyx_L16;
      }
      __pyx_L16:;
      __pyx_L13_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":2458
 *                     minx[lab, 0] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2459
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_34 = __pyx_v_K;
    for (__pyx_t_35 = 0; __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
      __pyx_v_j = __pyx_t_35;

      /* "pandas/algos.pyx":2460
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_t_37 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2461
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = minx[i, j]
 */
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L22;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2463
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = minx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_40 = __pyx_v_i;
        __pyx_t_41 = __pyx_v_j;
        __pyx_t_42 = __pyx_v_i;
        __pyx_t_43 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_minx.diminfo[1].strides));
      }
      __pyx_L22:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_minx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_91group_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_90group_max[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_91group_max = {__Pyx_NAMESTR("group_max"), (PyCFunction)__pyx_pw_6pandas_5algos_91group_max, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_90group_max)};
static PyObject *__pyx_pw_6pandas_5algos_91group_max(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_max (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_max") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_max", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_90group_max(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2468
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_90group_max(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_maxx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_maxx;
  __Pyx_Buffer __pyx_pybuffer_maxx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  long __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  long __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_max", 0);
  __pyx_pybuffer_maxx.pybuffer.buf = NULL;
  __pyx_pybuffer_maxx.refcount = 0;
  __pyx_pybuffernd_maxx.data = NULL;
  __pyx_pybuffernd_maxx.rcbuffer = &__pyx_pybuffer_maxx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2480
 *         ndarray[float64_t, ndim=2] maxx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     maxx = np.empty_like(out)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2482
 *     nobs = np.zeros_like(out)
 * 
 *     maxx = np.empty_like(out)             # <<<<<<<<<<<<<<
 *     maxx.fill(-np.inf)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer, (PyObject*)__pyx_v_maxx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_maxx.diminfo[0].strides = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_maxx.diminfo[0].shape = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_maxx.diminfo[1].strides = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_maxx.diminfo[1].shape = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_maxx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2483
 * 
 *     maxx = np.empty_like(out)
 *     maxx.fill(-np.inf)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_maxx), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2485
 *     maxx.fill(-np.inf)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2487
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             lab = labels[i]
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":2488
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2489
 *     if K > 1:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2490
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2491
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":2493
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2494
 * 
 *             counts[lab] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":2495
 *             counts[lab] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2498
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     if val > maxx[lab, j]:
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2499
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     if val > maxx[lab, j]:
 *                         maxx[lab, j] = val
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2500
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     if val > maxx[lab, j]:             # <<<<<<<<<<<<<<
 *                         maxx[lab, j] = val
 *     else:
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          __pyx_t_13 = (__pyx_v_val > (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_maxx.diminfo[1].strides)));
          if (__pyx_t_13) {

            /* "pandas/algos.pyx":2501
 *                     nobs[lab, j] += 1
 *                     if val > maxx[lab, j]:
 *                         maxx[lab, j] = val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
            __pyx_t_24 = __pyx_v_lab;
            __pyx_t_25 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_maxx.diminfo[1].strides) = __pyx_v_val;
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2503
 *                         maxx[lab, j] = val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2504
 *     else:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2505
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2506
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L13_continue;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/algos.pyx":2508
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2509
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_26 = __pyx_v_i;
      __pyx_t_27 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2512
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 if val > maxx[lab, 0]:
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2513
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 if val > maxx[lab, 0]:
 *                     maxx[lab, 0] = val
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2514
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 if val > maxx[lab, 0]:             # <<<<<<<<<<<<<<
 *                     maxx[lab, 0] = val
 * 
 */
        __pyx_t_30 = __pyx_v_lab;
        __pyx_t_31 = 0;
        __pyx_t_13 = (__pyx_v_val > (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_maxx.diminfo[1].strides)));
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2515
 *                 nobs[lab, 0] += 1
 *                 if val > maxx[lab, 0]:
 *                     maxx[lab, 0] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
          __pyx_t_32 = __pyx_v_lab;
          __pyx_t_33 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_maxx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L17;
        }
        __pyx_L17:;
        goto __pyx_L16;
      }
      __pyx_L16:;
      __pyx_L13_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":2517
 *                     maxx[lab, 0] = val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2518
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_34 = __pyx_v_K;
    for (__pyx_t_35 = 0; __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
      __pyx_v_j = __pyx_t_35;

      /* "pandas/algos.pyx":2519
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_t_37 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2520
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = maxx[i, j]
 */
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L22;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2522
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = maxx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_40 = __pyx_v_i;
        __pyx_t_41 = __pyx_v_j;
        __pyx_t_42 = __pyx_v_i;
        __pyx_t_43 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_maxx.diminfo[1].strides));
      }
      __pyx_L22:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_maxx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_93group_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_93group_mean = {__Pyx_NAMESTR("group_mean"), (PyCFunction)__pyx_pw_6pandas_5algos_93group_mean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_93group_mean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_mean (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_mean") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_mean", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_92group_mean(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2527
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_mean(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_92group_mean(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_count;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  long __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  __pyx_t_5numpy_float64_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_mean", 0);
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2536
 *         ndarray[float64_t, ndim=2] sumx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2537
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2539
 *     sumx = np.zeros_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2541
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             lab = labels[i]
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":2542
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2543
 *     if K > 1:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2544
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2545
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":2547
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2548
 * 
 *             counts[lab] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 *                 # not nan
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":2549
 *             counts[lab] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 *                 # not nan
 *                 if val == val:
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2551
 *                 val = values[i, j]
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2552
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[lab, j] += val
 *     else:
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2553
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2555
 *                     sumx[lab, j] += val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             lab = labels[i]
 *             if lab < 0:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2556
 *     else:
 *         for i in range(N):
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2557
 *         for i in range(N):
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2558
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L12_continue;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "pandas/algos.pyx":2560
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 *             # not nan
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2561
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 *             # not nan
 *             if val == val:
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_25 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2563
 *             val = values[i, 0]
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2564
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[lab, 0] += val
 * 
 */
        __pyx_t_26 = __pyx_v_lab;
        __pyx_t_27 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2565
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(counts)):
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
        goto __pyx_L15;
      }
      __pyx_L15:;
      __pyx_L12_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":2567
 *                 sumx[lab, 0] += val
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             count = nobs[i, j]
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2568
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:
 */
    __pyx_t_30 = __pyx_v_K;
    for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
      __pyx_v_j = __pyx_t_31;

      /* "pandas/algos.pyx":2569
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             count = nobs[i, j]             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
      __pyx_t_32 = __pyx_v_i;
      __pyx_t_33 = __pyx_v_j;
      __pyx_v_count = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_nobs.diminfo[1].strides));

      /* "pandas/algos.pyx":2570
 *         for j in range(K):
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_34 = __pyx_v_i;
      __pyx_t_35 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2571
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = sumx[i, j] / count
 */
        __pyx_t_36 = __pyx_v_i;
        __pyx_t_37 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2573
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = sumx[i, j] / count             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        __pyx_t_40 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_sumx.diminfo[1].strides));
        if (unlikely(__pyx_v_count == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = (__pyx_t_40 / __pyx_v_count);
      }
      __pyx_L20:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_mean", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_95group_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_94group_median[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_95group_median = {__Pyx_NAMESTR("group_median"), (PyCFunction)__pyx_pw_6pandas_5algos_95group_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_94group_median)};
static PyObject *__pyx_pw_6pandas_5algos_95group_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_median (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_median", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_median", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_median", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_median", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_94group_median(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2576
 * 
 * 
 * def group_median(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                  ndarray[int64_t] counts,
 *                  ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_94group_median(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_size;
  PyArrayObject *__pyx_v__counts = 0;
  PyArrayObject *__pyx_v_data = 0;
  __pyx_t_5numpy_float64_t *__pyx_v_ptr;
  PyObject *__pyx_v_indexer = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd__counts;
  __Pyx_Buffer __pyx_pybuffer__counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  Py_ssize_t __pyx_t_7;
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  long __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_median", 0);
  __pyx_pybuffer__counts.pybuffer.buf = NULL;
  __pyx_pybuffer__counts.refcount = 0;
  __pyx_pybuffernd__counts.data = NULL;
  __pyx_pybuffernd__counts.rcbuffer = &__pyx_pybuffer__counts;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2588
 *         ndarray data
 *         float64_t* ptr
 *     ngroups = len(counts)             # <<<<<<<<<<<<<<
 *     N, K = (<object> values).shape
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_ngroups = __pyx_t_1;

  /* "pandas/algos.pyx":2589
 *         float64_t* ptr
 *     ngroups = len(counts)
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     indexer, _counts = groupsort_indexer(labels, ngroups)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_N = __pyx_t_1;
  __pyx_v_K = __pyx_t_7;

  /* "pandas/algos.pyx":2591
 *     N, K = (<object> values).shape
 * 
 *     indexer, _counts = groupsort_indexer(labels, ngroups)             # <<<<<<<<<<<<<<
 *     counts[:] = _counts[1:]
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_ngroups); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_labels));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_labels));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_indexer = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__counts.rcbuffer->pybuffer);
    __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd__counts.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__counts.rcbuffer->pybuffer, (PyObject*)__pyx_v__counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
    }
    __pyx_pybuffernd__counts.diminfo[0].strides = __pyx_pybuffernd__counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__counts.diminfo[0].shape = __pyx_pybuffernd__counts.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_8 = 0;
  __pyx_v__counts = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2592
 * 
 *     indexer, _counts = groupsort_indexer(labels, ngroups)
 *     counts[:] = _counts[1:]             # <<<<<<<<<<<<<<
 * 
 *     data = np.empty((K, N), dtype=np.float64)
 */
  __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v__counts), 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_counts), 0, PY_SSIZE_T_MAX, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pandas/algos.pyx":2594
 *     counts[:] = _counts[1:]
 * 
 *     data = np.empty((K, N), dtype=np.float64)             # <<<<<<<<<<<<<<
 *     ptr = <float64_t*> data.data
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_K); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_N); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_data = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/algos.pyx":2595
 * 
 *     data = np.empty((K, N), dtype=np.float64)
 *     ptr = <float64_t*> data.data             # <<<<<<<<<<<<<<
 * 
 *     take_2d_axis1_float64(values.T, indexer, out=data)
 */
  __pyx_v_ptr = ((__pyx_t_5numpy_float64_t *)__pyx_v_data->data);

  /* "pandas/algos.pyx":2597
 *     ptr = <float64_t*> data.data
 * 
 *     take_2d_axis1_float64(values.T, indexer, out=data)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(K):
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s_44); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__T); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_indexer);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_indexer);
  __Pyx_GIVEREF(__pyx_v_indexer);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_v_data)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2599
 *     take_2d_axis1_float64(values.T, indexer, out=data)
 * 
 *     for i in range(K):             # <<<<<<<<<<<<<<
 *         # exclude NA group
 *         ptr += _counts[0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_7; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "pandas/algos.pyx":2601
 *     for i in range(K):
 *         # exclude NA group
 *         ptr += _counts[0]             # <<<<<<<<<<<<<<
 *         for j in range(ngroups):
 *             size = _counts[j + 1]
 */
    __pyx_t_14 = 0;
    __pyx_t_9 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd__counts.diminfo[0].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_9 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd__counts.diminfo[0].shape)) __pyx_t_9 = 0;
    if (unlikely(__pyx_t_9 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_9);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_ptr = (__pyx_v_ptr + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd__counts.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd__counts.diminfo[0].strides)));

    /* "pandas/algos.pyx":2602
 *         # exclude NA group
 *         ptr += _counts[0]
 *         for j in range(ngroups):             # <<<<<<<<<<<<<<
 *             size = _counts[j + 1]
 *             out[j, i] = _median_linear(ptr, size)
 */
    __pyx_t_15 = __pyx_v_ngroups;
    for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
      __pyx_v_j = __pyx_t_16;

      /* "pandas/algos.pyx":2603
 *         ptr += _counts[0]
 *         for j in range(ngroups):
 *             size = _counts[j + 1]             # <<<<<<<<<<<<<<
 *             out[j, i] = _median_linear(ptr, size)
 *             ptr += size
 */
      __pyx_t_17 = (__pyx_v_j + 1);
      __pyx_t_9 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd__counts.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd__counts.diminfo[0].shape)) __pyx_t_9 = 0;
      if (unlikely(__pyx_t_9 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_9);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2603; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_size = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd__counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd__counts.diminfo[0].strides));

      /* "pandas/algos.pyx":2604
 *         for j in range(ngroups):
 *             size = _counts[j + 1]
 *             out[j, i] = _median_linear(ptr, size)             # <<<<<<<<<<<<<<
 *             ptr += size
 * 
 */
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_19 = __pyx_v_i;
      __pyx_t_9 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_out.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_9 = 0;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_out.diminfo[1].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 1;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_out.diminfo[1].shape)) __pyx_t_9 = 1;
      if (unlikely(__pyx_t_9 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_9);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_f_6pandas_5algos__median_linear(__pyx_v_ptr, __pyx_v_size);

      /* "pandas/algos.pyx":2605
 *             size = _counts[j + 1]
 *             out[j, i] = _median_linear(ptr, size)
 *             ptr += size             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_ptr = (__pyx_v_ptr + __pyx_v_size);
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_median", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v__counts);
  __Pyx_XDECREF((PyObject *)__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2608
 * 
 * 
 * cdef inline float64_t _median_linear(float64_t* a, int n):             # <<<<<<<<<<<<<<
 *     cdef int i, j, na_count = 0
 *     cdef float64_t result
 */

static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_6pandas_5algos__median_linear(__pyx_t_5numpy_float64_t *__pyx_v_a, int __pyx_v_n) {
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_na_count;
  __pyx_t_5numpy_float64_t __pyx_v_result;
  __pyx_t_5numpy_float64_t *__pyx_v_tmp;
  __pyx_t_5numpy_float64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __pyx_t_5numpy_float64_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_median_linear", 0);

  /* "pandas/algos.pyx":2609
 * 
 * cdef inline float64_t _median_linear(float64_t* a, int n):
 *     cdef int i, j, na_count = 0             # <<<<<<<<<<<<<<
 *     cdef float64_t result
 *     cdef float64_t* tmp
 */
  __pyx_v_na_count = 0;

  /* "pandas/algos.pyx":2614
 * 
 *     # count NAs
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         if a[i] != a[i]:
 *             na_count += 1
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "pandas/algos.pyx":2615
 *     # count NAs
 *     for i in range(n):
 *         if a[i] != a[i]:             # <<<<<<<<<<<<<<
 *             na_count += 1
 * 
 */
    __pyx_t_3 = ((__pyx_v_a[__pyx_v_i]) != (__pyx_v_a[__pyx_v_i]));
    if (__pyx_t_3) {

      /* "pandas/algos.pyx":2616
 *     for i in range(n):
 *         if a[i] != a[i]:
 *             na_count += 1             # <<<<<<<<<<<<<<
 * 
 *     if na_count:
 */
      __pyx_v_na_count = (__pyx_v_na_count + 1);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }

  /* "pandas/algos.pyx":2618
 *             na_count += 1
 * 
 *     if na_count:             # <<<<<<<<<<<<<<
 *         if na_count == n:
 *             return NaN
 */
  if (__pyx_v_na_count) {

    /* "pandas/algos.pyx":2619
 * 
 *     if na_count:
 *         if na_count == n:             # <<<<<<<<<<<<<<
 *             return NaN
 * 
 */
    __pyx_t_3 = (__pyx_v_na_count == __pyx_v_n);
    if (__pyx_t_3) {

      /* "pandas/algos.pyx":2620
 *     if na_count:
 *         if na_count == n:
 *             return NaN             # <<<<<<<<<<<<<<
 * 
 *         tmp = <float64_t*> malloc((n - na_count) * sizeof(float64_t))
 */
      __pyx_r = __pyx_v_6pandas_5algos_NaN;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "pandas/algos.pyx":2622
 *             return NaN
 * 
 *         tmp = <float64_t*> malloc((n - na_count) * sizeof(float64_t))             # <<<<<<<<<<<<<<
 * 
 *         j = 0
 */
    __pyx_v_tmp = ((__pyx_t_5numpy_float64_t *)malloc(((__pyx_v_n - __pyx_v_na_count) * (sizeof(__pyx_t_5numpy_float64_t)))));

    /* "pandas/algos.pyx":2624
 *         tmp = <float64_t*> malloc((n - na_count) * sizeof(float64_t))
 * 
 *         j = 0             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             if a[i] == a[i]:
 */
    __pyx_v_j = 0;

    /* "pandas/algos.pyx":2625
 * 
 *         j = 0
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             if a[i] == a[i]:
 *                 tmp[j] = a[i]
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
      __pyx_v_i = __pyx_t_2;

      /* "pandas/algos.pyx":2626
 *         j = 0
 *         for i in range(n):
 *             if a[i] == a[i]:             # <<<<<<<<<<<<<<
 *                 tmp[j] = a[i]
 *                 j += 1
 */
      __pyx_t_3 = ((__pyx_v_a[__pyx_v_i]) == (__pyx_v_a[__pyx_v_i]));
      if (__pyx_t_3) {

        /* "pandas/algos.pyx":2627
 *         for i in range(n):
 *             if a[i] == a[i]:
 *                 tmp[j] = a[i]             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        (__pyx_v_tmp[__pyx_v_j]) = (__pyx_v_a[__pyx_v_i]);

        /* "pandas/algos.pyx":2628
 *             if a[i] == a[i]:
 *                 tmp[j] = a[i]
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *         a = tmp
 */
        __pyx_v_j = (__pyx_v_j + 1);
        goto __pyx_L10;
      }
      __pyx_L10:;
    }

    /* "pandas/algos.pyx":2630
 *                 j += 1
 * 
 *         a = tmp             # <<<<<<<<<<<<<<
 *         n -= na_count
 * 
 */
    __pyx_v_a = __pyx_v_tmp;

    /* "pandas/algos.pyx":2631
 * 
 *         a = tmp
 *         n -= na_count             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_n = (__pyx_v_n - __pyx_v_na_count);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2634
 * 
 * 
 *     if n % 2:             # <<<<<<<<<<<<<<
 *         result = kth_smallest_c(a, n / 2, n)
 *     else:
 */
  __pyx_t_4 = __Pyx_mod_long(__pyx_v_n, 2);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":2635
 * 
 *     if n % 2:
 *         result = kth_smallest_c(a, n / 2, n)             # <<<<<<<<<<<<<<
 *     else:
 *         result = (kth_smallest_c(a, n / 2, n) +
 */
    __pyx_t_5 = __pyx_f_6pandas_5algos_kth_smallest_c(__pyx_v_a, __Pyx_div_long(__pyx_v_n, 2), __pyx_v_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = __pyx_t_6;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2637
 *         result = kth_smallest_c(a, n / 2, n)
 *     else:
 *         result = (kth_smallest_c(a, n / 2, n) +             # <<<<<<<<<<<<<<
 *                   kth_smallest_c(a, n / 2 - 1, n)) / 2
 * 
 */
    __pyx_t_5 = __pyx_f_6pandas_5algos_kth_smallest_c(__pyx_v_a, __Pyx_div_long(__pyx_v_n, 2), __pyx_v_n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "pandas/algos.pyx":2638
 *     else:
 *         result = (kth_smallest_c(a, n / 2, n) +
 *                   kth_smallest_c(a, n / 2 - 1, n)) / 2             # <<<<<<<<<<<<<<
 * 
 *     if na_count:
 */
    __pyx_t_7 = __pyx_f_6pandas_5algos_kth_smallest_c(__pyx_v_a, (__Pyx_div_long(__pyx_v_n, 2) - 1), __pyx_v_n); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_int_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_result = __pyx_t_6;
  }
  __pyx_L11:;

  /* "pandas/algos.pyx":2640
 *                   kth_smallest_c(a, n / 2 - 1, n)) / 2
 * 
 *     if na_count:             # <<<<<<<<<<<<<<
 *         free(a)
 * 
 */
  if (__pyx_v_na_count) {

    /* "pandas/algos.pyx":2641
 * 
 *     if na_count:
 *         free(a)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    free(__pyx_v_a);
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "pandas/algos.pyx":2643
 *         free(a)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("pandas.algos._median_linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_97group_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_97group_var = {__Pyx_NAMESTR("group_var"), (PyCFunction)__pyx_pw_6pandas_5algos_97group_var, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_97group_var(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_var (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__labels,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_var") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_labels = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_var", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_96group_var(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2648
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_96group_var(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_labels) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_lab;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_ct;
  PyArrayObject *__pyx_v_nobs = 0;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_sumxx = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_labels;
  __Pyx_Buffer __pyx_pybuffer_labels;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumxx;
  __Pyx_Buffer __pyx_pybuffer_sumxx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  long __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  long __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  __pyx_t_5numpy_float64_t __pyx_t_46;
  __pyx_t_5numpy_float64_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_var", 0);
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_sumxx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumxx.refcount = 0;
  __pyx_pybuffernd_sumxx.data = NULL;
  __pyx_pybuffernd_sumxx.rcbuffer = &__pyx_pybuffer_sumxx;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_labels.pybuffer.buf = NULL;
  __pyx_pybuffer_labels.refcount = 0;
  __pyx_pybuffernd_labels.data = NULL;
  __pyx_pybuffernd_labels.rcbuffer = &__pyx_pybuffer_labels;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2657
 *         ndarray[float64_t, ndim=2] nobs, sumx, sumxx
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 *     sumxx = np.zeros_like(out)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2658
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumxx = np.zeros_like(out)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2659
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)
 *     sumxx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumxx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_sumxx.diminfo[0].strides = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumxx.diminfo[0].shape = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumxx.diminfo[1].strides = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumxx.diminfo[1].shape = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumxx = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":2661
 *     sumxx = np.zeros_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if K > 1:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":2663
 *     N, K = (<object> values).shape
 * 
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 * 
 */
  __pyx_t_13 = (__pyx_v_K > 1);
  if (__pyx_t_13) {

    /* "pandas/algos.pyx":2664
 * 
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 * 
 *             lab = labels[i]
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2666
 *         for i in range(N):
 * 
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2667
 * 
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2668
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L6_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/algos.pyx":2670
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 * 
 *             for j in range(K):
 */
      __pyx_t_15 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2672
 *             counts[lab] += 1
 * 
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_16 = __pyx_v_K;
      for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "pandas/algos.pyx":2673
 * 
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2676
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val
 */
        __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2677
 *                 # not nan
 *                 if val == val:
 *                     nobs[lab, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[lab, j] += val
 *                     sumxx[lab, j] += val * val
 */
          __pyx_t_20 = __pyx_v_lab;
          __pyx_t_21 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2678
 *                 if val == val:
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val             # <<<<<<<<<<<<<<
 *                     sumxx[lab, j] += val * val
 *     else:
 */
          __pyx_t_22 = __pyx_v_lab;
          __pyx_t_23 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;

          /* "pandas/algos.pyx":2679
 *                     nobs[lab, j] += 1
 *                     sumx[lab, j] += val
 *                     sumxx[lab, j] += val * val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_24 = __pyx_v_lab;
          __pyx_t_25 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_sumxx.diminfo[1].strides) += (__pyx_v_val * __pyx_v_val);
          goto __pyx_L11;
        }
        __pyx_L11:;
      }
      __pyx_L6_continue:;
    }
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2681
 *                     sumxx[lab, j] += val * val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 * 
 *             lab = labels[i]
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2683
 *         for i in range(N):
 * 
 *             lab = labels[i]             # <<<<<<<<<<<<<<
 *             if lab < 0:
 *                 continue
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_v_lab = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_labels.diminfo[0].strides));

      /* "pandas/algos.pyx":2684
 * 
 *             lab = labels[i]
 *             if lab < 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
      __pyx_t_13 = (__pyx_v_lab < 0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2685
 *             lab = labels[i]
 *             if lab < 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             counts[lab] += 1
 */
        goto __pyx_L12_continue;
        goto __pyx_L14;
      }
      __pyx_L14:;

      /* "pandas/algos.pyx":2687
 *                 continue
 * 
 *             counts[lab] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 *             # not nan
 */
      __pyx_t_17 = __pyx_v_lab;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2688
 * 
 *             counts[lab] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 *             # not nan
 *             if val == val:
 */
      __pyx_t_26 = __pyx_v_i;
      __pyx_t_27 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2690
 *             val = values[i, 0]
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2691
 *             # not nan
 *             if val == val:
 *                 nobs[lab, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[lab, 0] += val
 *                 sumxx[lab, 0] += val * val
 */
        __pyx_t_28 = __pyx_v_lab;
        __pyx_t_29 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2692
 *             if val == val:
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val             # <<<<<<<<<<<<<<
 *                 sumxx[lab, 0] += val * val
 * 
 */
        __pyx_t_30 = __pyx_v_lab;
        __pyx_t_31 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;

        /* "pandas/algos.pyx":2693
 *                 nobs[lab, 0] += 1
 *                 sumx[lab, 0] += val
 *                 sumxx[lab, 0] += val * val             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_32 = __pyx_v_lab;
        __pyx_t_33 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_sumxx.diminfo[1].strides) += (__pyx_v_val * __pyx_v_val);
        goto __pyx_L15;
      }
      __pyx_L15:;
      __pyx_L12_continue:;
    }
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":2696
 * 
 * 
 *     for i in range(len(counts)):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             ct = nobs[i, j]
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_counts)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2697
 * 
 *     for i in range(len(counts)):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             ct = nobs[i, j]
 *             if ct < 2:
 */
    __pyx_t_34 = __pyx_v_K;
    for (__pyx_t_35 = 0; __pyx_t_35 < __pyx_t_34; __pyx_t_35+=1) {
      __pyx_v_j = __pyx_t_35;

      /* "pandas/algos.pyx":2698
 *     for i in range(len(counts)):
 *         for j in range(K):
 *             ct = nobs[i, j]             # <<<<<<<<<<<<<<
 *             if ct < 2:
 *                 out[i, j] = nan
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_t_37 = __pyx_v_j;
      __pyx_v_ct = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_nobs.diminfo[1].strides));

      /* "pandas/algos.pyx":2699
 *         for j in range(K):
 *             ct = nobs[i, j]
 *             if ct < 2:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_13 = (__pyx_v_ct < 2.0);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2700
 *             ct = nobs[i, j]
 *             if ct < 2:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
 */
        __pyx_t_38 = __pyx_v_i;
        __pyx_t_39 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L20;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2702
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /             # <<<<<<<<<<<<<<
 *                              (ct * ct - ct))
 * # add passing bin edges, instead of labels
 */
        __pyx_t_40 = __pyx_v_i;
        __pyx_t_41 = __pyx_v_j;
        __pyx_t_42 = __pyx_v_i;
        __pyx_t_43 = __pyx_v_j;
        __pyx_t_44 = __pyx_v_i;
        __pyx_t_45 = __pyx_v_j;
        __pyx_t_46 = ((__pyx_v_ct * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_sumxx.diminfo[1].strides))) - ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_sumx.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_sumx.diminfo[1].strides))));

        /* "pandas/algos.pyx":2703
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
 *                              (ct * ct - ct))             # <<<<<<<<<<<<<<
 * # add passing bin edges, instead of labels
 * 
 */
        __pyx_t_47 = ((__pyx_v_ct * __pyx_v_ct) - __pyx_v_ct);
        if (unlikely(__pyx_t_47 == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "pandas/algos.pyx":2702
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /             # <<<<<<<<<<<<<<
 *                              (ct * ct - ct))
 * # add passing bin edges, instead of labels
 */
        __pyx_t_48 = __pyx_v_i;
        __pyx_t_49 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_out.diminfo[1].strides) = (__pyx_t_46 / __pyx_t_47);
      }
      __pyx_L20:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_labels.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumxx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_99group_add_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_98group_add_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_99group_add_bin = {__Pyx_NAMESTR("group_add_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_99group_add_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_98group_add_bin)};
static PyObject *__pyx_pw_6pandas_5algos_99group_add_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_add_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_add_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_add_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_add_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_add_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2709; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_98group_add_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2708
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_98group_add_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_add_bin", 0);
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2720
 *         ndarray[float64_t, ndim=2] sumx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2721
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2723
 *     sumx = np.zeros_like(out)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2724
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2726
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 *     N, K = (<object> values).shape
 * 
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2727
 *     else:
 *         ngroups = len(bins) + 1
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2729
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2730
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_12 = (__pyx_v_K > 1);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2731
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2732
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_12) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_12;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":2733
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2735
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_18 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2736
 * 
 *             counts[b] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":2737
 *             counts[b] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2740
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":2741
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[b, j] += val
 *     else:
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2742
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2744
 *                     sumx[b, j] += val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2745
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_12;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":2746
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2748
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2749
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_28 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2752
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2753
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[b, 0] += val
 * 
 */
        __pyx_t_29 = __pyx_v_b;
        __pyx_t_30 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2754
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2756
 *                 sumx[b, 0] += val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2757
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_33 = __pyx_v_K;
    for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) {
      __pyx_v_j = __pyx_t_34;

      /* "pandas/algos.pyx":2758
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_35 = __pyx_v_i;
      __pyx_t_36 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2759
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = sumx[i, j]
 */
        __pyx_t_37 = __pyx_v_i;
        __pyx_t_38 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2761
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = sumx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_39 = __pyx_v_i;
        __pyx_t_40 = __pyx_v_j;
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_sumx.diminfo[1].strides));
      }
      __pyx_L23:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_add_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_101group_prod_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_100group_prod_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_101group_prod_bin = {__Pyx_NAMESTR("group_prod_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_101group_prod_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_100group_prod_bin)};
static PyObject *__pyx_pw_6pandas_5algos_101group_prod_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_prod_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_prod_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_prod_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_prod_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_prod_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_100group_prod_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2765
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_100group_prod_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_prodx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_prodx;
  __Pyx_Buffer __pyx_pybuffer_prodx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_prod_bin", 0);
  __pyx_pybuffer_prodx.pybuffer.buf = NULL;
  __pyx_pybuffer_prodx.refcount = 0;
  __pyx_pybuffernd_prodx.data = NULL;
  __pyx_pybuffernd_prodx.rcbuffer = &__pyx_pybuffer_prodx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2777
 *         ndarray[float64_t, ndim=2] prodx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     prodx = np.ones_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2778
 * 
 *     nobs = np.zeros_like(out)
 *     prodx = np.ones_like(out)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer, (PyObject*)__pyx_v_prodx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_prodx.diminfo[0].strides = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_prodx.diminfo[0].shape = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_prodx.diminfo[1].strides = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_prodx.diminfo[1].shape = __pyx_pybuffernd_prodx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_prodx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2780
 *     prodx = np.ones_like(out)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2781
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2783
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 *     N, K = (<object> values).shape
 * 
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2784
 *     else:
 *         ngroups = len(bins) + 1
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2786
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2787
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_12 = (__pyx_v_K > 1);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2788
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2789
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_12) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_12;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":2790
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2792
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_18 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2793
 * 
 *             counts[b] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":2794
 *             counts[b] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2797
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     prodx[b, j] *= val
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":2798
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     prodx[b, j] *= val
 *     else:
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2799
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     prodx[b, j] *= val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_prodx.diminfo[1].strides) *= __pyx_v_val;
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2801
 *                     prodx[b, j] *= val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2802
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_12;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":2803
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2805
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2806
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_28 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2809
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 prodx[b, 0] *= val
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2810
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 prodx[b, 0] *= val
 * 
 */
        __pyx_t_29 = __pyx_v_b;
        __pyx_t_30 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2811
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 prodx[b, 0] *= val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_prodx.diminfo[1].strides) *= __pyx_v_val;
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2813
 *                 prodx[b, 0] *= val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2814
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_33 = __pyx_v_K;
    for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) {
      __pyx_v_j = __pyx_t_34;

      /* "pandas/algos.pyx":2815
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_35 = __pyx_v_i;
      __pyx_t_36 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2816
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = prodx[i, j]
 */
        __pyx_t_37 = __pyx_v_i;
        __pyx_t_38 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2818
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = prodx[i, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_39 = __pyx_v_i;
        __pyx_t_40 = __pyx_v_j;
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_prodx.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_prodx.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_prodx.diminfo[1].strides));
      }
      __pyx_L23:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_prod_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_prodx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_prodx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_103group_min_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_102group_min_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_103group_min_bin = {__Pyx_NAMESTR("group_min_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_103group_min_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_102group_min_bin)};
static PyObject *__pyx_pw_6pandas_5algos_103group_min_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_min_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_min_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_min_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_min_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_min_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_102group_min_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2822
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_102group_min_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_minx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_minx;
  __Pyx_Buffer __pyx_pybuffer_minx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  long __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  long __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_min_bin", 0);
  __pyx_pybuffer_minx.pybuffer.buf = NULL;
  __pyx_pybuffer_minx.refcount = 0;
  __pyx_pybuffernd_minx.data = NULL;
  __pyx_pybuffernd_minx.rcbuffer = &__pyx_pybuffer_minx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2834
 *         ndarray[float64_t, ndim=2] minx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     minx = np.empty_like(out)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2836
 *     nobs = np.zeros_like(out)
 * 
 *     minx = np.empty_like(out)             # <<<<<<<<<<<<<<
 *     minx.fill(np.inf)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_minx.rcbuffer->pybuffer, (PyObject*)__pyx_v_minx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_minx.diminfo[0].strides = __pyx_pybuffernd_minx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_minx.diminfo[0].shape = __pyx_pybuffernd_minx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_minx.diminfo[1].strides = __pyx_pybuffernd_minx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_minx.diminfo[1].shape = __pyx_pybuffernd_minx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_minx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2837
 * 
 *     minx = np.empty_like(out)
 *     minx.fill(np.inf)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_minx), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":2839
 *     minx.fill(np.inf)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2840
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2842
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2844
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2846
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2847
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_12 = (__pyx_v_K > 1);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2848
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2849
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_12) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_12;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":2850
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2852
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_18 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2853
 * 
 *             counts[b] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":2854
 *             counts[b] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2857
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     if val < minx[b, j]:
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":2858
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     if val < minx[b, j]:
 *                         minx[b, j] = val
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2859
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     if val < minx[b, j]:             # <<<<<<<<<<<<<<
 *                         minx[b, j] = val
 *     else:
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_17 = (__pyx_v_val < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_minx.diminfo[1].strides)));
          if (__pyx_t_17) {

            /* "pandas/algos.pyx":2860
 *                     nobs[b, j] += 1
 *                     if val < minx[b, j]:
 *                         minx[b, j] = val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
            __pyx_t_27 = __pyx_v_b;
            __pyx_t_28 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_minx.diminfo[1].strides) = __pyx_v_val;
            goto __pyx_L14;
          }
          __pyx_L14:;
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2862
 *                         minx[b, j] = val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2863
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_12;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":2864
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2866
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2867
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_30 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2870
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 if val < minx[b, 0]:
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2871
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 if val < minx[b, 0]:
 *                     minx[b, 0] = val
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2872
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 if val < minx[b, 0]:             # <<<<<<<<<<<<<<
 *                     minx[b, 0] = val
 * 
 */
        __pyx_t_33 = __pyx_v_b;
        __pyx_t_34 = 0;
        __pyx_t_16 = (__pyx_v_val < (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_minx.diminfo[1].strides)));
        if (__pyx_t_16) {

          /* "pandas/algos.pyx":2873
 *                 nobs[b, 0] += 1
 *                 if val < minx[b, 0]:
 *                     minx[b, 0] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
          __pyx_t_35 = __pyx_v_b;
          __pyx_t_36 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_minx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L20;
        }
        __pyx_L20:;
        goto __pyx_L19;
      }
      __pyx_L19:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2875
 *                     minx[b, 0] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2876
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_37 = __pyx_v_K;
    for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) {
      __pyx_v_j = __pyx_t_38;

      /* "pandas/algos.pyx":2877
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_39 = __pyx_v_i;
      __pyx_t_40 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2878
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = minx[i, j]
 */
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L25;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2880
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = minx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_43 = __pyx_v_i;
        __pyx_t_44 = __pyx_v_j;
        __pyx_t_45 = __pyx_v_i;
        __pyx_t_46 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_minx.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_minx.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_minx.diminfo[1].strides));
      }
      __pyx_L25:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_min_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_minx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_minx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_105group_max_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_104group_max_bin[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_105group_max_bin = {__Pyx_NAMESTR("group_max_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_105group_max_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_104group_max_bin)};
static PyObject *__pyx_pw_6pandas_5algos_105group_max_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_max_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_max_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_max_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_max_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_max_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_104group_max_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2885
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_104group_max_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  PyArrayObject *__pyx_v_maxx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_maxx;
  __Pyx_Buffer __pyx_pybuffer_maxx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  long __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  long __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_max_bin", 0);
  __pyx_pybuffer_maxx.pybuffer.buf = NULL;
  __pyx_pybuffer_maxx.refcount = 0;
  __pyx_pybuffernd_maxx.data = NULL;
  __pyx_pybuffernd_maxx.rcbuffer = &__pyx_pybuffer_maxx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2897
 *         ndarray[float64_t, ndim=2] maxx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     maxx = np.empty_like(out)
 *     maxx.fill(-np.inf)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2898
 * 
 *     nobs = np.zeros_like(out)
 *     maxx = np.empty_like(out)             # <<<<<<<<<<<<<<
 *     maxx.fill(-np.inf)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer, (PyObject*)__pyx_v_maxx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_maxx.diminfo[0].strides = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_maxx.diminfo[0].shape = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_maxx.diminfo[1].strides = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_maxx.diminfo[1].shape = __pyx_pybuffernd_maxx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_maxx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":2899
 *     nobs = np.zeros_like(out)
 *     maxx = np.empty_like(out)
 *     maxx.fill(-np.inf)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_maxx), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2901
 *     maxx.fill(-np.inf)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2902
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2904
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2906
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":2908
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2909
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_12 = (__pyx_v_K > 1);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":2910
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2911
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_12) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_12;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":2912
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2914
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_18 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2915
 * 
 *             counts[b] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":2916
 *             counts[b] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":2919
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     if val > maxx[b, j]:
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":2920
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     if val > maxx[b, j]:
 *                         maxx[b, j] = val
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":2921
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     if val > maxx[b, j]:             # <<<<<<<<<<<<<<
 *                         maxx[b, j] = val
 *     else:
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_17 = (__pyx_v_val > (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_maxx.diminfo[1].strides)));
          if (__pyx_t_17) {

            /* "pandas/algos.pyx":2922
 *                     nobs[b, j] += 1
 *                     if val > maxx[b, j]:
 *                         maxx[b, j] = val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
            __pyx_t_27 = __pyx_v_b;
            __pyx_t_28 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_maxx.diminfo[1].strides) = __pyx_v_val;
            goto __pyx_L14;
          }
          __pyx_L14:;
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2924
 *                         maxx[b, j] = val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":2925
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_12;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":2926
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":2928
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2929
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_30 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2932
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 if val > maxx[b, 0]:
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2933
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 if val > maxx[b, 0]:
 *                     maxx[b, 0] = val
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":2934
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 if val > maxx[b, 0]:             # <<<<<<<<<<<<<<
 *                     maxx[b, 0] = val
 * 
 */
        __pyx_t_33 = __pyx_v_b;
        __pyx_t_34 = 0;
        __pyx_t_16 = (__pyx_v_val > (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_maxx.diminfo[1].strides)));
        if (__pyx_t_16) {

          /* "pandas/algos.pyx":2935
 *                 nobs[b, 0] += 1
 *                 if val > maxx[b, 0]:
 *                     maxx[b, 0] = val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
          __pyx_t_35 = __pyx_v_b;
          __pyx_t_36 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_maxx.diminfo[1].strides) = __pyx_v_val;
          goto __pyx_L20;
        }
        __pyx_L20:;
        goto __pyx_L19;
      }
      __pyx_L19:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2937
 *                     maxx[b, 0] = val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":2938
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
    __pyx_t_37 = __pyx_v_K;
    for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) {
      __pyx_v_j = __pyx_t_38;

      /* "pandas/algos.pyx":2939
 *     for i in range(ngroups):
 *         for j in range(K):
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_39 = __pyx_v_i;
      __pyx_t_40 = __pyx_v_j;
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":2940
 *         for j in range(K):
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = maxx[i, j]
 */
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L25;
      }
      /*else*/ {

        /* "pandas/algos.pyx":2942
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = maxx[i, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_43 = __pyx_v_i;
        __pyx_t_44 = __pyx_v_j;
        __pyx_t_45 = __pyx_v_i;
        __pyx_t_46 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_out.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxx.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_maxx.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_maxx.diminfo[1].strides));
      }
      __pyx_L25:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_max_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_maxx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_107group_ohlc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_106group_ohlc[] = "\n    Only aggregates on axis=0\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_107group_ohlc = {__Pyx_NAMESTR("group_ohlc"), (PyCFunction)__pyx_pw_6pandas_5algos_107group_ohlc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_106group_ohlc)};
static PyObject *__pyx_pw_6pandas_5algos_107group_ohlc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_ohlc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_ohlc", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_ohlc", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_ohlc", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_ohlc") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_ohlc", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_ohlc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_106group_ohlc(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":2947
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_ohlc(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_106group_ohlc(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_vopen;
  __pyx_t_5numpy_float64_t __pyx_v_vhigh;
  __pyx_t_5numpy_float64_t __pyx_v_vlow;
  __pyx_t_5numpy_float64_t __pyx_v_vclose;
  __pyx_t_5numpy_float64_t __pyx_v_NA;
  int __pyx_v_got_first;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  __pyx_t_5numpy_float64_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  long __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  long __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  long __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  long __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  long __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  long __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  long __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  long __pyx_t_33;
  long __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  long __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  long __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  long __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  long __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  long __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  long __pyx_t_46;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_ohlc", 0);
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":2958
 *         float64_t val, count
 *         float64_t vopen, vhigh, vlow, vclose, NA
 *         bint got_first = 0             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_v_got_first = 0;

  /* "pandas/algos.pyx":2960
 *         bint got_first = 0
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 - 1);
  __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_3);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":2961
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2961; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_3;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2963
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_3 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":2965
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if out.shape[1] != 4:
 */
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_7);
    #else
    __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
    index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_9 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_1 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_N = __pyx_t_3;
  __pyx_v_K = __pyx_t_1;

  /* "pandas/algos.pyx":2967
 *     N, K = (<object> values).shape
 * 
 *     if out.shape[1] != 4:             # <<<<<<<<<<<<<<
 *         raise ValueError('Output array must have 4 columns')
 * 
 */
  __pyx_t_4 = ((__pyx_v_out->dimensions[1]) != 4);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":2968
 * 
 *     if out.shape[1] != 4:
 *         raise ValueError('Output array must have 4 columns')             # <<<<<<<<<<<<<<
 * 
 *     NA = np.nan
 */
    __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":2970
 *         raise ValueError('Output array must have 4 columns')
 * 
 *     NA = np.nan             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__nan); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_10 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_NA = __pyx_t_10;

  /* "pandas/algos.pyx":2972
 *     NA = np.nan
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         raise NotImplementedError
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":2973
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 *     else:
 */
  __pyx_t_4 = (__pyx_v_K > 1);
  if (__pyx_t_4) {

    /* "pandas/algos.pyx":2974
 *     b = 0
 *     if K > 1:
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
    __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  /*else*/ {

    /* "pandas/algos.pyx":2976
 *         raise NotImplementedError
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 if not got_first:
 */
    __pyx_t_1 = __pyx_v_N;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "pandas/algos.pyx":2977
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 if not got_first:
 *                     out[b, 0] = NA
 */
      while (1) {
        __pyx_t_4 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_4) {
          __pyx_t_11 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_13 = __pyx_t_12;
        } else {
          __pyx_t_13 = __pyx_t_4;
        }
        if (!__pyx_t_13) break;

        /* "pandas/algos.pyx":2978
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 if not got_first:             # <<<<<<<<<<<<<<
 *                     out[b, 0] = NA
 *                     out[b, 1] = NA
 */
        __pyx_t_13 = (!__pyx_v_got_first);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2979
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 if not got_first:
 *                     out[b, 0] = NA             # <<<<<<<<<<<<<<
 *                     out[b, 1] = NA
 *                     out[b, 2] = NA
 */
          __pyx_t_14 = __pyx_v_b;
          __pyx_t_15 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

          /* "pandas/algos.pyx":2980
 *                 if not got_first:
 *                     out[b, 0] = NA
 *                     out[b, 1] = NA             # <<<<<<<<<<<<<<
 *                     out[b, 2] = NA
 *                     out[b, 3] = NA
 */
          __pyx_t_16 = __pyx_v_b;
          __pyx_t_17 = 1;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

          /* "pandas/algos.pyx":2981
 *                     out[b, 0] = NA
 *                     out[b, 1] = NA
 *                     out[b, 2] = NA             # <<<<<<<<<<<<<<
 *                     out[b, 3] = NA
 *                 else:
 */
          __pyx_t_18 = __pyx_v_b;
          __pyx_t_19 = 2;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

          /* "pandas/algos.pyx":2982
 *                     out[b, 1] = NA
 *                     out[b, 2] = NA
 *                     out[b, 3] = NA             # <<<<<<<<<<<<<<
 *                 else:
 *                     out[b, 0] = vopen
 */
          __pyx_t_20 = __pyx_v_b;
          __pyx_t_21 = 3;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;
          goto __pyx_L12;
        }
        /*else*/ {

          /* "pandas/algos.pyx":2984
 *                     out[b, 3] = NA
 *                 else:
 *                     out[b, 0] = vopen             # <<<<<<<<<<<<<<
 *                     out[b, 1] = vhigh
 *                     out[b, 2] = vlow
 */
          __pyx_t_22 = __pyx_v_b;
          __pyx_t_23 = 0;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vopen;

          /* "pandas/algos.pyx":2985
 *                 else:
 *                     out[b, 0] = vopen
 *                     out[b, 1] = vhigh             # <<<<<<<<<<<<<<
 *                     out[b, 2] = vlow
 *                     out[b, 3] = vclose
 */
          __pyx_t_24 = __pyx_v_b;
          __pyx_t_25 = 1;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vhigh;

          /* "pandas/algos.pyx":2986
 *                     out[b, 0] = vopen
 *                     out[b, 1] = vhigh
 *                     out[b, 2] = vlow             # <<<<<<<<<<<<<<
 *                     out[b, 3] = vclose
 *                 b += 1
 */
          __pyx_t_26 = __pyx_v_b;
          __pyx_t_27 = 2;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vlow;

          /* "pandas/algos.pyx":2987
 *                     out[b, 1] = vhigh
 *                     out[b, 2] = vlow
 *                     out[b, 3] = vclose             # <<<<<<<<<<<<<<
 *                 b += 1
 *                 got_first = 0
 */
          __pyx_t_28 = __pyx_v_b;
          __pyx_t_29 = 3;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vclose;
        }
        __pyx_L12:;

        /* "pandas/algos.pyx":2988
 *                     out[b, 2] = vlow
 *                     out[b, 3] = vclose
 *                 b += 1             # <<<<<<<<<<<<<<
 *                 got_first = 0
 * 
 */
        __pyx_v_b = (__pyx_v_b + 1);

        /* "pandas/algos.pyx":2989
 *                     out[b, 3] = vclose
 *                 b += 1
 *                 got_first = 0             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_got_first = 0;
      }

      /* "pandas/algos.pyx":2991
 *                 got_first = 0
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_30 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":2992
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_31 = __pyx_v_i;
      __pyx_t_32 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":2995
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 if not got_first:
 *                     got_first = 1
 */
      __pyx_t_13 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_13) {

        /* "pandas/algos.pyx":2996
 *             # not nan
 *             if val == val:
 *                 if not got_first:             # <<<<<<<<<<<<<<
 *                     got_first = 1
 *                     vopen = val
 */
        __pyx_t_13 = (!__pyx_v_got_first);
        if (__pyx_t_13) {

          /* "pandas/algos.pyx":2997
 *             if val == val:
 *                 if not got_first:
 *                     got_first = 1             # <<<<<<<<<<<<<<
 *                     vopen = val
 *                     vlow = val
 */
          __pyx_v_got_first = 1;

          /* "pandas/algos.pyx":2998
 *                 if not got_first:
 *                     got_first = 1
 *                     vopen = val             # <<<<<<<<<<<<<<
 *                     vlow = val
 *                     vhigh = val
 */
          __pyx_v_vopen = __pyx_v_val;

          /* "pandas/algos.pyx":2999
 *                     got_first = 1
 *                     vopen = val
 *                     vlow = val             # <<<<<<<<<<<<<<
 *                     vhigh = val
 *                 else:
 */
          __pyx_v_vlow = __pyx_v_val;

          /* "pandas/algos.pyx":3000
 *                     vopen = val
 *                     vlow = val
 *                     vhigh = val             # <<<<<<<<<<<<<<
 *                 else:
 *                     if val < vlow:
 */
          __pyx_v_vhigh = __pyx_v_val;
          goto __pyx_L14;
        }
        /*else*/ {

          /* "pandas/algos.pyx":3002
 *                     vhigh = val
 *                 else:
 *                     if val < vlow:             # <<<<<<<<<<<<<<
 *                         vlow = val
 *                     if val > vhigh:
 */
          __pyx_t_13 = (__pyx_v_val < __pyx_v_vlow);
          if (__pyx_t_13) {

            /* "pandas/algos.pyx":3003
 *                 else:
 *                     if val < vlow:
 *                         vlow = val             # <<<<<<<<<<<<<<
 *                     if val > vhigh:
 *                         vhigh = val
 */
            __pyx_v_vlow = __pyx_v_val;
            goto __pyx_L15;
          }
          __pyx_L15:;

          /* "pandas/algos.pyx":3004
 *                     if val < vlow:
 *                         vlow = val
 *                     if val > vhigh:             # <<<<<<<<<<<<<<
 *                         vhigh = val
 *                 vclose = val
 */
          __pyx_t_13 = (__pyx_v_val > __pyx_v_vhigh);
          if (__pyx_t_13) {

            /* "pandas/algos.pyx":3005
 *                         vlow = val
 *                     if val > vhigh:
 *                         vhigh = val             # <<<<<<<<<<<<<<
 *                 vclose = val
 * 
 */
            __pyx_v_vhigh = __pyx_v_val;
            goto __pyx_L16;
          }
          __pyx_L16:;
        }
        __pyx_L14:;

        /* "pandas/algos.pyx":3006
 *                     if val > vhigh:
 *                         vhigh = val
 *                 vclose = val             # <<<<<<<<<<<<<<
 * 
 *         if not got_first:
 */
        __pyx_v_vclose = __pyx_v_val;
        goto __pyx_L13;
      }
      __pyx_L13:;
    }

    /* "pandas/algos.pyx":3008
 *                 vclose = val
 * 
 *         if not got_first:             # <<<<<<<<<<<<<<
 *             out[b, 0] = NA
 *             out[b, 1] = NA
 */
    __pyx_t_13 = (!__pyx_v_got_first);
    if (__pyx_t_13) {

      /* "pandas/algos.pyx":3009
 * 
 *         if not got_first:
 *             out[b, 0] = NA             # <<<<<<<<<<<<<<
 *             out[b, 1] = NA
 *             out[b, 2] = NA
 */
      __pyx_t_1 = __pyx_v_b;
      __pyx_t_33 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

      /* "pandas/algos.pyx":3010
 *         if not got_first:
 *             out[b, 0] = NA
 *             out[b, 1] = NA             # <<<<<<<<<<<<<<
 *             out[b, 2] = NA
 *             out[b, 3] = NA
 */
      __pyx_t_3 = __pyx_v_b;
      __pyx_t_34 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

      /* "pandas/algos.pyx":3011
 *             out[b, 0] = NA
 *             out[b, 1] = NA
 *             out[b, 2] = NA             # <<<<<<<<<<<<<<
 *             out[b, 3] = NA
 *         else:
 */
      __pyx_t_35 = __pyx_v_b;
      __pyx_t_36 = 2;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;

      /* "pandas/algos.pyx":3012
 *             out[b, 1] = NA
 *             out[b, 2] = NA
 *             out[b, 3] = NA             # <<<<<<<<<<<<<<
 *         else:
 *             out[b, 0] = vopen
 */
      __pyx_t_37 = __pyx_v_b;
      __pyx_t_38 = 3;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_NA;
      goto __pyx_L17;
    }
    /*else*/ {

      /* "pandas/algos.pyx":3014
 *             out[b, 3] = NA
 *         else:
 *             out[b, 0] = vopen             # <<<<<<<<<<<<<<
 *             out[b, 1] = vhigh
 *             out[b, 2] = vlow
 */
      __pyx_t_39 = __pyx_v_b;
      __pyx_t_40 = 0;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vopen;

      /* "pandas/algos.pyx":3015
 *         else:
 *             out[b, 0] = vopen
 *             out[b, 1] = vhigh             # <<<<<<<<<<<<<<
 *             out[b, 2] = vlow
 *             out[b, 3] = vclose
 */
      __pyx_t_41 = __pyx_v_b;
      __pyx_t_42 = 1;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vhigh;

      /* "pandas/algos.pyx":3016
 *             out[b, 0] = vopen
 *             out[b, 1] = vhigh
 *             out[b, 2] = vlow             # <<<<<<<<<<<<<<
 *             out[b, 3] = vclose
 * 
 */
      __pyx_t_43 = __pyx_v_b;
      __pyx_t_44 = 2;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vlow;

      /* "pandas/algos.pyx":3017
 *             out[b, 1] = vhigh
 *             out[b, 2] = vlow
 *             out[b, 3] = vclose             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_45 = __pyx_v_b;
      __pyx_t_46 = 3;
      *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_vclose;
    }
    __pyx_L17:;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_ohlc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_109group_mean_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_109group_mean_bin = {__Pyx_NAMESTR("group_mean_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_109group_mean_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_109group_mean_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_mean_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_mean_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_mean_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_mean_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_mean_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_108group_mean_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":3022
 * # @cython.boundscheck(False)
 * # @cython.wraparound(False)
 * def group_mean_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_108group_mean_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_count;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_nobs = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  __pyx_t_5numpy_float64_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_mean_bin", 0);
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":3031
 *         ndarray[float64_t, ndim=2] sumx, nobs
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":3032
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":3034
 *     sumx = np.zeros_like(out)
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_12;

  /* "pandas/algos.pyx":3035
 * 
 *     N, K = (<object> values).shape
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_12 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = (__pyx_t_12 - 1);
  __pyx_t_5 = -1;
  if (__pyx_t_11 < 0) {
    __pyx_t_11 += __pyx_pybuffernd_bins.diminfo[0].shape;
    if (unlikely(__pyx_t_11 < 0)) __pyx_t_5 = 0;
  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_bins.diminfo[0].shape)) __pyx_t_5 = 0;
  if (unlikely(__pyx_t_5 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_5);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_13);
  if (__pyx_t_14) {

    /* "pandas/algos.pyx":3036
 *     N, K = (<object> values).shape
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_13;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/algos.pyx":3038
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
    __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_13 + 1);
  }
  __pyx_L5:;

  /* "pandas/algos.pyx":3040
 *         ngroups = len(bins) + 1
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":3041
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_14 = (__pyx_v_K > 1);
  if (__pyx_t_14) {

    /* "pandas/algos.pyx":3042
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_13 = __pyx_v_N;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/algos.pyx":3043
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_14 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_14) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_5 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_pybuffernd_bins.diminfo[0].shape;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_5 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_bins.diminfo[0].shape)) __pyx_t_5 = 0;
          if (unlikely(__pyx_t_5 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_5);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_14;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":3044
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":3046
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             for j in range(K):
 *                 val = values[i, j]
 */
      __pyx_t_18 = __pyx_v_b;
      __pyx_t_5 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_counts.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":3047
 * 
 *             counts[b] += 1
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":3048
 *             counts[b] += 1
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_t_5 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_21 += __pyx_pybuffernd_values.diminfo[0].shape;
          if (unlikely(__pyx_t_21 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_22 < 0) {
          __pyx_t_22 += __pyx_pybuffernd_values.diminfo[1].shape;
          if (unlikely(__pyx_t_22 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":3051
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":3052
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[b, j] += val
 *     else:
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_5 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_nobs.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_5 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_nobs.diminfo[0].shape)) __pyx_t_5 = 0;
          if (__pyx_t_24 < 0) {
            __pyx_t_24 += __pyx_pybuffernd_nobs.diminfo[1].shape;
            if (unlikely(__pyx_t_24 < 0)) __pyx_t_5 = 1;
          } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_nobs.diminfo[1].shape)) __pyx_t_5 = 1;
          if (unlikely(__pyx_t_5 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_5);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":3053
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_5 = -1;
          if (__pyx_t_25 < 0) {
            __pyx_t_25 += __pyx_pybuffernd_sumx.diminfo[0].shape;
            if (unlikely(__pyx_t_25 < 0)) __pyx_t_5 = 0;
          } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_sumx.diminfo[0].shape)) __pyx_t_5 = 0;
          if (__pyx_t_26 < 0) {
            __pyx_t_26 += __pyx_pybuffernd_sumx.diminfo[1].shape;
            if (unlikely(__pyx_t_26 < 0)) __pyx_t_5 = 1;
          } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_sumx.diminfo[1].shape)) __pyx_t_5 = 1;
          if (unlikely(__pyx_t_5 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_5);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":3055
 *                     sumx[b, j] += val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_13 = __pyx_v_N;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/algos.pyx":3056
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_5 = -1;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_pybuffernd_bins.diminfo[0].shape;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_5 = 0;
          } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_bins.diminfo[0].shape)) __pyx_t_5 = 0;
          if (unlikely(__pyx_t_5 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_5);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_14 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_14;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":3057
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":3059
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      __pyx_t_5 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_pybuffernd_counts.diminfo[0].shape;
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_counts.diminfo[0].shape)) __pyx_t_5 = 0;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":3060
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_27 = __pyx_v_i;
      __pyx_t_28 = 0;
      __pyx_t_5 = -1;
      if (__pyx_t_27 < 0) {
        __pyx_t_27 += __pyx_pybuffernd_values.diminfo[0].shape;
        if (unlikely(__pyx_t_27 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_5 = 0;
      if (__pyx_t_28 < 0) {
        __pyx_t_28 += __pyx_pybuffernd_values.diminfo[1].shape;
        if (unlikely(__pyx_t_28 < 0)) __pyx_t_5 = 1;
      } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_values.diminfo[1].shape)) __pyx_t_5 = 1;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":3063
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":3064
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[b, 0] += val
 * 
 */
        __pyx_t_29 = __pyx_v_b;
        __pyx_t_30 = 0;
        __pyx_t_5 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_nobs.diminfo[0].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_nobs.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_30 < 0) {
          __pyx_t_30 += __pyx_pybuffernd_nobs.diminfo[1].shape;
          if (unlikely(__pyx_t_30 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_nobs.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":3065
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        __pyx_t_5 = -1;
        if (__pyx_t_31 < 0) {
          __pyx_t_31 += __pyx_pybuffernd_sumx.diminfo[0].shape;
          if (unlikely(__pyx_t_31 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_sumx.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_32 < 0) {
          __pyx_t_32 += __pyx_pybuffernd_sumx.diminfo[1].shape;
          if (unlikely(__pyx_t_32 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_sumx.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":3067
 *                 sumx[b, 0] += val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             count = nobs[i, j]
 */
  __pyx_t_13 = __pyx_v_ngroups;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/algos.pyx":3068
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:
 */
    __pyx_t_33 = __pyx_v_K;
    for (__pyx_t_34 = 0; __pyx_t_34 < __pyx_t_33; __pyx_t_34+=1) {
      __pyx_v_j = __pyx_t_34;

      /* "pandas/algos.pyx":3069
 *     for i in range(ngroups):
 *         for j in range(K):
 *             count = nobs[i, j]             # <<<<<<<<<<<<<<
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan
 */
      __pyx_t_35 = __pyx_v_i;
      __pyx_t_36 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_35 < 0) {
        __pyx_t_35 += __pyx_pybuffernd_nobs.diminfo[0].shape;
        if (unlikely(__pyx_t_35 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_nobs.diminfo[0].shape)) __pyx_t_5 = 0;
      if (__pyx_t_36 < 0) {
        __pyx_t_36 += __pyx_pybuffernd_nobs.diminfo[1].shape;
        if (unlikely(__pyx_t_36 < 0)) __pyx_t_5 = 1;
      } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_nobs.diminfo[1].shape)) __pyx_t_5 = 1;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_count = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_nobs.diminfo[1].strides));

      /* "pandas/algos.pyx":3070
 *         for j in range(K):
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_37 = __pyx_v_i;
      __pyx_t_38 = __pyx_v_j;
      __pyx_t_5 = -1;
      if (__pyx_t_37 < 0) {
        __pyx_t_37 += __pyx_pybuffernd_nobs.diminfo[0].shape;
        if (unlikely(__pyx_t_37 < 0)) __pyx_t_5 = 0;
      } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_nobs.diminfo[0].shape)) __pyx_t_5 = 0;
      if (__pyx_t_38 < 0) {
        __pyx_t_38 += __pyx_pybuffernd_nobs.diminfo[1].shape;
        if (unlikely(__pyx_t_38 < 0)) __pyx_t_5 = 1;
      } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_nobs.diminfo[1].shape)) __pyx_t_5 = 1;
      if (unlikely(__pyx_t_5 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_5);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_16 = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_nobs.diminfo[1].strides)) == 0.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":3071
 *             count = nobs[i, j]
 *             if nobs[i, j] == 0:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = sumx[i, j] / count
 */
        __pyx_t_39 = __pyx_v_i;
        __pyx_t_40 = __pyx_v_j;
        __pyx_t_5 = -1;
        if (__pyx_t_39 < 0) {
          __pyx_t_39 += __pyx_pybuffernd_out.diminfo[0].shape;
          if (unlikely(__pyx_t_39 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_40 < 0) {
          __pyx_t_40 += __pyx_pybuffernd_out.diminfo[1].shape;
          if (unlikely(__pyx_t_40 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_out.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":3073
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = sumx[i, j] / count             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        __pyx_t_5 = -1;
        if (__pyx_t_41 < 0) {
          __pyx_t_41 += __pyx_pybuffernd_sumx.diminfo[0].shape;
          if (unlikely(__pyx_t_41 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_sumx.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_42 < 0) {
          __pyx_t_42 += __pyx_pybuffernd_sumx.diminfo[1].shape;
          if (unlikely(__pyx_t_42 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_sumx.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_43 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_sumx.diminfo[1].strides));
        if (unlikely(__pyx_v_count == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_44 = __pyx_v_i;
        __pyx_t_45 = __pyx_v_j;
        __pyx_t_5 = -1;
        if (__pyx_t_44 < 0) {
          __pyx_t_44 += __pyx_pybuffernd_out.diminfo[0].shape;
          if (unlikely(__pyx_t_44 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_5 = 0;
        if (__pyx_t_45 < 0) {
          __pyx_t_45 += __pyx_pybuffernd_out.diminfo[1].shape;
          if (unlikely(__pyx_t_45 < 0)) __pyx_t_5 = 1;
        } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_out.diminfo[1].shape)) __pyx_t_5 = 1;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_out.diminfo[1].strides) = (__pyx_t_43 / __pyx_v_count);
      }
      __pyx_L23:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_mean_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_111group_var_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_111group_var_bin = {__Pyx_NAMESTR("group_var_bin"), (PyCFunction)__pyx_pw_6pandas_5algos_111group_var_bin, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_111group_var_bin(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_counts = 0;
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_bins = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("group_var_bin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__out,&__pyx_n_s__counts,&__pyx_n_s__values,&__pyx_n_s__bins,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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var_bin", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var_bin", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bins)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("group_var_bin", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group_var_bin") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_out = ((PyArrayObject *)values[0]);
    __pyx_v_counts = ((PyArrayObject *)values[1]);
    __pyx_v_values = ((PyArrayObject *)values[2]);
    __pyx_v_bins = ((PyArrayObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("group_var_bin", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.group_var_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bins), __pyx_ptype_5numpy_ndarray, 1, "bins", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_110group_var_bin(__pyx_self, __pyx_v_out, __pyx_v_counts, __pyx_v_values, __pyx_v_bins);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/algos.pyx":3077
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */

static PyObject *__pyx_pf_6pandas_5algos_110group_var_bin(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_out, PyArrayObject *__pyx_v_counts, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_bins) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  Py_ssize_t __pyx_v_ngroups;
  Py_ssize_t __pyx_v_b;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  __pyx_t_5numpy_float64_t __pyx_v_ct;
  PyArrayObject *__pyx_v_nobs = 0;
  PyArrayObject *__pyx_v_sumx = 0;
  PyArrayObject *__pyx_v_sumxx = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bins;
  __Pyx_Buffer __pyx_pybuffer_bins;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_counts;
  __Pyx_Buffer __pyx_pybuffer_counts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_nobs;
  __Pyx_Buffer __pyx_pybuffer_nobs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
  __Pyx_Buffer __pyx_pybuffer_out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumx;
  __Pyx_Buffer __pyx_pybuffer_sumx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sumxx;
  __Pyx_Buffer __pyx_pybuffer_sumxx;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyArrayObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  Py_ssize_t __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  long __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  long __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  long __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  long __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  __pyx_t_5numpy_float64_t __pyx_t_49;
  __pyx_t_5numpy_float64_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("group_var_bin", 0);
  __pyx_pybuffer_nobs.pybuffer.buf = NULL;
  __pyx_pybuffer_nobs.refcount = 0;
  __pyx_pybuffernd_nobs.data = NULL;
  __pyx_pybuffernd_nobs.rcbuffer = &__pyx_pybuffer_nobs;
  __pyx_pybuffer_sumx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumx.refcount = 0;
  __pyx_pybuffernd_sumx.data = NULL;
  __pyx_pybuffernd_sumx.rcbuffer = &__pyx_pybuffer_sumx;
  __pyx_pybuffer_sumxx.pybuffer.buf = NULL;
  __pyx_pybuffer_sumxx.refcount = 0;
  __pyx_pybuffernd_sumxx.data = NULL;
  __pyx_pybuffernd_sumxx.rcbuffer = &__pyx_pybuffer_sumxx;
  __pyx_pybuffer_out.pybuffer.buf = NULL;
  __pyx_pybuffer_out.refcount = 0;
  __pyx_pybuffernd_out.data = NULL;
  __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
  __pyx_pybuffer_counts.pybuffer.buf = NULL;
  __pyx_pybuffer_counts.refcount = 0;
  __pyx_pybuffernd_counts.data = NULL;
  __pyx_pybuffernd_counts.rcbuffer = &__pyx_pybuffer_counts;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_bins.pybuffer.buf = NULL;
  __pyx_pybuffer_bins.refcount = 0;
  __pyx_pybuffernd_bins.data = NULL;
  __pyx_pybuffernd_bins.rcbuffer = &__pyx_pybuffer_bins;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bins.rcbuffer->pybuffer, (PyObject*)__pyx_v_bins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_bins.diminfo[0].strides = __pyx_pybuffernd_bins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bins.diminfo[0].shape = __pyx_pybuffernd_bins.rcbuffer->pybuffer.shape[0];

  /* "pandas/algos.pyx":3087
 *         ndarray[float64_t, ndim=2] nobs, sumx, sumxx
 * 
 *     nobs = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumx = np.zeros_like(out)
 *     sumxx = np.zeros_like(out)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer, (PyObject*)__pyx_v_nobs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_nobs.diminfo[0].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nobs.diminfo[0].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nobs.diminfo[1].strides = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nobs.diminfo[1].shape = __pyx_pybuffernd_nobs.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_nobs = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":3088
 * 
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 *     sumxx = np.zeros_like(out)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
      }
    }
    __pyx_pybuffernd_sumx.diminfo[0].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumx.diminfo[0].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumx.diminfo[1].strides = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumx.diminfo[1].shape = __pyx_pybuffernd_sumx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumx = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/algos.pyx":3089
 *     nobs = np.zeros_like(out)
 *     sumx = np.zeros_like(out)
 *     sumxx = np.zeros_like(out)             # <<<<<<<<<<<<<<
 * 
 *     if bins[len(bins) - 1] == len(values):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_out));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_out));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_out));
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
    __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_5 < 0)) {
      PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer, (PyObject*)__pyx_v_sumxx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_sumxx.diminfo[0].strides = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sumxx.diminfo[0].shape = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sumxx.diminfo[1].strides = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sumxx.diminfo[1].shape = __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = 0;
  __pyx_v_sumxx = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/algos.pyx":3091
 *     sumxx = np.zeros_like(out)
 * 
 *     if bins[len(bins) - 1] == len(values):             # <<<<<<<<<<<<<<
 *         ngroups = len(bins)
 *     else:
 */
  __pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = (__pyx_t_9 - 1);
  __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bins.diminfo[0].strides)) == __pyx_t_11);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":3092
 * 
 *     if bins[len(bins) - 1] == len(values):
 *         ngroups = len(bins)             # <<<<<<<<<<<<<<
 *     else:
 *         ngroups = len(bins) + 1
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = __pyx_t_11;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/algos.pyx":3094
 *         ngroups = len(bins)
 *     else:
 *         ngroups = len(bins) + 1             # <<<<<<<<<<<<<<
 * 
 *     N, K = (<object> values).shape
 */
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_bins)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_ngroups = (__pyx_t_11 + 1);
  }
  __pyx_L3:;

  /* "pandas/algos.pyx":3096
 *         ngroups = len(bins) + 1
 * 
 *     N, K = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     b = 0
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_13 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_2)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_14 = NULL;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_14 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_N = __pyx_t_11;
  __pyx_v_K = __pyx_t_9;

  /* "pandas/algos.pyx":3098
 *     N, K = (<object> values).shape
 * 
 *     b = 0             # <<<<<<<<<<<<<<
 *     if K > 1:
 *         for i in range(N):
 */
  __pyx_v_b = 0;

  /* "pandas/algos.pyx":3099
 * 
 *     b = 0
 *     if K > 1:             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 */
  __pyx_t_12 = (__pyx_v_K > 1);
  if (__pyx_t_12) {

    /* "pandas/algos.pyx":3100
 *     b = 0
 *     if K > 1:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":3101
 *     if K > 1:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_12 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_12) {
          __pyx_t_15 = __pyx_v_b;
          __pyx_t_16 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_17 = __pyx_t_16;
        } else {
          __pyx_t_17 = __pyx_t_12;
        }
        if (!__pyx_t_17) break;

        /* "pandas/algos.pyx":3102
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":3104
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 * 
 *             for j in range(K):
 */
      __pyx_t_18 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":3106
 *             counts[b] += 1
 * 
 *             for j in range(K):             # <<<<<<<<<<<<<<
 *                 val = values[i, j]
 * 
 */
      __pyx_t_19 = __pyx_v_K;
      for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
        __pyx_v_j = __pyx_t_20;

        /* "pandas/algos.pyx":3107
 * 
 *             for j in range(K):
 *                 val = values[i, j]             # <<<<<<<<<<<<<<
 * 
 *                 # not nan
 */
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_22 = __pyx_v_j;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_values.diminfo[1].strides));

        /* "pandas/algos.pyx":3110
 * 
 *                 # not nan
 *                 if val == val:             # <<<<<<<<<<<<<<
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val
 */
        __pyx_t_17 = (__pyx_v_val == __pyx_v_val);
        if (__pyx_t_17) {

          /* "pandas/algos.pyx":3111
 *                 # not nan
 *                 if val == val:
 *                     nobs[b, j] += 1             # <<<<<<<<<<<<<<
 *                     sumx[b, j] += val
 *                     sumxx[b, j] += val * val
 */
          __pyx_t_23 = __pyx_v_b;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

          /* "pandas/algos.pyx":3112
 *                 if val == val:
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val             # <<<<<<<<<<<<<<
 *                     sumxx[b, j] += val * val
 *     else:
 */
          __pyx_t_25 = __pyx_v_b;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;

          /* "pandas/algos.pyx":3113
 *                     nobs[b, j] += 1
 *                     sumx[b, j] += val
 *                     sumxx[b, j] += val * val             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(N):
 */
          __pyx_t_27 = __pyx_v_b;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_sumxx.diminfo[1].strides) += (__pyx_v_val * __pyx_v_val);
          goto __pyx_L13;
        }
        __pyx_L13:;
      }
    }
    goto __pyx_L6;
  }
  /*else*/ {

    /* "pandas/algos.pyx":3115
 *                     sumxx[b, j] += val * val
 *     else:
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1
 */
    __pyx_t_9 = __pyx_v_N;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pandas/algos.pyx":3116
 *     else:
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:             # <<<<<<<<<<<<<<
 *                 b += 1
 * 
 */
      while (1) {
        __pyx_t_17 = (__pyx_v_b < (__pyx_v_ngroups - 1));
        if (__pyx_t_17) {
          __pyx_t_19 = __pyx_v_b;
          __pyx_t_12 = (__pyx_v_i >= (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_bins.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bins.diminfo[0].strides)));
          __pyx_t_16 = __pyx_t_12;
        } else {
          __pyx_t_16 = __pyx_t_17;
        }
        if (!__pyx_t_16) break;

        /* "pandas/algos.pyx":3117
 *         for i in range(N):
 *             while b < ngroups - 1 and i >= bins[b]:
 *                 b += 1             # <<<<<<<<<<<<<<
 * 
 *             counts[b] += 1
 */
        __pyx_v_b = (__pyx_v_b + 1);
      }

      /* "pandas/algos.pyx":3119
 *                 b += 1
 * 
 *             counts[b] += 1             # <<<<<<<<<<<<<<
 *             val = values[i, 0]
 * 
 */
      __pyx_t_20 = __pyx_v_b;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_counts.diminfo[0].strides) += 1;

      /* "pandas/algos.pyx":3120
 * 
 *             counts[b] += 1
 *             val = values[i, 0]             # <<<<<<<<<<<<<<
 * 
 *             # not nan
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_30 = 0;
      __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_values.diminfo[1].strides));

      /* "pandas/algos.pyx":3123
 * 
 *             # not nan
 *             if val == val:             # <<<<<<<<<<<<<<
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val
 */
      __pyx_t_16 = (__pyx_v_val == __pyx_v_val);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":3124
 *             # not nan
 *             if val == val:
 *                 nobs[b, 0] += 1             # <<<<<<<<<<<<<<
 *                 sumx[b, 0] += val
 *                 sumxx[b, 0] += val * val
 */
        __pyx_t_31 = __pyx_v_b;
        __pyx_t_32 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nobs.diminfo[1].strides) += 1.0;

        /* "pandas/algos.pyx":3125
 *             if val == val:
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val             # <<<<<<<<<<<<<<
 *                 sumxx[b, 0] += val * val
 * 
 */
        __pyx_t_33 = __pyx_v_b;
        __pyx_t_34 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_sumx.diminfo[1].strides) += __pyx_v_val;

        /* "pandas/algos.pyx":3126
 *                 nobs[b, 0] += 1
 *                 sumx[b, 0] += val
 *                 sumxx[b, 0] += val * val             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ngroups):
 */
        __pyx_t_35 = __pyx_v_b;
        __pyx_t_36 = 0;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_sumxx.diminfo[1].strides) += (__pyx_v_val * __pyx_v_val);
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
  }
  __pyx_L6:;

  /* "pandas/algos.pyx":3128
 *                 sumxx[b, 0] += val * val
 * 
 *     for i in range(ngroups):             # <<<<<<<<<<<<<<
 *         for j in range(K):
 *             ct = nobs[i, j]
 */
  __pyx_t_9 = __pyx_v_ngroups;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
    __pyx_v_i = __pyx_t_11;

    /* "pandas/algos.pyx":3129
 * 
 *     for i in range(ngroups):
 *         for j in range(K):             # <<<<<<<<<<<<<<
 *             ct = nobs[i, j]
 *             if ct < 2:
 */
    __pyx_t_37 = __pyx_v_K;
    for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) {
      __pyx_v_j = __pyx_t_38;

      /* "pandas/algos.pyx":3130
 *     for i in range(ngroups):
 *         for j in range(K):
 *             ct = nobs[i, j]             # <<<<<<<<<<<<<<
 *             if ct < 2:
 *                 out[i, j] = nan
 */
      __pyx_t_39 = __pyx_v_i;
      __pyx_t_40 = __pyx_v_j;
      __pyx_v_ct = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_nobs.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_nobs.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_nobs.diminfo[1].strides));

      /* "pandas/algos.pyx":3131
 *         for j in range(K):
 *             ct = nobs[i, j]
 *             if ct < 2:             # <<<<<<<<<<<<<<
 *                 out[i, j] = nan
 *             else:
 */
      __pyx_t_16 = (__pyx_v_ct < 2.0);
      if (__pyx_t_16) {

        /* "pandas/algos.pyx":3132
 *             ct = nobs[i, j]
 *             if ct < 2:
 *                 out[i, j] = nan             # <<<<<<<<<<<<<<
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
 */
        __pyx_t_41 = __pyx_v_i;
        __pyx_t_42 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_out.diminfo[1].strides) = __pyx_v_6pandas_5algos_nan;
        goto __pyx_L23;
      }
      /*else*/ {

        /* "pandas/algos.pyx":3134
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /             # <<<<<<<<<<<<<<
 *                              (ct * ct - ct))
 * 
 */
        __pyx_t_43 = __pyx_v_i;
        __pyx_t_44 = __pyx_v_j;
        __pyx_t_45 = __pyx_v_i;
        __pyx_t_46 = __pyx_v_j;
        __pyx_t_47 = __pyx_v_i;
        __pyx_t_48 = __pyx_v_j;
        __pyx_t_49 = ((__pyx_v_ct * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumxx.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_sumxx.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_sumxx.diminfo[1].strides))) - ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_sumx.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_sumx.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_sumx.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_sumx.diminfo[1].strides))));

        /* "pandas/algos.pyx":3135
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
 *                              (ct * ct - ct))             # <<<<<<<<<<<<<<
 * 
 * include "join.pyx"
 */
        __pyx_t_50 = ((__pyx_v_ct * __pyx_v_ct) - __pyx_v_ct);
        if (unlikely(__pyx_t_50 == 0)) {
          PyErr_Format(PyExc_ZeroDivisionError, "float division");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }

        /* "pandas/algos.pyx":3134
 *                 out[i, j] = nan
 *             else:
 *                 out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /             # <<<<<<<<<<<<<<
 *                              (ct * ct - ct))
 * 
 */
        __pyx_t_51 = __pyx_v_i;
        __pyx_t_52 = __pyx_v_j;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_out.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_out.diminfo[1].strides) = (__pyx_t_49 / __pyx_t_50);
      }
      __pyx_L23:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.group_var_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bins.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_counts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_nobs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sumxx.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_nobs);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumx);
  __Pyx_XDECREF((PyObject *)__pyx_v_sumxx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_113inner_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_113inner_join = {__Pyx_NAMESTR("inner_join"), (PyCFunction)__pyx_pw_6pandas_5algos_113inner_join, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_113inner_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  Py_ssize_t __pyx_v_max_groups;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inner_join (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,&__pyx_n_s__max_groups,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_groups)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inner_join") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
    __pyx_v_max_groups = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_max_groups == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("inner_join", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.inner_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_112inner_join(__pyx_self, __pyx_v_left, __pyx_v_right, __pyx_v_max_groups);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":1
 * def inner_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                Py_ssize_t max_groups):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_112inner_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_count;
  PyArrayObject *__pyx_v_left_count = 0;
  PyArrayObject *__pyx_v_right_count = 0;
  PyArrayObject *__pyx_v_left_sorter = 0;
  PyArrayObject *__pyx_v_right_sorter = 0;
  PyArrayObject *__pyx_v_left_indexer = 0;
  PyArrayObject *__pyx_v_right_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_lc;
  __pyx_t_5numpy_int64_t __pyx_v_rc;
  Py_ssize_t __pyx_v_left_pos;
  Py_ssize_t __pyx_v_right_pos;
  Py_ssize_t __pyx_v_position;
  Py_ssize_t __pyx_v_offset;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_count;
  __Pyx_Buffer __pyx_pybuffer_left_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_indexer;
  __Pyx_Buffer __pyx_pybuffer_left_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_sorter;
  __Pyx_Buffer __pyx_pybuffer_left_sorter;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_count;
  __Pyx_Buffer __pyx_pybuffer_right_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_indexer;
  __Pyx_Buffer __pyx_pybuffer_right_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_sorter;
  __Pyx_Buffer __pyx_pybuffer_right_sorter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyArrayObject *__pyx_t_21 = NULL;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  __pyx_t_5numpy_int64_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inner_join", 0);
  __pyx_pybuffer_left_count.pybuffer.buf = NULL;
  __pyx_pybuffer_left_count.refcount = 0;
  __pyx_pybuffernd_left_count.data = NULL;
  __pyx_pybuffernd_left_count.rcbuffer = &__pyx_pybuffer_left_count;
  __pyx_pybuffer_right_count.pybuffer.buf = NULL;
  __pyx_pybuffer_right_count.refcount = 0;
  __pyx_pybuffernd_right_count.data = NULL;
  __pyx_pybuffernd_right_count.rcbuffer = &__pyx_pybuffer_right_count;
  __pyx_pybuffer_left_sorter.pybuffer.buf = NULL;
  __pyx_pybuffer_left_sorter.refcount = 0;
  __pyx_pybuffernd_left_sorter.data = NULL;
  __pyx_pybuffernd_left_sorter.rcbuffer = &__pyx_pybuffer_left_sorter;
  __pyx_pybuffer_right_sorter.pybuffer.buf = NULL;
  __pyx_pybuffer_right_sorter.refcount = 0;
  __pyx_pybuffernd_right_sorter.data = NULL;
  __pyx_pybuffernd_right_sorter.rcbuffer = &__pyx_pybuffer_right_sorter;
  __pyx_pybuffer_left_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_left_indexer.refcount = 0;
  __pyx_pybuffernd_left_indexer.data = NULL;
  __pyx_pybuffernd_left_indexer.rcbuffer = &__pyx_pybuffer_left_indexer;
  __pyx_pybuffer_right_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_right_indexer.refcount = 0;
  __pyx_pybuffernd_right_indexer.data = NULL;
  __pyx_pybuffernd_right_indexer.rcbuffer = &__pyx_pybuffer_right_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/join.pyx":4
 *                Py_ssize_t max_groups):
 *     cdef:
 *         Py_ssize_t i, j, k, count = 0             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] left_count, right_count, left_sorter, right_sorter
 *         ndarray[int64_t] left_indexer, right_indexer
 */
  __pyx_v_count = 0;

  /* "pandas/src/join.pyx":11
 *     # NA group in location 0
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)             # <<<<<<<<<<<<<<
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_left));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_sorter, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_sorter.diminfo[0].strides = __pyx_pybuffernd_left_sorter.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_sorter.diminfo[0].shape = __pyx_pybuffernd_left_sorter.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_left_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_left_count.diminfo[0].strides = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_count.diminfo[0].shape = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_left_count = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/join.pyx":12
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)             # <<<<<<<<<<<<<<
 * 
 *     # First pass, determine size of result set, do not use the NA group
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_right));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_sorter, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_right_sorter.diminfo[0].strides = __pyx_pybuffernd_right_sorter.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_sorter.diminfo[0].shape = __pyx_pybuffernd_right_sorter.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_right_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_count.diminfo[0].strides = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_count.diminfo[0].shape = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_right_count = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/join.pyx":15
 * 
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         lc = left_count[i]
 *         rc = right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":16
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]             # <<<<<<<<<<<<<<
 *         rc = right_count[i]
 * 
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_left_count.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_lc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_left_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":17
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]
 *         rc = right_count[i]             # <<<<<<<<<<<<<<
 * 
 *         if rc > 0 and lc > 0:
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_right_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":19
 *         rc = right_count[i]
 * 
 *         if rc > 0 and lc > 0:             # <<<<<<<<<<<<<<
 *             count += lc * rc
 * 
 */
    __pyx_t_15 = (__pyx_v_rc > 0);
    if (__pyx_t_15) {
      __pyx_t_16 = (__pyx_v_lc > 0);
      __pyx_t_17 = __pyx_t_16;
    } else {
      __pyx_t_17 = __pyx_t_15;
    }
    if (__pyx_t_17) {

      /* "pandas/src/join.pyx":20
 * 
 *         if rc > 0 and lc > 0:
 *             count += lc * rc             # <<<<<<<<<<<<<<
 * 
 *     # group 0 is the NA group
 */
      __pyx_v_count = (__pyx_v_count + (__pyx_v_lc * __pyx_v_rc));
      goto __pyx_L9;
    }
    __pyx_L9:;
  }

  /* "pandas/src/join.pyx":24
 *     # group 0 is the NA group
 *     cdef:
 *         Py_ssize_t loc, left_pos = 0, right_pos = 0, position = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t offset
 * 
 */
  __pyx_v_left_pos = 0;
  __pyx_v_right_pos = 0;
  __pyx_v_position = 0;

  /* "pandas/src/join.pyx":28
 * 
 *     # exclude the NA group
 *     left_pos = left_count[0]             # <<<<<<<<<<<<<<
 *     right_pos = right_count[0]
 * 
 */
  __pyx_t_18 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_18 < 0) {
    __pyx_t_18 += __pyx_pybuffernd_left_count.diminfo[0].shape;
    if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_left_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":29
 *     # exclude the NA group
 *     left_pos = left_count[0]
 *     right_pos = right_count[0]             # <<<<<<<<<<<<<<
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 */
  __pyx_t_19 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_19 < 0) {
    __pyx_t_19 += __pyx_pybuffernd_right_count.diminfo[0].shape;
    if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_right_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":31
 *     right_pos = right_count[0]
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_20) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_20) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_20, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_20);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_indexer.diminfo[0].strides = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_indexer.diminfo[0].shape = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_left_indexer = ((PyArrayObject *)__pyx_t_20);
  __pyx_t_20 = 0;

  /* "pandas/src/join.pyx":32
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 *     right_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, max_groups + 1):
 */
  __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_20);
  __pyx_t_20 = 0;
  __pyx_t_20 = PyDict_New(); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_20));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_20, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_indexer.diminfo[0].strides = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_indexer.diminfo[0].shape = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_right_indexer = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/src/join.pyx":34
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         lc = left_count[i]
 *         rc = right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":35
 * 
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]             # <<<<<<<<<<<<<<
 *         rc = right_count[i]
 * 
 */
    __pyx_t_22 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_22 < 0) {
      __pyx_t_22 += __pyx_pybuffernd_left_count.diminfo[0].shape;
      if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_lc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":36
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]
 *         rc = right_count[i]             # <<<<<<<<<<<<<<
 * 
 *         if rc > 0 and lc > 0:
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_23 < 0) {
      __pyx_t_23 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_23 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_right_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":38
 *         rc = right_count[i]
 * 
 *         if rc > 0 and lc > 0:             # <<<<<<<<<<<<<<
 *             for j in range(lc):
 *                 offset = position + j * rc
 */
    __pyx_t_17 = (__pyx_v_rc > 0);
    if (__pyx_t_17) {
      __pyx_t_15 = (__pyx_v_lc > 0);
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_17;
    }
    if (__pyx_t_16) {

      /* "pandas/src/join.pyx":39
 * 
 *         if rc > 0 and lc > 0:
 *             for j in range(lc):             # <<<<<<<<<<<<<<
 *                 offset = position + j * rc
 *                 for k in range(rc):
 */
      __pyx_t_24 = __pyx_v_lc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":40
 *         if rc > 0 and lc > 0:
 *             for j in range(lc):
 *                 offset = position + j * rc             # <<<<<<<<<<<<<<
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 */
        __pyx_v_offset = (__pyx_v_position + (__pyx_v_j * __pyx_v_rc));

        /* "pandas/src/join.pyx":41
 *             for j in range(lc):
 *                 offset = position + j * rc
 *                 for k in range(rc):             # <<<<<<<<<<<<<<
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 */
        __pyx_t_26 = __pyx_v_rc;
        for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
          __pyx_v_k = __pyx_t_27;

          /* "pandas/src/join.pyx":42
 *                 offset = position + j * rc
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j             # <<<<<<<<<<<<<<
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 */
          __pyx_t_28 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_28 < 0) {
            __pyx_t_28 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = (__pyx_v_left_pos + __pyx_v_j);

          /* "pandas/src/join.pyx":43
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k             # <<<<<<<<<<<<<<
 *             position += lc * rc
 *         left_pos += lc
 */
          __pyx_t_29 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_29 < 0) {
            __pyx_t_29 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_29 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = (__pyx_v_right_pos + __pyx_v_k);
        }
      }

      /* "pandas/src/join.pyx":44
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc             # <<<<<<<<<<<<<<
 *         left_pos += lc
 *         right_pos += rc
 */
      __pyx_v_position = (__pyx_v_position + (__pyx_v_lc * __pyx_v_rc));
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "pandas/src/join.pyx":45
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 *         left_pos += lc             # <<<<<<<<<<<<<<
 *         right_pos += rc
 * 
 */
    __pyx_v_left_pos = (__pyx_v_left_pos + __pyx_v_lc);

    /* "pandas/src/join.pyx":46
 *             position += lc * rc
 *         left_pos += lc
 *         right_pos += rc             # <<<<<<<<<<<<<<
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),
 */
    __pyx_v_right_pos = (__pyx_v_right_pos + __pyx_v_rc);
  }

  /* "pandas/src/join.pyx":48
 *         right_pos += rc
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),             # <<<<<<<<<<<<<<
 *             _get_result_indexer(right_sorter, right_indexer))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_INCREF(((PyObject *)__pyx_v_left_sorter));
  PyTuple_SET_ITEM(__pyx_t_20, 0, ((PyObject *)__pyx_v_left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_left_indexer));
  PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_indexer));
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;

  /* "pandas/src/join.pyx":49
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),
 *             _get_result_indexer(right_sorter, right_indexer))             # <<<<<<<<<<<<<<
 * 
 * def left_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,
 */
  __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_right_sorter));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_right_indexer));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_indexer));
  __pyx_t_1 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_20);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.inner_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_left_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_115left_outer_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_115left_outer_join = {__Pyx_NAMESTR("left_outer_join"), (PyCFunction)__pyx_pw_6pandas_5algos_115left_outer_join, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_115left_outer_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  Py_ssize_t __pyx_v_max_groups;
  PyObject *__pyx_v_sort = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_outer_join (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,&__pyx_n_s__max_groups,&__pyx_n_s__sort,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = __pyx_k_47;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_outer_join", 0, 3, 4, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_groups)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_outer_join", 0, 3, 4, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sort);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_outer_join") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
    __pyx_v_max_groups = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_max_groups == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_sort = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_outer_join", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_outer_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_114left_outer_join(__pyx_self, __pyx_v_left, __pyx_v_right, __pyx_v_max_groups, __pyx_v_sort);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":51
 *             _get_result_indexer(right_sorter, right_indexer))
 * 
 * def left_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                     Py_ssize_t max_groups, sort=True):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_114left_outer_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups, PyObject *__pyx_v_sort) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_count;
  PyArrayObject *__pyx_v_left_count = 0;
  PyArrayObject *__pyx_v_right_count = 0;
  PyArrayObject *__pyx_v_left_sorter = 0;
  PyArrayObject *__pyx_v_right_sorter = 0;
  PyArrayObject *__pyx_v_rev = 0;
  PyArrayObject *__pyx_v_left_indexer = 0;
  PyArrayObject *__pyx_v_right_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_lc;
  __pyx_t_5numpy_int64_t __pyx_v_rc;
  Py_ssize_t __pyx_v_left_pos;
  Py_ssize_t __pyx_v_right_pos;
  Py_ssize_t __pyx_v_position;
  Py_ssize_t __pyx_v_offset;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_count;
  __Pyx_Buffer __pyx_pybuffer_left_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_indexer;
  __Pyx_Buffer __pyx_pybuffer_left_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_count;
  __Pyx_Buffer __pyx_pybuffer_right_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_indexer;
  __Pyx_Buffer __pyx_pybuffer_right_indexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyArrayObject *__pyx_t_21 = NULL;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  __pyx_t_5numpy_int64_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  int __pyx_t_32;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_outer_join", 0);
  __pyx_pybuffer_left_count.pybuffer.buf = NULL;
  __pyx_pybuffer_left_count.refcount = 0;
  __pyx_pybuffernd_left_count.data = NULL;
  __pyx_pybuffernd_left_count.rcbuffer = &__pyx_pybuffer_left_count;
  __pyx_pybuffer_right_count.pybuffer.buf = NULL;
  __pyx_pybuffer_right_count.refcount = 0;
  __pyx_pybuffernd_right_count.data = NULL;
  __pyx_pybuffernd_right_count.rcbuffer = &__pyx_pybuffer_right_count;
  __pyx_pybuffer_left_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_left_indexer.refcount = 0;
  __pyx_pybuffernd_left_indexer.data = NULL;
  __pyx_pybuffernd_left_indexer.rcbuffer = &__pyx_pybuffer_left_indexer;
  __pyx_pybuffer_right_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_right_indexer.refcount = 0;
  __pyx_pybuffernd_right_indexer.data = NULL;
  __pyx_pybuffernd_right_indexer.rcbuffer = &__pyx_pybuffer_right_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/join.pyx":54
 *                     Py_ssize_t max_groups, sort=True):
 *     cdef:
 *         Py_ssize_t i, j, k, count = 0             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] left_count, right_count
 *         ndarray left_sorter, right_sorter, rev
 */
  __pyx_v_count = 0;

  /* "pandas/src/join.pyx":62
 *     # NA group in location 0
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)             # <<<<<<<<<<<<<<
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_left));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_left_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_count.diminfo[0].strides = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_count.diminfo[0].shape = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_left_count = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/join.pyx":63
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)             # <<<<<<<<<<<<<<
 * 
 *     # First pass, determine size of result set, do not use the NA group
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_right));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_right_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_count.diminfo[0].strides = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_count.diminfo[0].shape = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_right_count = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/join.pyx":66
 * 
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         if right_count[i] > 0:
 *             count += left_count[i] * right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":67
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):
 *         if right_count[i] > 0:             # <<<<<<<<<<<<<<
 *             count += left_count[i] * right_count[i]
 *         else:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_14 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_right_count.diminfo[0].strides)) > 0);
    if (__pyx_t_14) {

      /* "pandas/src/join.pyx":68
 *     for i in range(1, max_groups + 1):
 *         if right_count[i] > 0:
 *             count += left_count[i] * right_count[i]             # <<<<<<<<<<<<<<
 *         else:
 *             count += left_count[i]
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_7 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_pybuffernd_left_count.diminfo[0].shape;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_7 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_right_count.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_count = (__pyx_v_count + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_left_count.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_right_count.diminfo[0].strides))));
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":70
 *             count += left_count[i] * right_count[i]
 *         else:
 *             count += left_count[i]             # <<<<<<<<<<<<<<
 * 
 *     # group 0 is the NA group
 */
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_7 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_left_count.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
      if (unlikely(__pyx_t_7 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_7);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_count = (__pyx_v_count + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_left_count.diminfo[0].strides)));
    }
    __pyx_L9:;
  }

  /* "pandas/src/join.pyx":74
 *     # group 0 is the NA group
 *     cdef:
 *         Py_ssize_t loc, left_pos = 0, right_pos = 0, position = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t offset
 * 
 */
  __pyx_v_left_pos = 0;
  __pyx_v_right_pos = 0;
  __pyx_v_position = 0;

  /* "pandas/src/join.pyx":78
 * 
 *     # exclude the NA group
 *     left_pos = left_count[0]             # <<<<<<<<<<<<<<
 *     right_pos = right_count[0]
 * 
 */
  __pyx_t_18 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_18 < 0) {
    __pyx_t_18 += __pyx_pybuffernd_left_count.diminfo[0].shape;
    if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_left_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":79
 *     # exclude the NA group
 *     left_pos = left_count[0]
 *     right_pos = right_count[0]             # <<<<<<<<<<<<<<
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 */
  __pyx_t_19 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_19 < 0) {
    __pyx_t_19 += __pyx_pybuffernd_right_count.diminfo[0].shape;
    if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_right_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":81
 *     right_pos = right_count[0]
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_20) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_20) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_20, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_20);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_indexer.diminfo[0].strides = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_indexer.diminfo[0].shape = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_left_indexer = ((PyArrayObject *)__pyx_t_20);
  __pyx_t_20 = 0;

  /* "pandas/src/join.pyx":82
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 *     right_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, max_groups + 1):
 */
  __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_20);
  __pyx_t_20 = 0;
  __pyx_t_20 = PyDict_New(); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_20));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_20, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_indexer.diminfo[0].strides = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_indexer.diminfo[0].shape = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_right_indexer = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/src/join.pyx":84
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         lc = left_count[i]
 *         rc = right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":85
 * 
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]             # <<<<<<<<<<<<<<
 *         rc = right_count[i]
 * 
 */
    __pyx_t_22 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_22 < 0) {
      __pyx_t_22 += __pyx_pybuffernd_left_count.diminfo[0].shape;
      if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_lc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":86
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]
 *         rc = right_count[i]             # <<<<<<<<<<<<<<
 * 
 *         if rc == 0:
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_23 < 0) {
      __pyx_t_23 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_23 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_right_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":88
 *         rc = right_count[i]
 * 
 *         if rc == 0:             # <<<<<<<<<<<<<<
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j
 */
    __pyx_t_14 = (__pyx_v_rc == 0);
    if (__pyx_t_14) {

      /* "pandas/src/join.pyx":89
 * 
 *         if rc == 0:
 *             for j in range(lc):             # <<<<<<<<<<<<<<
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1
 */
      __pyx_t_24 = __pyx_v_lc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":90
 *         if rc == 0:
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j             # <<<<<<<<<<<<<<
 *                 right_indexer[position + j] = -1
 *             position += lc
 */
        __pyx_t_26 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = (__pyx_v_left_pos + __pyx_v_j);

        /* "pandas/src/join.pyx":91
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1             # <<<<<<<<<<<<<<
 *             position += lc
 *         else:
 */
        __pyx_t_27 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = -1;
      }

      /* "pandas/src/join.pyx":92
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1
 *             position += lc             # <<<<<<<<<<<<<<
 *         else:
 *             for j in range(lc):
 */
      __pyx_v_position = (__pyx_v_position + __pyx_v_lc);
      goto __pyx_L12;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":94
 *             position += lc
 *         else:
 *             for j in range(lc):             # <<<<<<<<<<<<<<
 *                 offset = position + j * rc
 *                 for k in range(rc):
 */
      __pyx_t_24 = __pyx_v_lc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":95
 *         else:
 *             for j in range(lc):
 *                 offset = position + j * rc             # <<<<<<<<<<<<<<
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 */
        __pyx_v_offset = (__pyx_v_position + (__pyx_v_j * __pyx_v_rc));

        /* "pandas/src/join.pyx":96
 *             for j in range(lc):
 *                 offset = position + j * rc
 *                 for k in range(rc):             # <<<<<<<<<<<<<<
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 */
        __pyx_t_28 = __pyx_v_rc;
        for (__pyx_t_29 = 0; __pyx_t_29 < __pyx_t_28; __pyx_t_29+=1) {
          __pyx_v_k = __pyx_t_29;

          /* "pandas/src/join.pyx":97
 *                 offset = position + j * rc
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j             # <<<<<<<<<<<<<<
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 */
          __pyx_t_30 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_30 < 0) {
            __pyx_t_30 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_30 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = (__pyx_v_left_pos + __pyx_v_j);

          /* "pandas/src/join.pyx":98
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k             # <<<<<<<<<<<<<<
 *             position += lc * rc
 *         left_pos += lc
 */
          __pyx_t_31 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_31 < 0) {
            __pyx_t_31 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_31 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = (__pyx_v_right_pos + __pyx_v_k);
        }
      }

      /* "pandas/src/join.pyx":99
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc             # <<<<<<<<<<<<<<
 *         left_pos += lc
 *         right_pos += rc
 */
      __pyx_v_position = (__pyx_v_position + (__pyx_v_lc * __pyx_v_rc));
    }
    __pyx_L12:;

    /* "pandas/src/join.pyx":100
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 *         left_pos += lc             # <<<<<<<<<<<<<<
 *         right_pos += rc
 * 
 */
    __pyx_v_left_pos = (__pyx_v_left_pos + __pyx_v_lc);

    /* "pandas/src/join.pyx":101
 *             position += lc * rc
 *         left_pos += lc
 *         right_pos += rc             # <<<<<<<<<<<<<<
 * 
 *     left_indexer = _get_result_indexer(left_sorter, left_indexer)
 */
    __pyx_v_right_pos = (__pyx_v_right_pos + __pyx_v_rc);
  }

  /* "pandas/src/join.pyx":103
 *         right_pos += rc
 * 
 *     left_indexer = _get_result_indexer(left_sorter, left_indexer)             # <<<<<<<<<<<<<<
 *     right_indexer = _get_result_indexer(right_sorter, right_indexer)
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_INCREF(((PyObject *)__pyx_v_left_sorter));
  PyTuple_SET_ITEM(__pyx_t_20, 0, ((PyObject *)__pyx_v_left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_left_indexer));
  PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_indexer));
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_indexer.diminfo[0].strides = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_indexer.diminfo[0].shape = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_left_indexer));
  __pyx_v_left_indexer = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":104
 * 
 *     left_indexer = _get_result_indexer(left_sorter, left_indexer)
 *     right_indexer = _get_result_indexer(right_sorter, right_indexer)             # <<<<<<<<<<<<<<
 * 
 *     if not sort:
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_INCREF(((PyObject *)__pyx_v_right_sorter));
  PyTuple_SET_ITEM(__pyx_t_20, 0, ((PyObject *)__pyx_v_right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_right_indexer));
  PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_indexer));
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_indexer.diminfo[0].strides = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_indexer.diminfo[0].shape = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_v_right_indexer));
  __pyx_v_right_indexer = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/src/join.pyx":106
 *     right_indexer = _get_result_indexer(right_sorter, right_indexer)
 * 
 *     if not sort:             # <<<<<<<<<<<<<<
 *         if left_sorter.dtype != np.int_:
 *             left_sorter = left_sorter.astype(np.int_)
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_sort); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_32 = (!__pyx_t_14);
  if (__pyx_t_32) {

    /* "pandas/src/join.pyx":107
 * 
 *     if not sort:
 *         if left_sorter.dtype != np.int_:             # <<<<<<<<<<<<<<
 *             left_sorter = left_sorter.astype(np.int_)
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_left_sorter), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s__int_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_20); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_32 = __Pyx_PyObject_IsTrue(__pyx_t_20); if (unlikely(__pyx_t_32 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    if (__pyx_t_32) {

      /* "pandas/src/join.pyx":108
 *     if not sort:
 *         if left_sorter.dtype != np.int_:
 *             left_sorter = left_sorter.astype(np.int_)             # <<<<<<<<<<<<<<
 * 
 *         rev = np.empty(len(left), dtype=np.int_)
 */
      __pyx_t_20 = PyObject_GetAttr(((PyObject *)__pyx_v_left_sorter), __pyx_n_s__astype); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_20);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_v_left_sorter));
      __pyx_v_left_sorter = ((PyArrayObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L20;
    }
    __pyx_L20:;

    /* "pandas/src/join.pyx":110
 *             left_sorter = left_sorter.astype(np.int_)
 * 
 *         rev = np.empty(len(left), dtype=np.int_)             # <<<<<<<<<<<<<<
 *         rev.put(left_sorter, np.arange(len(left)))
 * 
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_20);
    PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int_); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_20), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_rev = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pandas/src/join.pyx":111
 * 
 *         rev = np.empty(len(left), dtype=np.int_)
 *         rev.put(left_sorter, np.arange(len(left)))             # <<<<<<<<<<<<<<
 * 
 *         right_indexer = right_indexer.take(rev)
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_rev), __pyx_n_s__put); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_20 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__arange); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_left_sorter));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_left_sorter));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_left_sorter));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pandas/src/join.pyx":113
 *         rev.put(left_sorter, np.arange(len(left)))
 * 
 *         right_indexer = right_indexer.take(rev)             # <<<<<<<<<<<<<<
 *         left_indexer = left_indexer.take(rev)
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_right_indexer), __pyx_n_s__take); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_rev));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_rev));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rev));
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_21 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
      }
      __pyx_pybuffernd_right_indexer.diminfo[0].strides = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_indexer.diminfo[0].shape = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_21 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_right_indexer));
    __pyx_v_right_indexer = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pandas/src/join.pyx":114
 * 
 *         right_indexer = right_indexer.take(rev)
 *         left_indexer = left_indexer.take(rev)             # <<<<<<<<<<<<<<
 * 
 *     return left_indexer, right_indexer
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_left_indexer), __pyx_n_s__take); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_rev));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_rev));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_rev));
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
      }
      __pyx_pybuffernd_left_indexer.diminfo[0].strides = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_indexer.diminfo[0].shape = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_21 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_left_indexer));
    __pyx_v_left_indexer = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "pandas/src/join.pyx":116
 *         left_indexer = left_indexer.take(rev)
 * 
 *     return left_indexer, right_indexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_left_indexer));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_right_indexer));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_indexer));
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_20);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_outer_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_left_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_rev);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_117full_outer_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_117full_outer_join = {__Pyx_NAMESTR("full_outer_join"), (PyCFunction)__pyx_pw_6pandas_5algos_117full_outer_join, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_117full_outer_join(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  Py_ssize_t __pyx_v_max_groups;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("full_outer_join (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,&__pyx_n_s__max_groups,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("full_outer_join", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_groups)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("full_outer_join", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "full_outer_join") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __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_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
    __pyx_v_max_groups = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_max_groups == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("full_outer_join", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.full_outer_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_116full_outer_join(__pyx_self, __pyx_v_left, __pyx_v_right, __pyx_v_max_groups);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":120
 * 
 * 
 * def full_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t max_groups):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_116full_outer_join(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right, Py_ssize_t __pyx_v_max_groups) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_count;
  PyArrayObject *__pyx_v_left_count = 0;
  PyArrayObject *__pyx_v_right_count = 0;
  PyArrayObject *__pyx_v_left_sorter = 0;
  PyArrayObject *__pyx_v_right_sorter = 0;
  PyArrayObject *__pyx_v_left_indexer = 0;
  PyArrayObject *__pyx_v_right_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_lc;
  __pyx_t_5numpy_int64_t __pyx_v_rc;
  __pyx_t_5numpy_int64_t __pyx_v_left_pos;
  __pyx_t_5numpy_int64_t __pyx_v_right_pos;
  Py_ssize_t __pyx_v_offset;
  Py_ssize_t __pyx_v_position;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_count;
  __Pyx_Buffer __pyx_pybuffer_left_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_indexer;
  __Pyx_Buffer __pyx_pybuffer_left_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left_sorter;
  __Pyx_Buffer __pyx_pybuffer_left_sorter;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_count;
  __Pyx_Buffer __pyx_pybuffer_right_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_indexer;
  __Pyx_Buffer __pyx_pybuffer_right_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right_sorter;
  __Pyx_Buffer __pyx_pybuffer_right_sorter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  long __pyx_t_18;
  long __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyArrayObject *__pyx_t_21 = NULL;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  __pyx_t_5numpy_int64_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __pyx_t_5numpy_int64_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("full_outer_join", 0);
  __pyx_pybuffer_left_count.pybuffer.buf = NULL;
  __pyx_pybuffer_left_count.refcount = 0;
  __pyx_pybuffernd_left_count.data = NULL;
  __pyx_pybuffernd_left_count.rcbuffer = &__pyx_pybuffer_left_count;
  __pyx_pybuffer_right_count.pybuffer.buf = NULL;
  __pyx_pybuffer_right_count.refcount = 0;
  __pyx_pybuffernd_right_count.data = NULL;
  __pyx_pybuffernd_right_count.rcbuffer = &__pyx_pybuffer_right_count;
  __pyx_pybuffer_left_sorter.pybuffer.buf = NULL;
  __pyx_pybuffer_left_sorter.refcount = 0;
  __pyx_pybuffernd_left_sorter.data = NULL;
  __pyx_pybuffernd_left_sorter.rcbuffer = &__pyx_pybuffer_left_sorter;
  __pyx_pybuffer_right_sorter.pybuffer.buf = NULL;
  __pyx_pybuffer_right_sorter.refcount = 0;
  __pyx_pybuffernd_right_sorter.data = NULL;
  __pyx_pybuffernd_right_sorter.rcbuffer = &__pyx_pybuffer_right_sorter;
  __pyx_pybuffer_left_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_left_indexer.refcount = 0;
  __pyx_pybuffernd_left_indexer.data = NULL;
  __pyx_pybuffernd_left_indexer.rcbuffer = &__pyx_pybuffer_left_indexer;
  __pyx_pybuffer_right_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_right_indexer.refcount = 0;
  __pyx_pybuffernd_right_indexer.data = NULL;
  __pyx_pybuffernd_right_indexer.rcbuffer = &__pyx_pybuffer_right_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/join.pyx":123
 *                           Py_ssize_t max_groups):
 *     cdef:
 *         Py_ssize_t i, j, k, count = 0             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] left_count, right_count, left_sorter, right_sorter
 *         ndarray[int64_t] left_indexer, right_indexer
 */
  __pyx_v_count = 0;

  /* "pandas/src/join.pyx":130
 *     # NA group in location 0
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)             # <<<<<<<<<<<<<<
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_left));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_sorter, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_sorter.diminfo[0].strides = __pyx_pybuffernd_left_sorter.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_sorter.diminfo[0].shape = __pyx_pybuffernd_left_sorter.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_left_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_left_count.diminfo[0].strides = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_count.diminfo[0].shape = __pyx_pybuffernd_left_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_left_count = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/join.pyx":131
 * 
 *     left_sorter, left_count = groupsort_indexer(left, max_groups)
 *     right_sorter, right_count = groupsort_indexer(right, max_groups)             # <<<<<<<<<<<<<<
 * 
 *     # First pass, determine size of result set, do not use the NA group
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__groupsort_indexer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_max_groups); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_right));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_sorter, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_right_sorter.diminfo[0].strides = __pyx_pybuffernd_right_sorter.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_sorter.diminfo[0].shape = __pyx_pybuffernd_right_sorter.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_right_sorter = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_count, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_count.diminfo[0].strides = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_count.diminfo[0].shape = __pyx_pybuffernd_right_count.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_6 = 0;
  __pyx_v_right_count = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pandas/src/join.pyx":134
 * 
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         lc = left_count[i]
 *         rc = right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":135
 *     # First pass, determine size of result set, do not use the NA group
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]             # <<<<<<<<<<<<<<
 *         rc = right_count[i]
 * 
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_left_count.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_lc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_left_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":136
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]
 *         rc = right_count[i]             # <<<<<<<<<<<<<<
 * 
 *         if rc > 0 and lc > 0:
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_right_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":138
 *         rc = right_count[i]
 * 
 *         if rc > 0 and lc > 0:             # <<<<<<<<<<<<<<
 *             count += lc * rc
 *         else:
 */
    __pyx_t_15 = (__pyx_v_rc > 0);
    if (__pyx_t_15) {
      __pyx_t_16 = (__pyx_v_lc > 0);
      __pyx_t_17 = __pyx_t_16;
    } else {
      __pyx_t_17 = __pyx_t_15;
    }
    if (__pyx_t_17) {

      /* "pandas/src/join.pyx":139
 * 
 *         if rc > 0 and lc > 0:
 *             count += lc * rc             # <<<<<<<<<<<<<<
 *         else:
 *             count += lc + rc
 */
      __pyx_v_count = (__pyx_v_count + (__pyx_v_lc * __pyx_v_rc));
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":141
 *             count += lc * rc
 *         else:
 *             count += lc + rc             # <<<<<<<<<<<<<<
 * 
 *     # group 0 is the NA group
 */
      __pyx_v_count = (__pyx_v_count + (__pyx_v_lc + __pyx_v_rc));
    }
    __pyx_L9:;
  }

  /* "pandas/src/join.pyx":145
 *     # group 0 is the NA group
 *     cdef:
 *         int64_t left_pos = 0, right_pos = 0             # <<<<<<<<<<<<<<
 *         Py_ssize_t offset, position = 0
 * 
 */
  __pyx_v_left_pos = 0;
  __pyx_v_right_pos = 0;

  /* "pandas/src/join.pyx":146
 *     cdef:
 *         int64_t left_pos = 0, right_pos = 0
 *         Py_ssize_t offset, position = 0             # <<<<<<<<<<<<<<
 * 
 *     # exclude the NA group
 */
  __pyx_v_position = 0;

  /* "pandas/src/join.pyx":149
 * 
 *     # exclude the NA group
 *     left_pos = left_count[0]             # <<<<<<<<<<<<<<
 *     right_pos = right_count[0]
 * 
 */
  __pyx_t_18 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_18 < 0) {
    __pyx_t_18 += __pyx_pybuffernd_left_count.diminfo[0].shape;
    if (unlikely(__pyx_t_18 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_left_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":150
 *     # exclude the NA group
 *     left_pos = left_count[0]
 *     right_pos = right_count[0]             # <<<<<<<<<<<<<<
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 */
  __pyx_t_19 = 0;
  __pyx_t_7 = -1;
  if (__pyx_t_19 < 0) {
    __pyx_t_19 += __pyx_pybuffernd_right_count.diminfo[0].shape;
    if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 0;
  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
  if (unlikely(__pyx_t_7 != -1)) {
    __Pyx_RaiseBufferIndexError(__pyx_t_7);
    {__pyx_filename = __pyx_f[2]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_right_pos = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right_count.diminfo[0].strides));

  /* "pandas/src/join.pyx":152
 *     right_pos = right_count[0]
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_20) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_20) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_20, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_20);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
    }
    __pyx_pybuffernd_left_indexer.diminfo[0].strides = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_indexer.diminfo[0].shape = __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_left_indexer = ((PyArrayObject *)__pyx_t_20);
  __pyx_t_20 = 0;

  /* "pandas/src/join.pyx":153
 * 
 *     left_indexer = np.empty(count, dtype=np.int64)
 *     right_indexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(1, max_groups + 1):
 */
  __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_20, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_20);
  __pyx_t_20 = 0;
  __pyx_t_20 = PyDict_New(); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_20));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_20, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_20)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_21 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_right_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
    }
    __pyx_pybuffernd_right_indexer.diminfo[0].strides = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right_indexer.diminfo[0].shape = __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_21 = 0;
  __pyx_v_right_indexer = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pandas/src/join.pyx":155
 *     right_indexer = np.empty(count, dtype=np.int64)
 * 
 *     for i in range(1, max_groups + 1):             # <<<<<<<<<<<<<<
 *         lc = left_count[i]
 *         rc = right_count[i]
 */
  __pyx_t_11 = (__pyx_v_max_groups + 1);
  for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":156
 * 
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]             # <<<<<<<<<<<<<<
 *         rc = right_count[i]
 * 
 */
    __pyx_t_22 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_22 < 0) {
      __pyx_t_22 += __pyx_pybuffernd_left_count.diminfo[0].shape;
      if (unlikely(__pyx_t_22 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_lc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_count.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":157
 *     for i in range(1, max_groups + 1):
 *         lc = left_count[i]
 *         rc = right_count[i]             # <<<<<<<<<<<<<<
 * 
 *         if rc == 0:
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_7 = -1;
    if (__pyx_t_23 < 0) {
      __pyx_t_23 += __pyx_pybuffernd_right_count.diminfo[0].shape;
      if (unlikely(__pyx_t_23 < 0)) __pyx_t_7 = 0;
    } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_right_count.diminfo[0].shape)) __pyx_t_7 = 0;
    if (unlikely(__pyx_t_7 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_7);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_rc = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_count.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_right_count.diminfo[0].strides));

    /* "pandas/src/join.pyx":159
 *         rc = right_count[i]
 * 
 *         if rc == 0:             # <<<<<<<<<<<<<<
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j
 */
    __pyx_t_17 = (__pyx_v_rc == 0);
    if (__pyx_t_17) {

      /* "pandas/src/join.pyx":160
 * 
 *         if rc == 0:
 *             for j in range(lc):             # <<<<<<<<<<<<<<
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1
 */
      __pyx_t_24 = __pyx_v_lc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":161
 *         if rc == 0:
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j             # <<<<<<<<<<<<<<
 *                 right_indexer[position + j] = -1
 *             position += lc
 */
        __pyx_t_26 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = (__pyx_v_left_pos + __pyx_v_j);

        /* "pandas/src/join.pyx":162
 *             for j in range(lc):
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1             # <<<<<<<<<<<<<<
 *             position += lc
 *         elif lc == 0:
 */
        __pyx_t_27 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = -1;
      }

      /* "pandas/src/join.pyx":163
 *                 left_indexer[position + j] = left_pos + j
 *                 right_indexer[position + j] = -1
 *             position += lc             # <<<<<<<<<<<<<<
 *         elif lc == 0:
 *             for j in range(rc):
 */
      __pyx_v_position = (__pyx_v_position + __pyx_v_lc);
      goto __pyx_L12;
    }

    /* "pandas/src/join.pyx":164
 *                 right_indexer[position + j] = -1
 *             position += lc
 *         elif lc == 0:             # <<<<<<<<<<<<<<
 *             for j in range(rc):
 *                 left_indexer[position + j] = -1
 */
    __pyx_t_17 = (__pyx_v_lc == 0);
    if (__pyx_t_17) {

      /* "pandas/src/join.pyx":165
 *             position += lc
 *         elif lc == 0:
 *             for j in range(rc):             # <<<<<<<<<<<<<<
 *                 left_indexer[position + j] = -1
 *                 right_indexer[position + j] = right_pos + j
 */
      __pyx_t_24 = __pyx_v_rc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":166
 *         elif lc == 0:
 *             for j in range(rc):
 *                 left_indexer[position + j] = -1             # <<<<<<<<<<<<<<
 *                 right_indexer[position + j] = right_pos + j
 *             position += rc
 */
        __pyx_t_28 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = -1;

        /* "pandas/src/join.pyx":167
 *             for j in range(rc):
 *                 left_indexer[position + j] = -1
 *                 right_indexer[position + j] = right_pos + j             # <<<<<<<<<<<<<<
 *             position += rc
 *         else:
 */
        __pyx_t_29 = (__pyx_v_position + __pyx_v_j);
        __pyx_t_7 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = (__pyx_v_right_pos + __pyx_v_j);
      }

      /* "pandas/src/join.pyx":168
 *                 left_indexer[position + j] = -1
 *                 right_indexer[position + j] = right_pos + j
 *             position += rc             # <<<<<<<<<<<<<<
 *         else:
 *             for j in range(lc):
 */
      __pyx_v_position = (__pyx_v_position + __pyx_v_rc);
      goto __pyx_L12;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":170
 *             position += rc
 *         else:
 *             for j in range(lc):             # <<<<<<<<<<<<<<
 *                 offset = position + j * rc
 *                 for k in range(rc):
 */
      __pyx_t_24 = __pyx_v_lc;
      for (__pyx_t_25 = 0; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
        __pyx_v_j = __pyx_t_25;

        /* "pandas/src/join.pyx":171
 *         else:
 *             for j in range(lc):
 *                 offset = position + j * rc             # <<<<<<<<<<<<<<
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 */
        __pyx_v_offset = (__pyx_v_position + (__pyx_v_j * __pyx_v_rc));

        /* "pandas/src/join.pyx":172
 *             for j in range(lc):
 *                 offset = position + j * rc
 *                 for k in range(rc):             # <<<<<<<<<<<<<<
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 */
        __pyx_t_30 = __pyx_v_rc;
        for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
          __pyx_v_k = __pyx_t_31;

          /* "pandas/src/join.pyx":173
 *                 offset = position + j * rc
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j             # <<<<<<<<<<<<<<
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 */
          __pyx_t_32 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_32 < 0) {
            __pyx_t_32 += __pyx_pybuffernd_left_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_32 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_left_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_indexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_left_indexer.diminfo[0].strides) = (__pyx_v_left_pos + __pyx_v_j);

          /* "pandas/src/join.pyx":174
 *                 for k in range(rc):
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k             # <<<<<<<<<<<<<<
 *             position += lc * rc
 *         left_pos += lc
 */
          __pyx_t_33 = (__pyx_v_offset + __pyx_v_k);
          __pyx_t_7 = -1;
          if (__pyx_t_33 < 0) {
            __pyx_t_33 += __pyx_pybuffernd_right_indexer.diminfo[0].shape;
            if (unlikely(__pyx_t_33 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_right_indexer.diminfo[0].shape)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right_indexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_right_indexer.diminfo[0].strides) = (__pyx_v_right_pos + __pyx_v_k);
        }
      }

      /* "pandas/src/join.pyx":175
 *                     left_indexer[offset + k] = left_pos + j
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc             # <<<<<<<<<<<<<<
 *         left_pos += lc
 *         right_pos += rc
 */
      __pyx_v_position = (__pyx_v_position + (__pyx_v_lc * __pyx_v_rc));
    }
    __pyx_L12:;

    /* "pandas/src/join.pyx":176
 *                     right_indexer[offset + k] = right_pos + k
 *             position += lc * rc
 *         left_pos += lc             # <<<<<<<<<<<<<<
 *         right_pos += rc
 * 
 */
    __pyx_v_left_pos = (__pyx_v_left_pos + __pyx_v_lc);

    /* "pandas/src/join.pyx":177
 *             position += lc * rc
 *         left_pos += lc
 *         right_pos += rc             # <<<<<<<<<<<<<<
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),
 */
    __pyx_v_right_pos = (__pyx_v_right_pos + __pyx_v_rc);
  }

  /* "pandas/src/join.pyx":179
 *         right_pos += rc
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),             # <<<<<<<<<<<<<<
 *             _get_result_indexer(right_sorter, right_indexer))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_INCREF(((PyObject *)__pyx_v_left_sorter));
  PyTuple_SET_ITEM(__pyx_t_20, 0, ((PyObject *)__pyx_v_left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_left_indexer));
  PyTuple_SET_ITEM(__pyx_t_20, 1, ((PyObject *)__pyx_v_left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_left_indexer));
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0;

  /* "pandas/src/join.pyx":180
 * 
 *     return (_get_result_indexer(left_sorter, left_indexer),
 *             _get_result_indexer(right_sorter, right_indexer))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_20 = __Pyx_GetName(__pyx_m, __pyx_n_s___get_result_indexer); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_right_sorter));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_v_right_indexer));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_right_indexer));
  __pyx_t_1 = PyObject_Call(__pyx_t_20, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_20);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.full_outer_join", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_sorter.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_count.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right_sorter.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_left_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_count);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_sorter);
  __Pyx_XDECREF((PyObject *)__pyx_v_left_indexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_right_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_119_get_result_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_119_get_result_indexer = {__Pyx_NAMESTR("_get_result_indexer"), (PyCFunction)__pyx_pw_6pandas_5algos_119_get_result_indexer, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_119_get_result_indexer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sorter = 0;
  PyObject *__pyx_v_indexer = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_result_indexer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sorter,&__pyx_n_s__indexer,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sorter)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_get_result_indexer", 1, 2, 2, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_result_indexer") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_sorter = values[0];
    __pyx_v_indexer = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_get_result_indexer", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos._get_result_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6pandas_5algos_118_get_result_indexer(__pyx_self, __pyx_v_sorter, __pyx_v_indexer);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":184
 * 
 * 
 * def _get_result_indexer(sorter, indexer):             # <<<<<<<<<<<<<<
 *     if indexer.dtype != np.int_:
 *         indexer = indexer.astype(np.int_)
 */

static PyObject *__pyx_pf_6pandas_5algos_118_get_result_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sorter, PyObject *__pyx_v_indexer) {
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_result_indexer", 0);
  __Pyx_INCREF(__pyx_v_indexer);

  /* "pandas/src/join.pyx":185
 * 
 * def _get_result_indexer(sorter, indexer):
 *     if indexer.dtype != np.int_:             # <<<<<<<<<<<<<<
 *         indexer = indexer.astype(np.int_)
 *     if len(sorter) > 0:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_indexer, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int_); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {

    /* "pandas/src/join.pyx":186
 * def _get_result_indexer(sorter, indexer):
 *     if indexer.dtype != np.int_:
 *         indexer = indexer.astype(np.int_)             # <<<<<<<<<<<<<<
 *     if len(sorter) > 0:
 *         res = sorter.take(indexer)
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_indexer, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_indexer);
    __pyx_v_indexer = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/join.pyx":187
 *     if indexer.dtype != np.int_:
 *         indexer = indexer.astype(np.int_)
 *     if len(sorter) > 0:             # <<<<<<<<<<<<<<
 *         res = sorter.take(indexer)
 *         np.putmask(res, indexer == -1, -1)
 */
  __pyx_t_5 = PyObject_Length(__pyx_v_sorter); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = (__pyx_t_5 > 0);
  if (__pyx_t_4) {

    /* "pandas/src/join.pyx":188
 *         indexer = indexer.astype(np.int_)
 *     if len(sorter) > 0:
 *         res = sorter.take(indexer)             # <<<<<<<<<<<<<<
 *         np.putmask(res, indexer == -1, -1)
 *     else:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_sorter, __pyx_n_s__take); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_indexer);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_indexer);
    __Pyx_GIVEREF(__pyx_v_indexer);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __pyx_v_res = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "pandas/src/join.pyx":189
 *     if len(sorter) > 0:
 *         res = sorter.take(indexer)
 *         np.putmask(res, indexer == -1, -1)             # <<<<<<<<<<<<<<
 *     else:
 *         # length-0 case
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__putmask); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_indexer, __pyx_int_neg_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_res);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_res);
    __Pyx_GIVEREF(__pyx_v_res);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/join.pyx":192
 *     else:
 *         # length-0 case
 *         res = np.empty(len(indexer), dtype=np.int64)             # <<<<<<<<<<<<<<
 *         res.fill(-1)
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = PyObject_Length(__pyx_v_indexer); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__int64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_res = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "pandas/src/join.pyx":193
 *         # length-0 case
 *         res = np.empty(len(indexer), dtype=np.int64)
 *         res.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     return res
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_res, __pyx_n_s__fill); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_48), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "pandas/src/join.pyx":195
 *         res.fill(-1)
 * 
 *     return res             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pandas.algos._get_result_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_121ffill_indexer(PyObject *__pyx_self, PyObject *__pyx_v_indexer); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_121ffill_indexer = {__Pyx_NAMESTR("ffill_indexer"), (PyCFunction)__pyx_pw_6pandas_5algos_121ffill_indexer, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_121ffill_indexer(PyObject *__pyx_self, PyObject *__pyx_v_indexer) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffill_indexer (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_120ffill_indexer(__pyx_self, ((PyArrayObject *)__pyx_v_indexer));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":199
 * 
 * 
 * def ffill_indexer(ndarray[int64_t] indexer):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(indexer)
 */

static PyObject *__pyx_pf_6pandas_5algos_120ffill_indexer(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyArrayObject *__pyx_v_result = 0;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  __pyx_t_5numpy_int64_t __pyx_v_last_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ffill_indexer", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/join.pyx":201
 * def ffill_indexer(ndarray[int64_t] indexer):
 *     cdef:
 *         Py_ssize_t i, n = len(indexer)             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] result
 *         int64_t val, last_obs
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/join.pyx":205
 *         int64_t val, last_obs
 * 
 *     result = np.empty(n, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     last_obs = -1
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/join.pyx":206
 * 
 *     result = np.empty(n, dtype=np.int64)
 *     last_obs = -1             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_v_last_obs = -1;

  /* "pandas/src/join.pyx":208
 *     last_obs = -1
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         val = indexer[i]
 *         if val == -1:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":209
 * 
 *     for i in range(n):
 *         val = indexer[i]             # <<<<<<<<<<<<<<
 *         if val == -1:
 *             result[i] = last_obs
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_indexer.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_indexer.diminfo[0].strides));

    /* "pandas/src/join.pyx":210
 *     for i in range(n):
 *         val = indexer[i]
 *         if val == -1:             # <<<<<<<<<<<<<<
 *             result[i] = last_obs
 *         else:
 */
    __pyx_t_14 = (__pyx_v_val == -1);
    if (__pyx_t_14) {

      /* "pandas/src/join.pyx":211
 *         val = indexer[i]
 *         if val == -1:
 *             result[i] = last_obs             # <<<<<<<<<<<<<<
 *         else:
 *             result[i] = val
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_15 < 0) {
        __pyx_t_15 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_15 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_last_obs;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":213
 *             result[i] = last_obs
 *         else:
 *             result[i] = val             # <<<<<<<<<<<<<<
 *             last_obs = val
 * 
 */
      __pyx_t_16 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_val;

      /* "pandas/src/join.pyx":214
 *         else:
 *             result[i] = val
 *             last_obs = val             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_v_last_obs = __pyx_v_val;
    }
    __pyx_L5:;
  }

  /* "pandas/src/join.pyx":216
 *             last_obs = val
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.ffill_indexer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_123ffill_by_group(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_123ffill_by_group = {__Pyx_NAMESTR("ffill_by_group"), (PyCFunction)__pyx_pw_6pandas_5algos_123ffill_by_group, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_123ffill_by_group(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_indexer = 0;
  PyArrayObject *__pyx_v_group_ids = 0;
  __pyx_t_5numpy_int64_t __pyx_v_max_group;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffill_by_group (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__indexer,&__pyx_n_s__group_ids,&__pyx_n_s__max_group,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__group_ids)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffill_by_group", 1, 3, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_group)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffill_by_group", 1, 3, 3, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffill_by_group") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __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_indexer = ((PyArrayObject *)values[0]);
    __pyx_v_group_ids = ((PyArrayObject *)values[1]);
    __pyx_v_max_group = __Pyx_PyInt_from_py_npy_int64(values[2]); if (unlikely((__pyx_v_max_group == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffill_by_group", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.ffill_by_group", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_group_ids), __pyx_ptype_5numpy_ndarray, 1, "group_ids", 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_122ffill_by_group(__pyx_self, __pyx_v_indexer, __pyx_v_group_ids, __pyx_v_max_group);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/join.pyx":219
 * 
 * 
 * def ffill_by_group(ndarray[int64_t] indexer, ndarray[int64_t] group_ids,             # <<<<<<<<<<<<<<
 *                    int64_t max_group):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_122ffill_by_group(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indexer, PyArrayObject *__pyx_v_group_ids, __pyx_t_5numpy_int64_t __pyx_v_max_group) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyArrayObject *__pyx_v_result = 0;
  PyArrayObject *__pyx_v_last_obs = 0;
  __pyx_t_5numpy_int64_t __pyx_v_gid;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_group_ids;
  __Pyx_Buffer __pyx_pybuffer_group_ids;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_last_obs;
  __Pyx_Buffer __pyx_pybuffer_last_obs;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  __pyx_t_5numpy_int64_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  __pyx_t_5numpy_int64_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ffill_by_group", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_last_obs.pybuffer.buf = NULL;
  __pyx_pybuffer_last_obs.refcount = 0;
  __pyx_pybuffernd_last_obs.data = NULL;
  __pyx_pybuffernd_last_obs.rcbuffer = &__pyx_pybuffer_last_obs;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_group_ids.pybuffer.buf = NULL;
  __pyx_pybuffer_group_ids.refcount = 0;
  __pyx_pybuffernd_group_ids.data = NULL;
  __pyx_pybuffernd_group_ids.rcbuffer = &__pyx_pybuffer_group_ids;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_group_ids.rcbuffer->pybuffer, (PyObject*)__pyx_v_group_ids, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_group_ids.diminfo[0].strides = __pyx_pybuffernd_group_ids.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_group_ids.diminfo[0].shape = __pyx_pybuffernd_group_ids.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/join.pyx":222
 *                    int64_t max_group):
 *     cdef:
 *         Py_ssize_t i, n = len(indexer)             # <<<<<<<<<<<<<<
 *         ndarray[int64_t] result, last_obs
 *         int64_t gid, val
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/join.pyx":226
 *         int64_t gid, val
 * 
 *     result = np.empty(n, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     last_obs = np.empty(max_group, dtype=np.int64)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/join.pyx":228
 *     result = np.empty(n, dtype=np.int64)
 * 
 *     last_obs = np.empty(max_group, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     last_obs.fill(-1)
 * 
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_max_group); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_last_obs.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_last_obs.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_last_obs.rcbuffer->pybuffer, (PyObject*)__pyx_v_last_obs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
      }
    }
    __pyx_pybuffernd_last_obs.diminfo[0].strides = __pyx_pybuffernd_last_obs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_last_obs.diminfo[0].shape = __pyx_pybuffernd_last_obs.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_last_obs = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/join.pyx":229
 * 
 *     last_obs = np.empty(max_group, dtype=np.int64)
 *     last_obs.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_last_obs), __pyx_n_s__fill); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_49), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "pandas/src/join.pyx":231
 *     last_obs.fill(-1)
 * 
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         gid = group_ids[i]
 *         val = indexer[i]
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_1; __pyx_t_12+=1) {
    __pyx_v_i = __pyx_t_12;

    /* "pandas/src/join.pyx":232
 * 
 *     for i in range(n):
 *         gid = group_ids[i]             # <<<<<<<<<<<<<<
 *         val = indexer[i]
 *         if val == -1:
 */
    __pyx_t_13 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_13 < 0) {
      __pyx_t_13 += __pyx_pybuffernd_group_ids.diminfo[0].shape;
      if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_group_ids.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_gid = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_group_ids.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_group_ids.diminfo[0].strides));

    /* "pandas/src/join.pyx":233
 *     for i in range(n):
 *         gid = group_ids[i]
 *         val = indexer[i]             # <<<<<<<<<<<<<<
 *         if val == -1:
 *             result[i] = last_obs[gid]
 */
    __pyx_t_14 = __pyx_v_i;
    __pyx_t_8 = -1;
    if (__pyx_t_14 < 0) {
      __pyx_t_14 += __pyx_pybuffernd_indexer.diminfo[0].shape;
      if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 0;
    } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
    if (unlikely(__pyx_t_8 != -1)) {
      __Pyx_RaiseBufferIndexError(__pyx_t_8);
      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

    /* "pandas/src/join.pyx":234
 *         gid = group_ids[i]
 *         val = indexer[i]
 *         if val == -1:             # <<<<<<<<<<<<<<
 *             result[i] = last_obs[gid]
 *         else:
 */
    __pyx_t_15 = (__pyx_v_val == -1);
    if (__pyx_t_15) {

      /* "pandas/src/join.pyx":235
 *         val = indexer[i]
 *         if val == -1:
 *             result[i] = last_obs[gid]             # <<<<<<<<<<<<<<
 *         else:
 *             result[i] = val
 */
      __pyx_t_16 = __pyx_v_gid;
      __pyx_t_8 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_pybuffernd_last_obs.diminfo[0].shape;
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_last_obs.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_17 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_17 < 0) {
        __pyx_t_17 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_last_obs.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_last_obs.diminfo[0].strides));
      goto __pyx_L5;
    }
    /*else*/ {

      /* "pandas/src/join.pyx":237
 *             result[i] = last_obs[gid]
 *         else:
 *             result[i] = val             # <<<<<<<<<<<<<<
 *             last_obs[gid] = val
 * 
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_pybuffernd_result.diminfo[0].shape;
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_val;

      /* "pandas/src/join.pyx":238
 *         else:
 *             result[i] = val
 *             last_obs[gid] = val             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_19 = __pyx_v_gid;
      __pyx_t_8 = -1;
      if (__pyx_t_19 < 0) {
        __pyx_t_19 += __pyx_pybuffernd_last_obs.diminfo[0].shape;
        if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_last_obs.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[2]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_last_obs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_last_obs.diminfo[0].strides) = __pyx_v_val;
    }
    __pyx_L5:;
  }

  /* "pandas/src/join.pyx":240
 *             last_obs[gid] = val
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_group_ids.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_last_obs.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.ffill_by_group", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_group_ids.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_last_obs.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF((PyObject *)__pyx_v_last_obs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":39
 * cdef int PLATFORM_INT = (<ndarray> np.arange(0, dtype=np.int_)).descr.type_num
 * 
 * cpdef ensure_platform_int(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == PLATFORM_INT:
 */

static PyObject *__pyx_pw_6pandas_5algos_125ensure_platform_int(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_platform_int(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_platform_int", 0);

  /* "pandas/src/generated.pyx":40
 * 
 * cpdef ensure_platform_int(object arr):
 *     if util.is_array(arr):             # <<<<<<<<<<<<<<
 *         if (<ndarray> arr).descr.type_num == PLATFORM_INT:
 *             return arr
 */
  __pyx_t_1 = __pyx_f_4util_is_array(__pyx_v_arr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":41
 * cpdef ensure_platform_int(object arr):
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == PLATFORM_INT:             # <<<<<<<<<<<<<<
 *             return arr
 *         else:
 */
    __pyx_t_2 = (((PyArrayObject *)__pyx_v_arr)->descr->type_num == __pyx_v_6pandas_5algos_PLATFORM_INT);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":42
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == PLATFORM_INT:
 *             return arr             # <<<<<<<<<<<<<<
 *         else:
 *             return arr.astype(np.int_)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_arr);
      __pyx_r = __pyx_v_arr;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":44
 *             return arr
 *         else:
 *             return arr.astype(np.int_)             # <<<<<<<<<<<<<<
 *     else:
 *         return np.array(arr, dtype=np.int_)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":46
 *             return arr.astype(np.int_)
 *     else:
 *         return np.array(arr, dtype=np.int_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int_); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas.algos.ensure_platform_int", __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_6pandas_5algos_125ensure_platform_int(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_125ensure_platform_int(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_platform_int (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_124ensure_platform_int(__pyx_self, ((PyObject *)__pyx_v_arr));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":39
 * cdef int PLATFORM_INT = (<ndarray> np.arange(0, dtype=np.int_)).descr.type_num
 * 
 * cpdef ensure_platform_int(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == PLATFORM_INT:
 */

static PyObject *__pyx_pf_6pandas_5algos_124ensure_platform_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_platform_int", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_ensure_platform_int(__pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.ensure_platform_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":50
 * 
 * 
 * cpdef ensure_float64(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_FLOAT64:
 */

static PyObject *__pyx_pw_6pandas_5algos_127ensure_float64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_float64(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_float64", 0);

  /* "pandas/src/generated.pyx":51
 * 
 * cpdef ensure_float64(object arr):
 *     if util.is_array(arr):             # <<<<<<<<<<<<<<
 *         if (<ndarray> arr).descr.type_num == NPY_FLOAT64:
 *             return arr
 */
  __pyx_t_1 = __pyx_f_4util_is_array(__pyx_v_arr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":52
 * cpdef ensure_float64(object arr):
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_FLOAT64:             # <<<<<<<<<<<<<<
 *             return arr
 *         else:
 */
    __pyx_t_2 = (((PyArrayObject *)__pyx_v_arr)->descr->type_num == NPY_FLOAT64);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":53
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_FLOAT64:
 *             return arr             # <<<<<<<<<<<<<<
 *         else:
 *             return arr.astype(np.float64)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_arr);
      __pyx_r = __pyx_v_arr;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":55
 *             return arr
 *         else:
 *             return arr.astype(np.float64)             # <<<<<<<<<<<<<<
 *     else:
 *         return np.array(arr, dtype=np.float64)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":57
 *             return arr.astype(np.float64)
 *     else:
 *         return np.array(arr, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas.algos.ensure_float64", __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_6pandas_5algos_127ensure_float64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_127ensure_float64(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_float64 (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_126ensure_float64(__pyx_self, ((PyObject *)__pyx_v_arr));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":50
 * 
 * 
 * cpdef ensure_float64(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_FLOAT64:
 */

static PyObject *__pyx_pf_6pandas_5algos_126ensure_float64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_float64", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_ensure_float64(__pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.ensure_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":60
 * 
 * 
 * cpdef ensure_int32(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT32:
 */

static PyObject *__pyx_pw_6pandas_5algos_129ensure_int32(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_int32(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_int32", 0);

  /* "pandas/src/generated.pyx":61
 * 
 * cpdef ensure_int32(object arr):
 *     if util.is_array(arr):             # <<<<<<<<<<<<<<
 *         if (<ndarray> arr).descr.type_num == NPY_INT32:
 *             return arr
 */
  __pyx_t_1 = __pyx_f_4util_is_array(__pyx_v_arr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":62
 * cpdef ensure_int32(object arr):
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT32:             # <<<<<<<<<<<<<<
 *             return arr
 *         else:
 */
    __pyx_t_2 = (((PyArrayObject *)__pyx_v_arr)->descr->type_num == NPY_INT32);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":63
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT32:
 *             return arr             # <<<<<<<<<<<<<<
 *         else:
 *             return arr.astype(np.int32)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_arr);
      __pyx_r = __pyx_v_arr;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":65
 *             return arr
 *         else:
 *             return arr.astype(np.int32)             # <<<<<<<<<<<<<<
 *     else:
 *         return np.array(arr, dtype=np.int32)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":67
 *             return arr.astype(np.int32)
 *     else:
 *         return np.array(arr, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas.algos.ensure_int32", __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_6pandas_5algos_129ensure_int32(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_129ensure_int32(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_int32 (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_128ensure_int32(__pyx_self, ((PyObject *)__pyx_v_arr));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":60
 * 
 * 
 * cpdef ensure_int32(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT32:
 */

static PyObject *__pyx_pf_6pandas_5algos_128ensure_int32(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_int32", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_ensure_int32(__pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.ensure_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":70
 * 
 * 
 * cpdef ensure_int64(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT64:
 */

static PyObject *__pyx_pw_6pandas_5algos_131ensure_int64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_int64(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_int64", 0);

  /* "pandas/src/generated.pyx":71
 * 
 * cpdef ensure_int64(object arr):
 *     if util.is_array(arr):             # <<<<<<<<<<<<<<
 *         if (<ndarray> arr).descr.type_num == NPY_INT64:
 *             return arr
 */
  __pyx_t_1 = __pyx_f_4util_is_array(__pyx_v_arr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":72
 * cpdef ensure_int64(object arr):
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT64:             # <<<<<<<<<<<<<<
 *             return arr
 *         else:
 */
    __pyx_t_2 = (((PyArrayObject *)__pyx_v_arr)->descr->type_num == NPY_INT64);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":73
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT64:
 *             return arr             # <<<<<<<<<<<<<<
 *         else:
 *             return arr.astype(np.int64)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_arr);
      __pyx_r = __pyx_v_arr;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":75
 *             return arr
 *         else:
 *             return arr.astype(np.int64)             # <<<<<<<<<<<<<<
 *     else:
 *         return np.array(arr, dtype=np.int64)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":77
 *             return arr.astype(np.int64)
 *     else:
 *         return np.array(arr, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas.algos.ensure_int64", __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_6pandas_5algos_131ensure_int64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_131ensure_int64(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_int64 (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_130ensure_int64(__pyx_self, ((PyObject *)__pyx_v_arr));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":70
 * 
 * 
 * cpdef ensure_int64(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_INT64:
 */

static PyObject *__pyx_pf_6pandas_5algos_130ensure_int64(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_int64", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_ensure_int64(__pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.ensure_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":80
 * 
 * 
 * cpdef ensure_object(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_OBJECT:
 */

static PyObject *__pyx_pw_6pandas_5algos_133ensure_object(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_ensure_object(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_object", 0);

  /* "pandas/src/generated.pyx":81
 * 
 * cpdef ensure_object(object arr):
 *     if util.is_array(arr):             # <<<<<<<<<<<<<<
 *         if (<ndarray> arr).descr.type_num == NPY_OBJECT:
 *             return arr
 */
  __pyx_t_1 = __pyx_f_4util_is_array(__pyx_v_arr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":82
 * cpdef ensure_object(object arr):
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_OBJECT:             # <<<<<<<<<<<<<<
 *             return arr
 *         else:
 */
    __pyx_t_2 = (((PyArrayObject *)__pyx_v_arr)->descr->type_num == NPY_OBJECT);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":83
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_OBJECT:
 *             return arr             # <<<<<<<<<<<<<<
 *         else:
 *             return arr.astype(np.object_)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_arr);
      __pyx_r = __pyx_v_arr;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":85
 *             return arr
 *         else:
 *             return arr.astype(np.object_)             # <<<<<<<<<<<<<<
 *     else:
 *         return np.array(arr, dtype=np.object_)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__object_); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":87
 *             return arr.astype(np.object_)
 *     else:
 *         return np.array(arr, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_arr);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_arr);
    __Pyx_GIVEREF(__pyx_v_arr);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__object_); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("pandas.algos.ensure_object", __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_6pandas_5algos_133ensure_object(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static PyObject *__pyx_pw_6pandas_5algos_133ensure_object(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_object (wrapper)", 0);
  __pyx_r = __pyx_pf_6pandas_5algos_132ensure_object(__pyx_self, ((PyObject *)__pyx_v_arr));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":80
 * 
 * 
 * cpdef ensure_object(object arr):             # <<<<<<<<<<<<<<
 *     if util.is_array(arr):
 *         if (<ndarray> arr).descr.type_num == NPY_OBJECT:
 */

static PyObject *__pyx_pf_6pandas_5algos_132ensure_object(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_object", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_ensure_object(__pyx_v_arr, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pandas.algos.ensure_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":92
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_float64(ndarray[float64_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pw_6pandas_5algos_135map_indices_float64(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_float64(PyArrayObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_float64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":103
 *     '''
 *     cdef Py_ssize_t i, length
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 * 
 *     length = len(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":105
 *     cdef dict result = {}
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":107
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[index[i]] = i
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":108
 * 
 *     for i in range(length):
 *         result[index[i]] = i             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":110
 *         result[index[i]] = i
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_135map_indices_float64(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_6pandas_5algos_134map_indices_float64[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pw_6pandas_5algos_135map_indices_float64(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("map_indices_float64 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_134map_indices_float64(__pyx_self, ((PyArrayObject *)__pyx_v_index));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":92
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_float64(ndarray[float64_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_6pandas_5algos_134map_indices_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_float64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_map_indices_float64(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":114
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_object(ndarray[object] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pw_6pandas_5algos_137map_indices_object(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_object(PyArrayObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_object", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":125
 *     '''
 *     cdef Py_ssize_t i, length
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 * 
 *     length = len(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":127
 *     cdef dict result = {}
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":129
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[index[i]] = i
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":130
 * 
 *     for i in range(length):
 *         result[index[i]] = i             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_4);
    if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_t_4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":132
 *         result[index[i]] = i
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_137map_indices_object(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_6pandas_5algos_136map_indices_object[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pw_6pandas_5algos_137map_indices_object(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("map_indices_object (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_136map_indices_object(__pyx_self, ((PyArrayObject *)__pyx_v_index));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":114
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_object(ndarray[object] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_6pandas_5algos_136map_indices_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_object", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_map_indices_object(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":136
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_int32(ndarray[int32_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pw_6pandas_5algos_139map_indices_int32(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_int32(PyArrayObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  __pyx_t_5numpy_int32_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_int32", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":147
 *     '''
 *     cdef Py_ssize_t i, length
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 * 
 *     length = len(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":149
 *     cdef dict result = {}
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":151
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[index[i]] = i
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":152
 * 
 *     for i in range(length):
 *         result[index[i]] = i             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_index.diminfo[0].strides));
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_result), __pyx_t_5, __pyx_t_1, sizeof(__pyx_t_5numpy_int32_t), __Pyx_PyInt_to_py_npy_int32) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":154
 *         result[index[i]] = i
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_139map_indices_int32(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_6pandas_5algos_138map_indices_int32[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pw_6pandas_5algos_139map_indices_int32(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("map_indices_int32 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_138map_indices_int32(__pyx_self, ((PyArrayObject *)__pyx_v_index));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":136
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_int32(ndarray[int32_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_6pandas_5algos_138map_indices_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_int32", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_map_indices_int32(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":158
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_int64(ndarray[int64_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pw_6pandas_5algos_141map_indices_int64(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_int64(PyArrayObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  __pyx_t_5numpy_int64_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_int64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":169
 *     '''
 *     cdef Py_ssize_t i, length
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 * 
 *     length = len(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":171
 *     cdef dict result = {}
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":173
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[index[i]] = i
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":174
 * 
 *     for i in range(length):
 *         result[index[i]] = i             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_index.diminfo[0].strides));
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_result), __pyx_t_5, __pyx_t_1, sizeof(__pyx_t_5numpy_int64_t), __Pyx_PyInt_to_py_npy_int64) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":176
 *         result[index[i]] = i
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_141map_indices_int64(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_6pandas_5algos_140map_indices_int64[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pw_6pandas_5algos_141map_indices_int64(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("map_indices_int64 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_140map_indices_int64(__pyx_self, ((PyArrayObject *)__pyx_v_index));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":158
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_int64(ndarray[int64_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_6pandas_5algos_140map_indices_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_int64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_map_indices_int64(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":180
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_bool(ndarray[uint8_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pw_6pandas_5algos_143map_indices_bool(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_f_6pandas_5algos_map_indices_bool(PyArrayObject *__pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  __pyx_t_5numpy_uint8_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_bool", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":191
 *     '''
 *     cdef Py_ssize_t i, length
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 * 
 *     length = len(index)
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":193
 *     cdef dict result = {}
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":195
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[index[i]] = i
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":196
 * 
 *     for i in range(length):
 *         result[index[i]] = i             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_i;
    __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_index.diminfo[0].strides));
    if (__Pyx_SetItemInt(((PyObject *)__pyx_v_result), __pyx_t_5, __pyx_t_1, sizeof(__pyx_t_5numpy_uint8_t)+1, __Pyx_PyInt_to_py_npy_uint8) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":198
 *         result[index[i]] = i
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_143map_indices_bool(PyObject *__pyx_self, PyObject *__pyx_v_index); /*proto*/
static char __pyx_doc_6pandas_5algos_142map_indices_bool[] = "\n    Produce a dict mapping the values of the input array to their respective\n    locations.\n\n    Example:\n        array(['hi', 'there']) --> {'hi' : 0 , 'there' : 1}\n\n    Better to do this with Cython because of the enormous speed boost.\n    ";
static PyObject *__pyx_pw_6pandas_5algos_143map_indices_bool(PyObject *__pyx_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("map_indices_bool (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_142map_indices_bool(__pyx_self, ((PyArrayObject *)__pyx_v_index));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":180
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cpdef map_indices_bool(ndarray[uint8_t] index):             # <<<<<<<<<<<<<<
 *     '''
 *     Produce a dict mapping the values of the input array to their respective
 */

static PyObject *__pyx_pf_6pandas_5algos_142map_indices_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index) {
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("map_indices_bool", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6pandas_5algos_map_indices_bool(__pyx_v_index, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.map_indices_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_145pad_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_145pad_float64 = {__Pyx_NAMESTR("pad_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_145pad_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_145pad_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":204
 * @cython.wraparound(False)
 * def pad_float64(ndarray[float64_t] old, ndarray[float64_t] new,
 *                    limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_144pad_float64(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":203
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_144pad_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_float64_t __pyx_v_cur;
  __pyx_t_5numpy_float64_t __pyx_v_next;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_float64_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_float64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":208
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef float64_t cur, next
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":210
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":211
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":212
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":213
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":215
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":216
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":218
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":219
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":220
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":222
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_1 = (__pyx_v_nright - 1);
      __pyx_t_14 = 0;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_new.diminfo[0].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":223
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = j = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":225
 *         return indexer
 * 
 *     i = j = 0             # <<<<<<<<<<<<<<
 * 
 *     cur = old[0]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":227
 *     i = j = 0
 * 
 *     cur = old[0]             # <<<<<<<<<<<<<<
 * 
 *     while j <= nright - 1 and new[j] < cur:
 */
  __pyx_t_17 = 0;
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":229
 *     cur = old[0]
 * 
 *     while j <= nright - 1 and new[j] < cur:             # <<<<<<<<<<<<<<
 *         j += 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j <= (__pyx_v_nright - 1));
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":230
 * 
 *     while j <= nright - 1 and new[j] < cur:
 *         j += 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pandas/src/generated.pyx":232
 *         j += 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j == nright:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":233
 * 
 *     while True:
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":234
 *     while True:
 *         if j == nright:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == nleft - 1:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":236
 *             break
 * 
 *         if i == nleft - 1:             # <<<<<<<<<<<<<<
 *             while j < nright:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == (__pyx_v_nleft - 1));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":237
 * 
 *         if i == nleft - 1:
 *             while j < nright:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_nright);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":238
 *         if i == nleft - 1:
 *             while j < nright:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":239
 *             while j < nright:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":240
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":241
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j += 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":242
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":243
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }

      /* "pandas/src/generated.pyx":244
 *                     fill_count += 1
 *                 j += 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         next = old[i + 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":246
 *             break
 * 
 *         next = old[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         while j < nright and cur <= new[j] < next:
 */
    __pyx_t_23 = (__pyx_v_i + 1);
    __pyx_v_next = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":248
 *         next = old[i + 1]
 * 
 *         while j < nright and cur <= new[j] < next:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j < __pyx_v_nright);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_cur <= __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 < __pyx_v_next);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":249
 * 
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":250
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":251
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":252
 *                 indexer[j] = i
 *             elif fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j += 1
 */
        __pyx_t_28 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":253
 *             elif fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":254
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/generated.pyx":256
 *             j += 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i += 1
 *         cur = next
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":257
 * 
 *         fill_count = 0
 *         i += 1             # <<<<<<<<<<<<<<
 *         cur = next
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "pandas/src/generated.pyx":258
 *         fill_count = 0
 *         i += 1
 *         cur = next             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_next;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":260
 *         cur = next
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_147pad_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_147pad_object = {__Pyx_NAMESTR("pad_object"), (PyCFunction)__pyx_pw_6pandas_5algos_147pad_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_147pad_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":265
 * @cython.wraparound(False)
 * def pad_object(ndarray[object] old, ndarray[object] new,
 *                    limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_146pad_object(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":264
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_146pad_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_cur = 0;
  PyObject *__pyx_v_next = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_object", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":269
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef object cur, next
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":271
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":272
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":273
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":274
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":276
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":277
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":279
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":280
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":281
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":283
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_1 = (__pyx_v_nright - 1);
      __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __pyx_t_14 = 0;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_old.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":284
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = j = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":286
 *         return indexer
 * 
 *     i = j = 0             # <<<<<<<<<<<<<<
 * 
 *     cur = old[0]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":288
 *     i = j = 0
 * 
 *     cur = old[0]             # <<<<<<<<<<<<<<
 * 
 *     while j <= nright - 1 and new[j] < cur:
 */
  __pyx_t_17 = 0;
  __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides);
  __Pyx_INCREF((PyObject*)__pyx_t_4);
  __pyx_v_cur = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pandas/src/generated.pyx":290
 *     cur = old[0]
 * 
 *     while j <= nright - 1 and new[j] < cur:             # <<<<<<<<<<<<<<
 *         j += 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j <= (__pyx_v_nright - 1));
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":291
 * 
 *     while j <= nright - 1 and new[j] < cur:
 *         j += 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pandas/src/generated.pyx":293
 *         j += 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j == nright:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":294
 * 
 *     while True:
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":295
 *     while True:
 *         if j == nright:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == nleft - 1:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":297
 *             break
 * 
 *         if i == nleft - 1:             # <<<<<<<<<<<<<<
 *             while j < nright:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == (__pyx_v_nleft - 1));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":298
 * 
 *         if i == nleft - 1:
 *             while j < nright:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_nright);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":299
 *         if i == nleft - 1:
 *             while j < nright:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_cur, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":300
 *             while j < nright:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":301
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_4);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":302
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j += 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":303
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":304
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }

      /* "pandas/src/generated.pyx":305
 *                     fill_count += 1
 *                 j += 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         next = old[i + 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":307
 *             break
 * 
 *         next = old[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         while j < nright and cur <= new[j] < next:
 */
    __pyx_t_23 = (__pyx_v_i + 1);
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_next);
    __pyx_v_next = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pandas/src/generated.pyx":309
 *         next = old[i + 1]
 * 
 *         while j < nright and cur <= new[j] < next:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j < __pyx_v_nright);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_cur, __pyx_t_6, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
          __Pyx_DECREF(__pyx_t_4);
          __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_next, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":310
 * 
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif fill_count < lim:
 */
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":311
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_26 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":312
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":313
 *                 indexer[j] = i
 *             elif fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j += 1
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":314
 *             elif fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":315
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/generated.pyx":317
 *             j += 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i += 1
 *         cur = next
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":318
 * 
 *         fill_count = 0
 *         i += 1             # <<<<<<<<<<<<<<
 *         cur = next
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "pandas/src/generated.pyx":319
 *         fill_count = 0
 *         i += 1
 *         cur = next             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __Pyx_INCREF(__pyx_v_next);
    __Pyx_DECREF(__pyx_v_cur);
    __pyx_v_cur = __pyx_v_next;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":321
 *         cur = next
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF(__pyx_v_cur);
  __Pyx_XDECREF(__pyx_v_next);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_149pad_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_149pad_int32 = {__Pyx_NAMESTR("pad_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_149pad_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_149pad_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":326
 * @cython.wraparound(False)
 * def pad_int32(ndarray[int32_t] old, ndarray[int32_t] new,
 *                    limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_148pad_int32(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":325
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_148pad_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int32_t __pyx_v_cur;
  __pyx_t_5numpy_int32_t __pyx_v_next;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_int32_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_int32", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":330
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef int32_t cur, next
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":332
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":333
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":334
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":335
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":337
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":338
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":340
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":341
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":342
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":344
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_1 = (__pyx_v_nright - 1);
      __pyx_t_14 = 0;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_new.diminfo[0].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":345
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = j = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":347
 *         return indexer
 * 
 *     i = j = 0             # <<<<<<<<<<<<<<
 * 
 *     cur = old[0]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":349
 *     i = j = 0
 * 
 *     cur = old[0]             # <<<<<<<<<<<<<<
 * 
 *     while j <= nright - 1 and new[j] < cur:
 */
  __pyx_t_17 = 0;
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":351
 *     cur = old[0]
 * 
 *     while j <= nright - 1 and new[j] < cur:             # <<<<<<<<<<<<<<
 *         j += 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j <= (__pyx_v_nright - 1));
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":352
 * 
 *     while j <= nright - 1 and new[j] < cur:
 *         j += 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pandas/src/generated.pyx":354
 *         j += 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j == nright:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":355
 * 
 *     while True:
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":356
 *     while True:
 *         if j == nright:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == nleft - 1:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":358
 *             break
 * 
 *         if i == nleft - 1:             # <<<<<<<<<<<<<<
 *             while j < nright:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == (__pyx_v_nleft - 1));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":359
 * 
 *         if i == nleft - 1:
 *             while j < nright:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_nright);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":360
 *         if i == nleft - 1:
 *             while j < nright:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":361
 *             while j < nright:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":362
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":363
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j += 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":364
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":365
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }

      /* "pandas/src/generated.pyx":366
 *                     fill_count += 1
 *                 j += 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         next = old[i + 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":368
 *             break
 * 
 *         next = old[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         while j < nright and cur <= new[j] < next:
 */
    __pyx_t_23 = (__pyx_v_i + 1);
    __pyx_v_next = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":370
 *         next = old[i + 1]
 * 
 *         while j < nright and cur <= new[j] < next:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j < __pyx_v_nright);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_cur <= __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 < __pyx_v_next);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":371
 * 
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":372
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":373
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":374
 *                 indexer[j] = i
 *             elif fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j += 1
 */
        __pyx_t_28 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":375
 *             elif fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":376
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/generated.pyx":378
 *             j += 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i += 1
 *         cur = next
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":379
 * 
 *         fill_count = 0
 *         i += 1             # <<<<<<<<<<<<<<
 *         cur = next
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "pandas/src/generated.pyx":380
 *         fill_count = 0
 *         i += 1
 *         cur = next             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_next;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":382
 *         cur = next
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_151pad_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_151pad_int64 = {__Pyx_NAMESTR("pad_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_151pad_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_151pad_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":387
 * @cython.wraparound(False)
 * def pad_int64(ndarray[int64_t] old, ndarray[int64_t] new,
 *                    limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_150pad_int64(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":386
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_150pad_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_cur;
  __pyx_t_5numpy_int64_t __pyx_v_next;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_int64_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_int64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":391
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef int64_t cur, next
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":393
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":394
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":395
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":396
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":398
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":399
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":401
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":402
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":403
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":405
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_1 = (__pyx_v_nright - 1);
      __pyx_t_14 = 0;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_new.diminfo[0].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":406
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = j = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":408
 *         return indexer
 * 
 *     i = j = 0             # <<<<<<<<<<<<<<
 * 
 *     cur = old[0]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":410
 *     i = j = 0
 * 
 *     cur = old[0]             # <<<<<<<<<<<<<<
 * 
 *     while j <= nright - 1 and new[j] < cur:
 */
  __pyx_t_17 = 0;
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":412
 *     cur = old[0]
 * 
 *     while j <= nright - 1 and new[j] < cur:             # <<<<<<<<<<<<<<
 *         j += 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j <= (__pyx_v_nright - 1));
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":413
 * 
 *     while j <= nright - 1 and new[j] < cur:
 *         j += 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pandas/src/generated.pyx":415
 *         j += 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j == nright:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":416
 * 
 *     while True:
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":417
 *     while True:
 *         if j == nright:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == nleft - 1:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":419
 *             break
 * 
 *         if i == nleft - 1:             # <<<<<<<<<<<<<<
 *             while j < nright:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == (__pyx_v_nleft - 1));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":420
 * 
 *         if i == nleft - 1:
 *             while j < nright:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_nright);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":421
 *         if i == nleft - 1:
 *             while j < nright:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":422
 *             while j < nright:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":423
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":424
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j += 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":425
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":426
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }

      /* "pandas/src/generated.pyx":427
 *                     fill_count += 1
 *                 j += 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         next = old[i + 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":429
 *             break
 * 
 *         next = old[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         while j < nright and cur <= new[j] < next:
 */
    __pyx_t_23 = (__pyx_v_i + 1);
    __pyx_v_next = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":431
 *         next = old[i + 1]
 * 
 *         while j < nright and cur <= new[j] < next:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j < __pyx_v_nright);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_cur <= __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 < __pyx_v_next);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":432
 * 
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":433
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":434
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":435
 *                 indexer[j] = i
 *             elif fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j += 1
 */
        __pyx_t_28 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":436
 *             elif fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":437
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/generated.pyx":439
 *             j += 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i += 1
 *         cur = next
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":440
 * 
 *         fill_count = 0
 *         i += 1             # <<<<<<<<<<<<<<
 *         cur = next
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "pandas/src/generated.pyx":441
 *         fill_count = 0
 *         i += 1
 *         cur = next             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_next;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":443
 *         cur = next
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_153pad_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_153pad_bool = {__Pyx_NAMESTR("pad_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_153pad_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_153pad_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":448
 * @cython.wraparound(False)
 * def pad_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,
 *                    limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_152pad_bool(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_152pad_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_cur;
  __pyx_t_5numpy_uint8_t __pyx_v_next;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  long __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_uint8_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_bool", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":452
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef uint8_t cur, next
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":454
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":455
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":456
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":457
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":459
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":460
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":462
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":463
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":464
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":466
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_1 = (__pyx_v_nright - 1);
      __pyx_t_14 = 0;
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_new.diminfo[0].strides)) < (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":467
 * 
 *     if nleft == 0 or nright == 0 or new[nright - 1] < old[0]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = j = 0
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":469
 *         return indexer
 * 
 *     i = j = 0             # <<<<<<<<<<<<<<
 * 
 *     cur = old[0]
 */
  __pyx_v_i = 0;
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":471
 *     i = j = 0
 * 
 *     cur = old[0]             # <<<<<<<<<<<<<<
 * 
 *     while j <= nright - 1 and new[j] < cur:
 */
  __pyx_t_17 = 0;
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":473
 *     cur = old[0]
 * 
 *     while j <= nright - 1 and new[j] < cur:             # <<<<<<<<<<<<<<
 *         j += 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j <= (__pyx_v_nright - 1));
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":474
 * 
 *     while j <= nright - 1 and new[j] < cur:
 *         j += 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j + 1);
  }

  /* "pandas/src/generated.pyx":476
 *         j += 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j == nright:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":477
 * 
 *     while True:
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":478
 *     while True:
 *         if j == nright:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == nleft - 1:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":480
 *             break
 * 
 *         if i == nleft - 1:             # <<<<<<<<<<<<<<
 *             while j < nright:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == (__pyx_v_nleft - 1));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":481
 * 
 *         if i == nleft - 1:
 *             while j < nright:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j < __pyx_v_nright);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":482
 *         if i == nleft - 1:
 *             while j < nright:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":483
 *             while j < nright:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":484
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":485
 *                     indexer[j] = i
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j += 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":486
 *                 elif new[j] > cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":487
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }

      /* "pandas/src/generated.pyx":488
 *                     fill_count += 1
 *                 j += 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         next = old[i + 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":490
 *             break
 * 
 *         next = old[i + 1]             # <<<<<<<<<<<<<<
 * 
 *         while j < nright and cur <= new[j] < next:
 */
    __pyx_t_23 = (__pyx_v_i + 1);
    __pyx_v_next = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":492
 *         next = old[i + 1]
 * 
 *         while j < nright and cur <= new[j] < next:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j < __pyx_v_nright);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_cur <= __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 < __pyx_v_next);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":493
 * 
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":494
 *         while j < nright and cur <= new[j] < next:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":495
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":496
 *                 indexer[j] = i
 *             elif fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j += 1
 */
        __pyx_t_28 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":497
 *             elif fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j += 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":498
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j += 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j + 1);
    }

    /* "pandas/src/generated.pyx":500
 *             j += 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i += 1
 *         cur = next
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":501
 * 
 *         fill_count = 0
 *         i += 1             # <<<<<<<<<<<<<<
 *         cur = next
 * 
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "pandas/src/generated.pyx":502
 *         fill_count = 0
 *         i += 1
 *         cur = next             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_next;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":504
 *         cur = next
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_155backfill_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_155backfill_float64 = {__Pyx_NAMESTR("backfill_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_155backfill_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_155backfill_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":510
 * @cython.wraparound(False)
 * def backfill_float64(ndarray[float64_t] old, ndarray[float64_t] new,
 *                       limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_154backfill_float64(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":509
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_154backfill_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_float64_t __pyx_v_cur;
  __pyx_t_5numpy_float64_t __pyx_v_prev;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_float64_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_float64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":514
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef float64_t cur, prev
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":516
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":517
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":518
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":519
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":521
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":522
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":524
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":525
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":526
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":528
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_14 = 0;
      __pyx_t_1 = (__pyx_v_nleft - 1);
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_new.diminfo[0].strides)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":529
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = nleft - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":531
 *         return indexer
 * 
 *     i = nleft - 1             # <<<<<<<<<<<<<<
 *     j = nright - 1
 * 
 */
  __pyx_v_i = (__pyx_v_nleft - 1);

  /* "pandas/src/generated.pyx":532
 * 
 *     i = nleft - 1
 *     j = nright - 1             # <<<<<<<<<<<<<<
 * 
 *     cur = old[nleft - 1]
 */
  __pyx_v_j = (__pyx_v_nright - 1);

  /* "pandas/src/generated.pyx":534
 *     j = nright - 1
 * 
 *     cur = old[nleft - 1]             # <<<<<<<<<<<<<<
 * 
 *     while j >= 0 and new[j] > cur:
 */
  __pyx_t_17 = (__pyx_v_nleft - 1);
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":536
 *     cur = old[nleft - 1]
 * 
 *     while j >= 0 and new[j] > cur:             # <<<<<<<<<<<<<<
 *         j -= 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j >= 0);
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":537
 * 
 *     while j >= 0 and new[j] > cur:
 *         j -= 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j - 1);
  }

  /* "pandas/src/generated.pyx":539
 *         j -= 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j < 0:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":540
 * 
 *     while True:
 *         if j < 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j < 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":541
 *     while True:
 *         if j < 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == 0:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":543
 *             break
 * 
 *         if i == 0:             # <<<<<<<<<<<<<<
 *             while j >= 0:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":544
 * 
 *         if i == 0:
 *             while j >= 0:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j >= 0);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":545
 *         if i == 0:
 *             while j >= 0:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":546
 *             while j >= 0:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":547
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":548
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j -= 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":549
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j -= 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":550
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j -= 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/src/generated.pyx":551
 *                     fill_count += 1
 *                 j -= 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         prev = old[i - 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":553
 *             break
 * 
 *         prev = old[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 */
    __pyx_t_23 = (__pyx_v_i - 1);
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":555
 *         prev = old[i - 1]
 * 
 *         while j >= 0 and prev < new[j] <= cur:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j >= 0);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_prev < __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 <= __pyx_v_cur);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":556
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":557
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":558
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      if (__pyx_t_13) {
        __pyx_t_12 = (__pyx_v_fill_count < __pyx_v_lim);
        __pyx_t_16 = __pyx_t_12;
      } else {
        __pyx_t_16 = __pyx_t_13;
      }
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":559
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j -= 1
 */
        __pyx_t_29 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":560
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":561
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "pandas/src/generated.pyx":563
 *             j -= 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i -= 1
 *         cur = prev
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":564
 * 
 *         fill_count = 0
 *         i -= 1             # <<<<<<<<<<<<<<
 *         cur = prev
 * 
 */
    __pyx_v_i = (__pyx_v_i - 1);

    /* "pandas/src/generated.pyx":565
 *         fill_count = 0
 *         i -= 1
 *         cur = prev             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_prev;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":567
 *         cur = prev
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_157backfill_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_157backfill_object = {__Pyx_NAMESTR("backfill_object"), (PyCFunction)__pyx_pw_6pandas_5algos_157backfill_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_157backfill_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":572
 * @cython.wraparound(False)
 * def backfill_object(ndarray[object] old, ndarray[object] new,
 *                       limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_156backfill_object(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":571
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_156backfill_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_cur = 0;
  PyObject *__pyx_v_prev = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_object", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":576
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef object cur, prev
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":578
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":579
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":580
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":581
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":583
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":584
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":586
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":587
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":588
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":590
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_14 = 0;
      __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_2);
      __pyx_t_1 = (__pyx_v_nleft - 1);
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_old.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":591
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = nleft - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":593
 *         return indexer
 * 
 *     i = nleft - 1             # <<<<<<<<<<<<<<
 *     j = nright - 1
 * 
 */
  __pyx_v_i = (__pyx_v_nleft - 1);

  /* "pandas/src/generated.pyx":594
 * 
 *     i = nleft - 1
 *     j = nright - 1             # <<<<<<<<<<<<<<
 * 
 *     cur = old[nleft - 1]
 */
  __pyx_v_j = (__pyx_v_nright - 1);

  /* "pandas/src/generated.pyx":596
 *     j = nright - 1
 * 
 *     cur = old[nleft - 1]             # <<<<<<<<<<<<<<
 * 
 *     while j >= 0 and new[j] > cur:
 */
  __pyx_t_17 = (__pyx_v_nleft - 1);
  __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides);
  __Pyx_INCREF((PyObject*)__pyx_t_4);
  __pyx_v_cur = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pandas/src/generated.pyx":598
 *     cur = old[nleft - 1]
 * 
 *     while j >= 0 and new[j] > cur:             # <<<<<<<<<<<<<<
 *         j -= 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j >= 0);
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":599
 * 
 *     while j >= 0 and new[j] > cur:
 *         j -= 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j - 1);
  }

  /* "pandas/src/generated.pyx":601
 *         j -= 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j < 0:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":602
 * 
 *     while True:
 *         if j < 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j < 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":603
 *     while True:
 *         if j < 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == 0:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":605
 *             break
 * 
 *         if i == 0:             # <<<<<<<<<<<<<<
 *             while j >= 0:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":606
 * 
 *         if i == 0:
 *             while j >= 0:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j >= 0);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":607
 *         if i == 0:
 *             while j >= 0:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_cur, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":608
 *             while j >= 0:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":609
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_4);
        __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":610
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j -= 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":611
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j -= 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":612
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j -= 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/src/generated.pyx":613
 *                     fill_count += 1
 *                 j -= 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         prev = old[i - 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":615
 *             break
 * 
 *         prev = old[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 */
    __pyx_t_23 = (__pyx_v_i - 1);
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_prev);
    __pyx_v_prev = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pandas/src/generated.pyx":617
 *         prev = old[i - 1]
 * 
 *         while j >= 0 and prev < new[j] <= cur:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j >= 0);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_prev, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
          __Pyx_DECREF(__pyx_t_4);
          __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_cur, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":618
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 */
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_4);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_cur, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":619
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_26 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":620
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_27 = __pyx_v_j;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_new.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_cur, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_13) {
        __pyx_t_12 = (__pyx_v_fill_count < __pyx_v_lim);
        __pyx_t_16 = __pyx_t_12;
      } else {
        __pyx_t_16 = __pyx_t_13;
      }
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":621
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j -= 1
 */
        __pyx_t_28 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":622
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":623
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "pandas/src/generated.pyx":625
 *             j -= 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i -= 1
 *         cur = prev
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":626
 * 
 *         fill_count = 0
 *         i -= 1             # <<<<<<<<<<<<<<
 *         cur = prev
 * 
 */
    __pyx_v_i = (__pyx_v_i - 1);

    /* "pandas/src/generated.pyx":627
 *         fill_count = 0
 *         i -= 1
 *         cur = prev             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __Pyx_INCREF(__pyx_v_prev);
    __Pyx_DECREF(__pyx_v_cur);
    __pyx_v_cur = __pyx_v_prev;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":629
 *         cur = prev
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF(__pyx_v_cur);
  __Pyx_XDECREF(__pyx_v_prev);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_159backfill_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_159backfill_int32 = {__Pyx_NAMESTR("backfill_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_159backfill_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_159backfill_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":634
 * @cython.wraparound(False)
 * def backfill_int32(ndarray[int32_t] old, ndarray[int32_t] new,
 *                       limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_158backfill_int32(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":633
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_158backfill_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int32_t __pyx_v_cur;
  __pyx_t_5numpy_int32_t __pyx_v_prev;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_int32_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_int32", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":638
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef int32_t cur, prev
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":640
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":641
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":642
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":643
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":645
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":646
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":648
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":649
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":650
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":652
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_14 = 0;
      __pyx_t_1 = (__pyx_v_nleft - 1);
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_new.diminfo[0].strides)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":653
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = nleft - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":655
 *         return indexer
 * 
 *     i = nleft - 1             # <<<<<<<<<<<<<<
 *     j = nright - 1
 * 
 */
  __pyx_v_i = (__pyx_v_nleft - 1);

  /* "pandas/src/generated.pyx":656
 * 
 *     i = nleft - 1
 *     j = nright - 1             # <<<<<<<<<<<<<<
 * 
 *     cur = old[nleft - 1]
 */
  __pyx_v_j = (__pyx_v_nright - 1);

  /* "pandas/src/generated.pyx":658
 *     j = nright - 1
 * 
 *     cur = old[nleft - 1]             # <<<<<<<<<<<<<<
 * 
 *     while j >= 0 and new[j] > cur:
 */
  __pyx_t_17 = (__pyx_v_nleft - 1);
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":660
 *     cur = old[nleft - 1]
 * 
 *     while j >= 0 and new[j] > cur:             # <<<<<<<<<<<<<<
 *         j -= 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j >= 0);
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":661
 * 
 *     while j >= 0 and new[j] > cur:
 *         j -= 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j - 1);
  }

  /* "pandas/src/generated.pyx":663
 *         j -= 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j < 0:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":664
 * 
 *     while True:
 *         if j < 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j < 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":665
 *     while True:
 *         if j < 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == 0:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":667
 *             break
 * 
 *         if i == 0:             # <<<<<<<<<<<<<<
 *             while j >= 0:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":668
 * 
 *         if i == 0:
 *             while j >= 0:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j >= 0);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":669
 *         if i == 0:
 *             while j >= 0:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":670
 *             while j >= 0:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":671
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":672
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j -= 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":673
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j -= 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":674
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j -= 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/src/generated.pyx":675
 *                     fill_count += 1
 *                 j -= 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         prev = old[i - 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":677
 *             break
 * 
 *         prev = old[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 */
    __pyx_t_23 = (__pyx_v_i - 1);
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":679
 *         prev = old[i - 1]
 * 
 *         while j >= 0 and prev < new[j] <= cur:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j >= 0);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_prev < __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 <= __pyx_v_cur);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":680
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":681
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":682
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      if (__pyx_t_13) {
        __pyx_t_12 = (__pyx_v_fill_count < __pyx_v_lim);
        __pyx_t_16 = __pyx_t_12;
      } else {
        __pyx_t_16 = __pyx_t_13;
      }
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":683
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j -= 1
 */
        __pyx_t_29 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":684
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":685
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "pandas/src/generated.pyx":687
 *             j -= 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i -= 1
 *         cur = prev
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":688
 * 
 *         fill_count = 0
 *         i -= 1             # <<<<<<<<<<<<<<
 *         cur = prev
 * 
 */
    __pyx_v_i = (__pyx_v_i - 1);

    /* "pandas/src/generated.pyx":689
 *         fill_count = 0
 *         i -= 1
 *         cur = prev             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_prev;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":691
 *         cur = prev
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_161backfill_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_161backfill_int64 = {__Pyx_NAMESTR("backfill_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_161backfill_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_161backfill_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":696
 * @cython.wraparound(False)
 * def backfill_int64(ndarray[int64_t] old, ndarray[int64_t] new,
 *                       limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_160backfill_int64(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":695
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_160backfill_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_cur;
  __pyx_t_5numpy_int64_t __pyx_v_prev;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_int64_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_int64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":700
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef int64_t cur, prev
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":702
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":703
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":704
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":705
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":707
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":708
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":710
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":711
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":712
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":714
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_14 = 0;
      __pyx_t_1 = (__pyx_v_nleft - 1);
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_new.diminfo[0].strides)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":715
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = nleft - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":717
 *         return indexer
 * 
 *     i = nleft - 1             # <<<<<<<<<<<<<<
 *     j = nright - 1
 * 
 */
  __pyx_v_i = (__pyx_v_nleft - 1);

  /* "pandas/src/generated.pyx":718
 * 
 *     i = nleft - 1
 *     j = nright - 1             # <<<<<<<<<<<<<<
 * 
 *     cur = old[nleft - 1]
 */
  __pyx_v_j = (__pyx_v_nright - 1);

  /* "pandas/src/generated.pyx":720
 *     j = nright - 1
 * 
 *     cur = old[nleft - 1]             # <<<<<<<<<<<<<<
 * 
 *     while j >= 0 and new[j] > cur:
 */
  __pyx_t_17 = (__pyx_v_nleft - 1);
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":722
 *     cur = old[nleft - 1]
 * 
 *     while j >= 0 and new[j] > cur:             # <<<<<<<<<<<<<<
 *         j -= 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j >= 0);
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":723
 * 
 *     while j >= 0 and new[j] > cur:
 *         j -= 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j - 1);
  }

  /* "pandas/src/generated.pyx":725
 *         j -= 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j < 0:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":726
 * 
 *     while True:
 *         if j < 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j < 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":727
 *     while True:
 *         if j < 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == 0:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":729
 *             break
 * 
 *         if i == 0:             # <<<<<<<<<<<<<<
 *             while j >= 0:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":730
 * 
 *         if i == 0:
 *             while j >= 0:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j >= 0);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":731
 *         if i == 0:
 *             while j >= 0:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":732
 *             while j >= 0:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":733
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":734
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j -= 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":735
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j -= 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":736
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j -= 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/src/generated.pyx":737
 *                     fill_count += 1
 *                 j -= 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         prev = old[i - 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":739
 *             break
 * 
 *         prev = old[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 */
    __pyx_t_23 = (__pyx_v_i - 1);
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":741
 *         prev = old[i - 1]
 * 
 *         while j >= 0 and prev < new[j] <= cur:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j >= 0);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_prev < __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 <= __pyx_v_cur);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":742
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":743
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":744
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      if (__pyx_t_13) {
        __pyx_t_12 = (__pyx_v_fill_count < __pyx_v_lim);
        __pyx_t_16 = __pyx_t_12;
      } else {
        __pyx_t_16 = __pyx_t_13;
      }
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":745
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j -= 1
 */
        __pyx_t_29 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":746
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":747
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "pandas/src/generated.pyx":749
 *             j -= 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i -= 1
 *         cur = prev
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":750
 * 
 *         fill_count = 0
 *         i -= 1             # <<<<<<<<<<<<<<
 *         cur = prev
 * 
 */
    __pyx_v_i = (__pyx_v_i - 1);

    /* "pandas/src/generated.pyx":751
 *         fill_count = 0
 *         i -= 1
 *         cur = prev             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_prev;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":753
 *         cur = prev
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_163backfill_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_163backfill_bool = {__Pyx_NAMESTR("backfill_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_163backfill_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_163backfill_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_old = 0;
  PyArrayObject *__pyx_v_new = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__old,&__pyx_n_s__new,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":758
 * @cython.wraparound(False)
 * def backfill_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,
 *                       limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nleft, nright
 *     cdef ndarray[int64_t, ndim=1] indexer
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__new)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_old = ((PyArrayObject *)values[0]);
    __pyx_v_new = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old), __pyx_ptype_5numpy_ndarray, 1, "old", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_new), __pyx_ptype_5numpy_ndarray, 1, "new", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_162backfill_bool(__pyx_self, __pyx_v_old, __pyx_v_new, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":757
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */

static PyObject *__pyx_pf_6pandas_5algos_162backfill_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_old, PyArrayObject *__pyx_v_new, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_cur;
  __pyx_t_5numpy_uint8_t __pyx_v_prev;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_new;
  __Pyx_Buffer __pyx_pybuffer_new;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_old;
  __Pyx_Buffer __pyx_pybuffer_old;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __pyx_t_5numpy_uint8_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_bool", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_old.pybuffer.buf = NULL;
  __pyx_pybuffer_old.refcount = 0;
  __pyx_pybuffernd_old.data = NULL;
  __pyx_pybuffernd_old.rcbuffer = &__pyx_pybuffer_old;
  __pyx_pybuffer_new.pybuffer.buf = NULL;
  __pyx_pybuffer_new.refcount = 0;
  __pyx_pybuffernd_new.data = NULL;
  __pyx_pybuffernd_new.rcbuffer = &__pyx_pybuffer_new;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old.rcbuffer->pybuffer, (PyObject*)__pyx_v_old, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_old.diminfo[0].strides = __pyx_pybuffernd_old.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old.diminfo[0].shape = __pyx_pybuffernd_old.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_new.rcbuffer->pybuffer, (PyObject*)__pyx_v_new, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_new.diminfo[0].strides = __pyx_pybuffernd_new.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_new.diminfo[0].shape = __pyx_pybuffernd_new.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":762
 *     cdef ndarray[int64_t, ndim=1] indexer
 *     cdef uint8_t cur, prev
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     nleft = len(old)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":764
 *     cdef int lim, fill_count = 0
 * 
 *     nleft = len(old)             # <<<<<<<<<<<<<<
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_old)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":765
 * 
 *     nleft = len(old)
 *     nright = len(new)             # <<<<<<<<<<<<<<
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_new)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":766
 *     nleft = len(old)
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     indexer.fill(-1)
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nright); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":767
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_indexer), __pyx_n_s__fill); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/generated.pyx":769
 *     indexer.fill(-1)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = nright
 *     else:
 */
  __pyx_t_12 = (__pyx_v_limit == Py_None);
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":770
 * 
 *     if limit is None:
 *         lim = nright             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_nright;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":772
 *         lim = nright
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":773
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":774
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 */
    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_8;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":776
 *         lim = limit
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:             # <<<<<<<<<<<<<<
 *         return indexer
 * 
 */
  __pyx_t_12 = (__pyx_v_nleft == 0);
  if (!__pyx_t_12) {
    __pyx_t_13 = (__pyx_v_nright == 0);
    if (!__pyx_t_13) {
      __pyx_t_14 = 0;
      __pyx_t_1 = (__pyx_v_nleft - 1);
      __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_new.diminfo[0].strides)) > (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_old.diminfo[0].strides)));
      __pyx_t_16 = __pyx_t_15;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    __pyx_t_13 = __pyx_t_16;
  } else {
    __pyx_t_13 = __pyx_t_12;
  }
  if (__pyx_t_13) {

    /* "pandas/src/generated.pyx":777
 * 
 *     if nleft == 0 or nright == 0 or new[0] > old[nleft - 1]:
 *         return indexer             # <<<<<<<<<<<<<<
 * 
 *     i = nleft - 1
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
    __pyx_r = ((PyObject *)__pyx_v_indexer);
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":779
 *         return indexer
 * 
 *     i = nleft - 1             # <<<<<<<<<<<<<<
 *     j = nright - 1
 * 
 */
  __pyx_v_i = (__pyx_v_nleft - 1);

  /* "pandas/src/generated.pyx":780
 * 
 *     i = nleft - 1
 *     j = nright - 1             # <<<<<<<<<<<<<<
 * 
 *     cur = old[nleft - 1]
 */
  __pyx_v_j = (__pyx_v_nright - 1);

  /* "pandas/src/generated.pyx":782
 *     j = nright - 1
 * 
 *     cur = old[nleft - 1]             # <<<<<<<<<<<<<<
 * 
 *     while j >= 0 and new[j] > cur:
 */
  __pyx_t_17 = (__pyx_v_nleft - 1);
  __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_old.diminfo[0].strides));

  /* "pandas/src/generated.pyx":784
 *     cur = old[nleft - 1]
 * 
 *     while j >= 0 and new[j] > cur:             # <<<<<<<<<<<<<<
 *         j -= 1
 * 
 */
  while (1) {
    __pyx_t_13 = (__pyx_v_j >= 0);
    if (__pyx_t_13) {
      __pyx_t_18 = __pyx_v_j;
      __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_new.diminfo[0].strides)) > __pyx_v_cur);
      __pyx_t_16 = __pyx_t_12;
    } else {
      __pyx_t_16 = __pyx_t_13;
    }
    if (!__pyx_t_16) break;

    /* "pandas/src/generated.pyx":785
 * 
 *     while j >= 0 and new[j] > cur:
 *         j -= 1             # <<<<<<<<<<<<<<
 * 
 *     while True:
 */
    __pyx_v_j = (__pyx_v_j - 1);
  }

  /* "pandas/src/generated.pyx":787
 *         j -= 1
 * 
 *     while True:             # <<<<<<<<<<<<<<
 *         if j < 0:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":788
 * 
 *     while True:
 *         if j < 0:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_16 = (__pyx_v_j < 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":789
 *     while True:
 *         if j < 0:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if i == 0:
 */
      goto __pyx_L9_break;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "pandas/src/generated.pyx":791
 *             break
 * 
 *         if i == 0:             # <<<<<<<<<<<<<<
 *             while j >= 0:
 *                 if new[j] == cur:
 */
    __pyx_t_16 = (__pyx_v_i == 0);
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":792
 * 
 *         if i == 0:
 *             while j >= 0:             # <<<<<<<<<<<<<<
 *                 if new[j] == cur:
 *                     indexer[j] = i
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_j >= 0);
        if (!__pyx_t_16) break;

        /* "pandas/src/generated.pyx":793
 *         if i == 0:
 *             while j >= 0:
 *                 if new[j] == cur:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
        if (__pyx_t_16) {

          /* "pandas/src/generated.pyx":794
 *             while j >= 0:
 *                 if new[j] == cur:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 */
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
          goto __pyx_L14;
        }

        /* "pandas/src/generated.pyx":795
 *                 if new[j] == cur:
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                     indexer[j] = i
 *                     fill_count += 1
 */
        __pyx_t_21 = __pyx_v_j;
        __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
        if (__pyx_t_16) {
          __pyx_t_13 = (__pyx_v_fill_count < __pyx_v_lim);
          __pyx_t_12 = __pyx_t_13;
        } else {
          __pyx_t_12 = __pyx_t_16;
        }
        if (__pyx_t_12) {

          /* "pandas/src/generated.pyx":796
 *                     indexer[j] = i
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i             # <<<<<<<<<<<<<<
 *                     fill_count += 1
 *                 j -= 1
 */
          __pyx_t_22 = __pyx_v_j;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":797
 *                 elif new[j] < cur and fill_count < lim:
 *                     indexer[j] = i
 *                     fill_count += 1             # <<<<<<<<<<<<<<
 *                 j -= 1
 *             break
 */
          __pyx_v_fill_count = (__pyx_v_fill_count + 1);
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "pandas/src/generated.pyx":798
 *                     indexer[j] = i
 *                     fill_count += 1
 *                 j -= 1             # <<<<<<<<<<<<<<
 *             break
 * 
 */
        __pyx_v_j = (__pyx_v_j - 1);
      }

      /* "pandas/src/generated.pyx":799
 *                     fill_count += 1
 *                 j -= 1
 *             break             # <<<<<<<<<<<<<<
 * 
 *         prev = old[i - 1]
 */
      goto __pyx_L9_break;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "pandas/src/generated.pyx":801
 *             break
 * 
 *         prev = old[i - 1]             # <<<<<<<<<<<<<<
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 */
    __pyx_t_23 = (__pyx_v_i - 1);
    __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_old.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_old.diminfo[0].strides));

    /* "pandas/src/generated.pyx":803
 *         prev = old[i - 1]
 * 
 *         while j >= 0 and prev < new[j] <= cur:             # <<<<<<<<<<<<<<
 *             if new[j] == cur:
 *                 indexer[j] = i
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_j >= 0);
      if (__pyx_t_12) {
        __pyx_t_24 = __pyx_v_j;
        __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_new.diminfo[0].strides));
        __pyx_t_16 = (__pyx_v_prev < __pyx_t_25);
        if (__pyx_t_16) {
          __pyx_t_16 = (__pyx_t_25 <= __pyx_v_cur);
        }
        __pyx_t_13 = __pyx_t_16;
      } else {
        __pyx_t_13 = __pyx_t_12;
      }
      if (!__pyx_t_13) break;

      /* "pandas/src/generated.pyx":804
 * 
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_new.diminfo[0].strides)) == __pyx_v_cur);
      if (__pyx_t_13) {

        /* "pandas/src/generated.pyx":805
 *         while j >= 0 and prev < new[j] <= cur:
 *             if new[j] == cur:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 */
        __pyx_t_27 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;
        goto __pyx_L17;
      }

      /* "pandas/src/generated.pyx":806
 *             if new[j] == cur:
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:             # <<<<<<<<<<<<<<
 *                 indexer[j] = i
 *                 fill_count += 1
 */
      __pyx_t_28 = __pyx_v_j;
      __pyx_t_13 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_new.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_new.diminfo[0].strides)) < __pyx_v_cur);
      if (__pyx_t_13) {
        __pyx_t_12 = (__pyx_v_fill_count < __pyx_v_lim);
        __pyx_t_16 = __pyx_t_12;
      } else {
        __pyx_t_16 = __pyx_t_13;
      }
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":807
 *                 indexer[j] = i
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *             j -= 1
 */
        __pyx_t_29 = __pyx_v_j;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":808
 *             elif new[j] < cur and fill_count < lim:
 *                 indexer[j] = i
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *             j -= 1
 * 
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":809
 *                 indexer[j] = i
 *                 fill_count += 1
 *             j -= 1             # <<<<<<<<<<<<<<
 * 
 *         fill_count = 0
 */
      __pyx_v_j = (__pyx_v_j - 1);
    }

    /* "pandas/src/generated.pyx":811
 *             j -= 1
 * 
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         i -= 1
 *         cur = prev
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":812
 * 
 *         fill_count = 0
 *         i -= 1             # <<<<<<<<<<<<<<
 *         cur = prev
 * 
 */
    __pyx_v_i = (__pyx_v_i - 1);

    /* "pandas/src/generated.pyx":813
 *         fill_count = 0
 *         i -= 1
 *         cur = prev             # <<<<<<<<<<<<<<
 * 
 *     return indexer
 */
    __pyx_v_cur = __pyx_v_prev;
  }
  __pyx_L9_break:;

  /* "pandas/src/generated.pyx":815
 *         cur = prev
 * 
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_new.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_old.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_165pad_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_165pad_inplace_float64 = {__Pyx_NAMESTR("pad_inplace_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_165pad_inplace_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_165pad_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_inplace_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":822
 * def pad_inplace_float64(ndarray[float64_t] values,
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef float64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_inplace_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_inplace_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_inplace_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_164pad_inplace_float64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":820
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_164pad_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  long __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __pyx_t_5numpy_uint8_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_inplace_float64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":825
 *     cdef Py_ssize_t i, N
 *     cdef float64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":827
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":829
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":830
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":832
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":833
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":834
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[0]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":836
 *         lim = limit
 * 
 *     val = values[0]             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         if mask[i]:
 */
  __pyx_t_5 = 0;
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":837
 * 
 *     val = values[0]
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pandas/src/generated.pyx":838
 *     val = values[0]
 *     for i in range(N):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":839
 *     for i in range(N):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":840
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":841
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":842
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_9 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":844
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":845
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      __pyx_t_10 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_167pad_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_167pad_inplace_object = {__Pyx_NAMESTR("pad_inplace_object"), (PyCFunction)__pyx_pw_6pandas_5algos_167pad_inplace_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_167pad_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_inplace_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":851
 * def pad_inplace_object(ndarray[object] values,
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef object val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_inplace_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_inplace_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_inplace_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_166pad_inplace_object(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":849
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_166pad_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyObject *__pyx_v_val = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  long __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __pyx_t_5numpy_uint8_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject **__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_inplace_object", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":854
 *     cdef Py_ssize_t i, N
 *     cdef object val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":856
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":858
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":859
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":861
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":862
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_72), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":863
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[0]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":865
 *         lim = limit
 * 
 *     val = values[0]             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         if mask[i]:
 */
  __pyx_t_5 = 0;
  __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_values.diminfo[0].strides);
  __Pyx_INCREF((PyObject*)__pyx_t_3);
  __pyx_v_val = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":866
 * 
 *     val = values[0]
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pandas/src/generated.pyx":867
 *     val = values[0]
 *     for i in range(N):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":868
 *     for i in range(N):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":869
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":870
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":871
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_9 = __pyx_v_i;
      __pyx_t_10 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides);
      __Pyx_GOTREF(*__pyx_t_10);
      __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_10);
      *__pyx_t_10 = __pyx_v_val;
      __Pyx_GIVEREF(*__pyx_t_10);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":873
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":874
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      __pyx_t_11 = __pyx_v_i;
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_values.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_DECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_169pad_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_169pad_inplace_int32 = {__Pyx_NAMESTR("pad_inplace_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_169pad_inplace_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_169pad_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_inplace_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":880
 * def pad_inplace_int32(ndarray[int32_t] values,
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef int32_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_inplace_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_inplace_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_inplace_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_168pad_inplace_int32(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":878
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_168pad_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_int32_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  long __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __pyx_t_5numpy_uint8_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_inplace_int32", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":883
 *     cdef Py_ssize_t i, N
 *     cdef int32_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":885
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":887
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":888
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":890
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":891
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_73), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":892
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[0]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":894
 *         lim = limit
 * 
 *     val = values[0]             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         if mask[i]:
 */
  __pyx_t_5 = 0;
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":895
 * 
 *     val = values[0]
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pandas/src/generated.pyx":896
 *     val = values[0]
 *     for i in range(N):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":897
 *     for i in range(N):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":898
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":899
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":900
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_9 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":902
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":903
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      __pyx_t_10 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_171pad_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_171pad_inplace_int64 = {__Pyx_NAMESTR("pad_inplace_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_171pad_inplace_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_171pad_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_inplace_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":909
 * def pad_inplace_int64(ndarray[int64_t] values,
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef int64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_inplace_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_inplace_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_inplace_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_170pad_inplace_int64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":907
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_170pad_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  long __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __pyx_t_5numpy_uint8_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_inplace_int64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":912
 *     cdef Py_ssize_t i, N
 *     cdef int64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":914
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":916
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":917
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":919
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":920
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":921
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[0]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":923
 *         lim = limit
 * 
 *     val = values[0]             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         if mask[i]:
 */
  __pyx_t_5 = 0;
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":924
 * 
 *     val = values[0]
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pandas/src/generated.pyx":925
 *     val = values[0]
 *     for i in range(N):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":926
 *     for i in range(N):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":927
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":928
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":929
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_9 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":931
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":932
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      __pyx_t_10 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_173pad_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_173pad_inplace_bool = {__Pyx_NAMESTR("pad_inplace_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_173pad_inplace_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_173pad_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_inplace_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":938
 * def pad_inplace_bool(ndarray[uint8_t] values,
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef uint8_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_inplace_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_inplace_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_inplace_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_172pad_inplace_bool(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":936
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_172pad_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_uint8_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  long __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  __pyx_t_5numpy_uint8_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_inplace_bool", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":941
 *     cdef Py_ssize_t i, N
 *     cdef uint8_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":943
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":945
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":946
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":948
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":949
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":950
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[0]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":952
 *         lim = limit
 * 
 *     val = values[0]             # <<<<<<<<<<<<<<
 *     for i in range(N):
 *         if mask[i]:
 */
  __pyx_t_5 = 0;
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":953
 * 
 *     val = values[0]
 *     for i in range(N):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  __pyx_t_1 = __pyx_v_N;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_1; __pyx_t_6+=1) {
    __pyx_v_i = __pyx_t_6;

    /* "pandas/src/generated.pyx":954
 *     val = values[0]
 *     for i in range(N):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_7 = __pyx_v_i;
    __pyx_t_8 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":955
 *     for i in range(N):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":956
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":957
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":958
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_9 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":960
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":961
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_10 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_175backfill_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_175backfill_inplace_float64 = {__Pyx_NAMESTR("backfill_inplace_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_175backfill_inplace_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_175backfill_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_inplace_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":968
 * def backfill_inplace_float64(ndarray[float64_t] values,
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef float64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_inplace_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_inplace_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_inplace_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_174backfill_inplace_float64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":966
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_174backfill_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __pyx_t_5numpy_uint8_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_inplace_float64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":971
 *     cdef Py_ssize_t i, N
 *     cdef float64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":973
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":975
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":976
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":978
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":979
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":980
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[N - 1]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":982
 *         lim = limit
 * 
 *     val = values[N - 1]             # <<<<<<<<<<<<<<
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 */
  __pyx_t_1 = (__pyx_v_N - 1);
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":983
 * 
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  for (__pyx_t_5 = (__pyx_v_N - 1); __pyx_t_5 > -1; __pyx_t_5-=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/src/generated.pyx":984
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_7) {

      /* "pandas/src/generated.pyx":985
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":986
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":987
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":988
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_8 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":990
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * @cython.boundscheck(False)
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":991
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
      __pyx_t_9 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_177backfill_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_177backfill_inplace_object = {__Pyx_NAMESTR("backfill_inplace_object"), (PyCFunction)__pyx_pw_6pandas_5algos_177backfill_inplace_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_177backfill_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_inplace_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":996
 * def backfill_inplace_object(ndarray[object] values,
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef object val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_inplace_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_inplace_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_inplace_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_176backfill_inplace_object(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":994
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_176backfill_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  PyObject *__pyx_v_val = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __pyx_t_5numpy_uint8_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject **__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_inplace_object", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":999
 *     cdef Py_ssize_t i, N
 *     cdef object val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1001
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":1003
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1004
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1006
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1007
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":1008
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[N - 1]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1010
 *         lim = limit
 * 
 *     val = values[N - 1]             # <<<<<<<<<<<<<<
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 */
  __pyx_t_1 = (__pyx_v_N - 1);
  __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_values.diminfo[0].strides);
  __Pyx_INCREF((PyObject*)__pyx_t_3);
  __pyx_v_val = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1011
 * 
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  for (__pyx_t_5 = (__pyx_v_N - 1); __pyx_t_5 > -1; __pyx_t_5-=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/src/generated.pyx":1012
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_7) {

      /* "pandas/src/generated.pyx":1013
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":1014
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":1015
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":1016
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_8 = __pyx_v_i;
      __pyx_t_9 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_values.diminfo[0].strides);
      __Pyx_GOTREF(*__pyx_t_9);
      __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_9);
      *__pyx_t_9 = __pyx_v_val;
      __Pyx_GIVEREF(*__pyx_t_9);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1018
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * @cython.boundscheck(False)
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":1019
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
      __pyx_t_10 = __pyx_v_i;
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_DECREF(__pyx_v_val);
      __pyx_v_val = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_179backfill_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_179backfill_inplace_int32 = {__Pyx_NAMESTR("backfill_inplace_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_179backfill_inplace_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_179backfill_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_inplace_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1024
 * def backfill_inplace_int32(ndarray[int32_t] values,
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef int32_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_inplace_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_inplace_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_inplace_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_178backfill_inplace_int32(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1022
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_178backfill_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_int32_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __pyx_t_5numpy_uint8_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_inplace_int32", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1027
 *     cdef Py_ssize_t i, N
 *     cdef int32_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1029
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":1031
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1032
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1034
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1035
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":1036
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[N - 1]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1038
 *         lim = limit
 * 
 *     val = values[N - 1]             # <<<<<<<<<<<<<<
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 */
  __pyx_t_1 = (__pyx_v_N - 1);
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1039
 * 
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  for (__pyx_t_5 = (__pyx_v_N - 1); __pyx_t_5 > -1; __pyx_t_5-=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/src/generated.pyx":1040
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_7) {

      /* "pandas/src/generated.pyx":1041
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":1042
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":1043
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":1044
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_8 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1046
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * @cython.boundscheck(False)
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":1047
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
      __pyx_t_9 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_181backfill_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_181backfill_inplace_int64 = {__Pyx_NAMESTR("backfill_inplace_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_181backfill_inplace_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_181backfill_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_inplace_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1052
 * def backfill_inplace_int64(ndarray[int64_t] values,
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef int64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_inplace_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_inplace_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_inplace_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_180backfill_inplace_int64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1050
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_180backfill_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __pyx_t_5numpy_uint8_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_inplace_int64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1055
 *     cdef Py_ssize_t i, N
 *     cdef int64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1057
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":1059
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1060
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1062
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1063
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_79), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":1064
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[N - 1]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1066
 *         lim = limit
 * 
 *     val = values[N - 1]             # <<<<<<<<<<<<<<
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 */
  __pyx_t_1 = (__pyx_v_N - 1);
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1067
 * 
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  for (__pyx_t_5 = (__pyx_v_N - 1); __pyx_t_5 > -1; __pyx_t_5-=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/src/generated.pyx":1068
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_7) {

      /* "pandas/src/generated.pyx":1069
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":1070
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":1071
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":1072
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_8 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1074
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * @cython.boundscheck(False)
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":1075
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
      __pyx_t_9 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_183backfill_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_183backfill_inplace_bool = {__Pyx_NAMESTR("backfill_inplace_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_183backfill_inplace_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_183backfill_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_inplace_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1080
 * def backfill_inplace_bool(ndarray[uint8_t] values,
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, N
 *     cdef uint8_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_inplace_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_inplace_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_inplace_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_182backfill_inplace_bool(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1078
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_182backfill_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_N;
  __pyx_t_5numpy_uint8_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __pyx_t_5numpy_uint8_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_inplace_bool", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 1, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1083
 *     cdef Py_ssize_t i, N
 *     cdef uint8_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     N = len(values)
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1085
 *     cdef int lim, fill_count = 0
 * 
 *     N = len(values)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_N = __pyx_t_1;

  /* "pandas/src/generated.pyx":1087
 *     N = len(values)
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_2 = (__pyx_v_limit == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1088
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1090
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1091
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "pandas/src/generated.pyx":1092
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     val = values[N - 1]
 */
    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_4;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1094
 *         lim = limit
 * 
 *     val = values[N - 1]             # <<<<<<<<<<<<<<
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 */
  __pyx_t_1 = (__pyx_v_N - 1);
  __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_values.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1095
 * 
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *         if mask[i]:
 *             if fill_count >= lim:
 */
  for (__pyx_t_5 = (__pyx_v_N - 1); __pyx_t_5 > -1; __pyx_t_5-=1) {
    __pyx_v_i = __pyx_t_5;

    /* "pandas/src/generated.pyx":1096
 *     val = values[N - 1]
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:             # <<<<<<<<<<<<<<
 *             if fill_count >= lim:
 *                 continue
 */
    __pyx_t_6 = __pyx_v_i;
    __pyx_t_7 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_mask.diminfo[0].strides));
    if (__pyx_t_7) {

      /* "pandas/src/generated.pyx":1097
 *     for i in range(N - 1, -1 , -1):
 *         if mask[i]:
 *             if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                 continue
 *             fill_count += 1
 */
      __pyx_t_2 = (__pyx_v_fill_count >= __pyx_v_lim);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":1098
 *         if mask[i]:
 *             if fill_count >= lim:
 *                 continue             # <<<<<<<<<<<<<<
 *             fill_count += 1
 *             values[i] = val
 */
        goto __pyx_L5_continue;
        goto __pyx_L8;
      }
      __pyx_L8:;

      /* "pandas/src/generated.pyx":1099
 *             if fill_count >= lim:
 *                 continue
 *             fill_count += 1             # <<<<<<<<<<<<<<
 *             values[i] = val
 *         else:
 */
      __pyx_v_fill_count = (__pyx_v_fill_count + 1);

      /* "pandas/src/generated.pyx":1100
 *                 continue
 *             fill_count += 1
 *             values[i] = val             # <<<<<<<<<<<<<<
 *         else:
 *             fill_count = 0
 */
      __pyx_t_8 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_values.diminfo[0].strides) = __pyx_v_val;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1102
 *             values[i] = val
 *         else:
 *             fill_count = 0             # <<<<<<<<<<<<<<
 *             val = values[i]
 * 
 */
      __pyx_v_fill_count = 0;

      /* "pandas/src/generated.pyx":1103
 *         else:
 *             fill_count = 0
 *             val = values[i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
      __pyx_t_9 = __pyx_v_i;
      __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_values.diminfo[0].strides));
    }
    __pyx_L7:;
    __pyx_L5_continue:;
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_185pad_2d_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_185pad_2d_inplace_float64 = {__Pyx_NAMESTR("pad_2d_inplace_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_185pad_2d_inplace_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_185pad_2d_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_2d_inplace_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1109
 * def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef float64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_2d_inplace_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_184pad_2d_inplace_float64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1107
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_184pad_2d_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_uint8_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_2d_inplace_float64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1112
 *     cdef Py_ssize_t i, j, N, K
 *     cdef float64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1114
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1116
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1117
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1119
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1120
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1121
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1123
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, 0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1124
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, 0]
 *         for i in range(N):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1125
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, 0]             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = 0;
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1126
 *         fill_count = 0
 *         val = values[j, 0]
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1127
 *         val = values[j, 0]
 *         for i in range(N):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":1128
 *         for i in range(N):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1129
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1130
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1131
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1133
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1134
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_20 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_187pad_2d_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_187pad_2d_inplace_object = {__Pyx_NAMESTR("pad_2d_inplace_object"), (PyCFunction)__pyx_pw_6pandas_5algos_187pad_2d_inplace_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_187pad_2d_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_2d_inplace_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1139
 * def pad_2d_inplace_object(ndarray[object, ndim=2] values,
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef object val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_2d_inplace_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_186pad_2d_inplace_object(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1137
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_186pad_2d_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyObject *__pyx_v_val = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_uint8_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  PyObject **__pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_2d_inplace_object", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1142
 *     cdef Py_ssize_t i, j, N, K
 *     cdef object val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1144
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1146
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1147
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1149
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1150
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1151
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1153
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, 0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1154
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, 0]
 *         for i in range(N):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1155
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, 0]             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = 0;
    __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1156
 *         fill_count = 0
 *         val = values[j, 0]
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1157
 *         val = values[j, 0]
 *         for i in range(N):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":1158
 *         for i in range(N):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1159
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1160
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1161
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = __pyx_v_i;
        __pyx_t_19 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_19);
        __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_19);
        *__pyx_t_19 = __pyx_v_val;
        __Pyx_GIVEREF(*__pyx_t_19);
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1163
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1164
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_20 = __pyx_v_j;
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_values.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        __Pyx_DECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_189pad_2d_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_189pad_2d_inplace_int32 = {__Pyx_NAMESTR("pad_2d_inplace_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_189pad_2d_inplace_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_189pad_2d_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_2d_inplace_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1169
 * def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int32_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_2d_inplace_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_188pad_2d_inplace_int32(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1167
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_188pad_2d_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_int32_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_uint8_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_2d_inplace_int32", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1172
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int32_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1174
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1176
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1177
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1179
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1180
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1181
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1183
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, 0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1184
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, 0]
 *         for i in range(N):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1185
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, 0]             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = 0;
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1186
 *         fill_count = 0
 *         val = values[j, 0]
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1187
 *         val = values[j, 0]
 *         for i in range(N):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":1188
 *         for i in range(N):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1189
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1190
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1191
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1193
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1194
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_20 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_191pad_2d_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_191pad_2d_inplace_int64 = {__Pyx_NAMESTR("pad_2d_inplace_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_191pad_2d_inplace_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_191pad_2d_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_2d_inplace_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1199
 * def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_2d_inplace_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_190pad_2d_inplace_int64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1197
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_190pad_2d_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_uint8_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_2d_inplace_int64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1202
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1204
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1206
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1207
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1209
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1210
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1211
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1213
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, 0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1214
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, 0]
 *         for i in range(N):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1215
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, 0]             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = 0;
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1216
 *         fill_count = 0
 *         val = values[j, 0]
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1217
 *         val = values[j, 0]
 *         for i in range(N):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":1218
 *         for i in range(N):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1219
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1220
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1221
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1223
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1224
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_20 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_193pad_2d_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_193pad_2d_inplace_bool = {__Pyx_NAMESTR("pad_2d_inplace_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_193pad_2d_inplace_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_193pad_2d_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pad_2d_inplace_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1229
 * def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef uint8_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pad_2d_inplace_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pad_2d_inplace_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_192pad_2d_inplace_bool(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1227
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_192pad_2d_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_uint8_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  long __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __pyx_t_5numpy_uint8_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("pad_2d_inplace_bool", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1232
 *     cdef Py_ssize_t i, j, N, K
 *     cdef uint8_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1234
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1236
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1237
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1239
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1240
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_85), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1241
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1243
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, 0]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1244
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, 0]
 *         for i in range(N):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1245
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, 0]             # <<<<<<<<<<<<<<
 *         for i in range(N):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = 0;
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1246
 *         fill_count = 0
 *         val = values[j, 0]
 *         for i in range(N):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    __pyx_t_12 = __pyx_v_N;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1247
 *         val = values[j, 0]
 *         for i in range(N):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_t_15 = __pyx_v_i;
      __pyx_t_16 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_16) {

        /* "pandas/src/generated.pyx":1248
 *         for i in range(N):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1249
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1250
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1251
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_17 = __pyx_v_j;
        __pyx_t_18 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1253
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * 
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1254
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * 
 * @cython.boundscheck(False)
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_20 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.pad_2d_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_195backfill_2d_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_195backfill_2d_inplace_float64 = {__Pyx_NAMESTR("backfill_2d_inplace_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_195backfill_2d_inplace_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_195backfill_2d_inplace_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_2d_inplace_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1260
 * def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef float64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_float64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_2d_inplace_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_float64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_194backfill_2d_inplace_float64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1258
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_194backfill_2d_inplace_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_float64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_5numpy_uint8_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_2d_inplace_float64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1263
 *     cdef Py_ssize_t i, j, N, K
 *     cdef float64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1265
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1267
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1268
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1270
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1271
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_86), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1272
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1274
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, N - 1]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1275
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1276
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, N - 1]             # <<<<<<<<<<<<<<
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = (__pyx_v_N - 1);
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1277
 *         fill_count = 0
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    for (__pyx_t_12 = (__pyx_v_N - 1); __pyx_t_12 > -1; __pyx_t_12-=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/src/generated.pyx":1278
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_13 = __pyx_v_j;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_15) {

        /* "pandas/src/generated.pyx":1279
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1280
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1281
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1282
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1284
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1285
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_18 = __pyx_v_j;
        __pyx_t_19 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_197backfill_2d_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_197backfill_2d_inplace_object = {__Pyx_NAMESTR("backfill_2d_inplace_object"), (PyCFunction)__pyx_pw_6pandas_5algos_197backfill_2d_inplace_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_197backfill_2d_inplace_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_2d_inplace_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1290
 * def backfill_2d_inplace_object(ndarray[object, ndim=2] values,
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef object val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_object", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_2d_inplace_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_object", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_196backfill_2d_inplace_object(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1288
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_196backfill_2d_inplace_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  PyObject *__pyx_v_val = 0;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_5numpy_uint8_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  PyObject **__pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_2d_inplace_object", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1293
 *     cdef Py_ssize_t i, j, N, K
 *     cdef object val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1295
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1297
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1298
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1300
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1301
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_87), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1302
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1304
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, N - 1]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1305
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1306
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, N - 1]             # <<<<<<<<<<<<<<
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = (__pyx_v_N - 1);
    __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1307
 *         fill_count = 0
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    for (__pyx_t_12 = (__pyx_v_N - 1); __pyx_t_12 > -1; __pyx_t_12-=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/src/generated.pyx":1308
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_13 = __pyx_v_j;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_15) {

        /* "pandas/src/generated.pyx":1309
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1310
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1311
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1312
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = __pyx_v_i;
        __pyx_t_18 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides);
        __Pyx_GOTREF(*__pyx_t_18);
        __Pyx_INCREF(__pyx_v_val); __Pyx_DECREF(*__pyx_t_18);
        *__pyx_t_18 = __pyx_v_val;
        __Pyx_GIVEREF(*__pyx_t_18);
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1314
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1315
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_19 = __pyx_v_j;
        __pyx_t_20 = __pyx_v_i;
        __pyx_t_1 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        __Pyx_DECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_199backfill_2d_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_199backfill_2d_inplace_int32 = {__Pyx_NAMESTR("backfill_2d_inplace_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_199backfill_2d_inplace_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_199backfill_2d_inplace_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_2d_inplace_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1320
 * def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int32_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_int32", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_2d_inplace_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_int32", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_198backfill_2d_inplace_int32(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1318
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_198backfill_2d_inplace_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_int32_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_5numpy_uint8_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_2d_inplace_int32", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1323
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int32_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1325
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1327
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1328
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1330
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1331
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_88), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1332
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1334
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, N - 1]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1335
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1336
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, N - 1]             # <<<<<<<<<<<<<<
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = (__pyx_v_N - 1);
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1337
 *         fill_count = 0
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    for (__pyx_t_12 = (__pyx_v_N - 1); __pyx_t_12 > -1; __pyx_t_12-=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/src/generated.pyx":1338
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_13 = __pyx_v_j;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_15) {

        /* "pandas/src/generated.pyx":1339
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1340
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1341
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1342
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1344
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1345
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_18 = __pyx_v_j;
        __pyx_t_19 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_201backfill_2d_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_201backfill_2d_inplace_int64 = {__Pyx_NAMESTR("backfill_2d_inplace_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_201backfill_2d_inplace_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_201backfill_2d_inplace_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_2d_inplace_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1350
 * def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int64_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_int64", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_2d_inplace_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_int64", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_200backfill_2d_inplace_int64(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1348
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_200backfill_2d_inplace_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_int64_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_5numpy_uint8_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_2d_inplace_int64", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1353
 *     cdef Py_ssize_t i, j, N, K
 *     cdef int64_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1355
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1357
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1358
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1360
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1361
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_89), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1362
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1364
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, N - 1]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1365
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1366
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, N - 1]             # <<<<<<<<<<<<<<
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = (__pyx_v_N - 1);
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1367
 *         fill_count = 0
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    for (__pyx_t_12 = (__pyx_v_N - 1); __pyx_t_12 > -1; __pyx_t_12-=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/src/generated.pyx":1368
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_13 = __pyx_v_j;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_15) {

        /* "pandas/src/generated.pyx":1369
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1370
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1371
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1372
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1374
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * @cython.boundscheck(False)
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1375
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
        __pyx_t_18 = __pyx_v_j;
        __pyx_t_19 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_203backfill_2d_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_203backfill_2d_inplace_bool = {__Pyx_NAMESTR("backfill_2d_inplace_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_203backfill_2d_inplace_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_203backfill_2d_inplace_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_mask = 0;
  PyObject *__pyx_v_limit = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("backfill_2d_inplace_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__mask,&__pyx_n_s__limit,0};
    PyObject* values[3] = {0,0,0};

    /* "pandas/src/generated.pyx":1380
 * def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, N, K
 *     cdef uint8_t val
 */
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_bool", 0, 2, 3, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__limit);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "backfill_2d_inplace_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_mask = ((PyArrayObject *)values[1]);
    __pyx_v_limit = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("backfill_2d_inplace_bool", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_202backfill_2d_inplace_bool(__pyx_self, __pyx_v_values, __pyx_v_mask, __pyx_v_limit);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1378
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */

static PyObject *__pyx_pf_6pandas_5algos_202backfill_2d_inplace_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_mask, PyObject *__pyx_v_limit) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_N;
  Py_ssize_t __pyx_v_K;
  __pyx_t_5numpy_uint8_t __pyx_v_val;
  int __pyx_v_lim;
  int __pyx_v_fill_count;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  __pyx_t_5numpy_uint8_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("backfill_2d_inplace_bool", 0);
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1];

  /* "pandas/src/generated.pyx":1383
 *     cdef Py_ssize_t i, j, N, K
 *     cdef uint8_t val
 *     cdef int lim, fill_count = 0             # <<<<<<<<<<<<<<
 * 
 *     K, N = (<object> values).shape
 */
  __pyx_v_fill_count = 0;

  /* "pandas/src/generated.pyx":1385
 *     cdef int lim, fill_count = 0
 * 
 *     K, N = (<object> values).shape             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_K = __pyx_t_6;
  __pyx_v_N = __pyx_t_7;

  /* "pandas/src/generated.pyx":1387
 *     K, N = (<object> values).shape
 * 
 *     if limit is None:             # <<<<<<<<<<<<<<
 *         lim = N
 *     else:
 */
  __pyx_t_8 = (__pyx_v_limit == Py_None);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":1388
 * 
 *     if limit is None:
 *         lim = N             # <<<<<<<<<<<<<<
 *     else:
 *         if limit < 0:
 */
    __pyx_v_lim = __pyx_v_N;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1390
 *         lim = N
 *     else:
 *         if limit < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_limit, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "pandas/src/generated.pyx":1391
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
      __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_90), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1392
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')
 *         lim = limit             # <<<<<<<<<<<<<<
 * 
 *     for j in range(K):
 */
    __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_limit); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_lim = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pandas/src/generated.pyx":1394
 *         lim = limit
 * 
 *     for j in range(K):             # <<<<<<<<<<<<<<
 *         fill_count = 0
 *         val = values[j, N - 1]
 */
  __pyx_t_7 = __pyx_v_K;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6+=1) {
    __pyx_v_j = __pyx_t_6;

    /* "pandas/src/generated.pyx":1395
 * 
 *     for j in range(K):
 *         fill_count = 0             # <<<<<<<<<<<<<<
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 */
    __pyx_v_fill_count = 0;

    /* "pandas/src/generated.pyx":1396
 *     for j in range(K):
 *         fill_count = 0
 *         val = values[j, N - 1]             # <<<<<<<<<<<<<<
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 */
    __pyx_t_10 = __pyx_v_j;
    __pyx_t_11 = (__pyx_v_N - 1);
    __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_values.diminfo[1].strides));

    /* "pandas/src/generated.pyx":1397
 *         fill_count = 0
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):             # <<<<<<<<<<<<<<
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 */
    for (__pyx_t_12 = (__pyx_v_N - 1); __pyx_t_12 > -1; __pyx_t_12-=1) {
      __pyx_v_i = __pyx_t_12;

      /* "pandas/src/generated.pyx":1398
 *         val = values[j, N - 1]
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:             # <<<<<<<<<<<<<<
 *                 if fill_count >= lim:
 *                     continue
 */
      __pyx_t_13 = __pyx_v_j;
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_15 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_mask.diminfo[1].strides));
      if (__pyx_t_15) {

        /* "pandas/src/generated.pyx":1399
 *         for i in range(N - 1, -1 , -1):
 *             if mask[j, i]:
 *                 if fill_count >= lim:             # <<<<<<<<<<<<<<
 *                     continue
 *                 fill_count += 1
 */
        __pyx_t_8 = (__pyx_v_fill_count >= __pyx_v_lim);
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":1400
 *             if mask[j, i]:
 *                 if fill_count >= lim:
 *                     continue             # <<<<<<<<<<<<<<
 *                 fill_count += 1
 *                 values[j, i] = val
 */
          goto __pyx_L9_continue;
          goto __pyx_L12;
        }
        __pyx_L12:;

        /* "pandas/src/generated.pyx":1401
 *                 if fill_count >= lim:
 *                     continue
 *                 fill_count += 1             # <<<<<<<<<<<<<<
 *                 values[j, i] = val
 *             else:
 */
        __pyx_v_fill_count = (__pyx_v_fill_count + 1);

        /* "pandas/src/generated.pyx":1402
 *                     continue
 *                 fill_count += 1
 *                 values[j, i] = val             # <<<<<<<<<<<<<<
 *             else:
 *                 fill_count = 0
 */
        __pyx_t_16 = __pyx_v_j;
        __pyx_t_17 = __pyx_v_i;
        *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides) = __pyx_v_val;
        goto __pyx_L11;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1404
 *                 values[j, i] = val
 *             else:
 *                 fill_count = 0             # <<<<<<<<<<<<<<
 *                 val = values[j, i]
 * 
 */
        __pyx_v_fill_count = 0;

        /* "pandas/src/generated.pyx":1405
 *             else:
 *                 fill_count = 0
 *                 val = values[j, i]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
        __pyx_t_18 = __pyx_v_j;
        __pyx_t_19 = __pyx_v_i;
        __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_values.diminfo[1].strides));
      }
      __pyx_L11:;
      __pyx_L9_continue:;
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.backfill_2d_inplace_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_205take_1d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_205take_1d_float64 = {__Pyx_NAMESTR("take_1d_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_205take_1d_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_205take_1d_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_1d_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1410
 * def take_1d_float64(ndarray[float64_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_91;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_1d_float64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_1d_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_1d_float64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_1d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_204take_1d_float64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1408
 * 
 * @cython.wraparound(False)
 * def take_1d_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_204take_1d_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __pyx_t_5numpy_float64_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_1d_float64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1416
 *         float64_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1418
 *     n = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1419
 * 
 *     if out is None:
 *         outbuf = np.empty(n, dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1421
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1423
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1424
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1425
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1426
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 raise ValueError('No NA values allowed')
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1427
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_93), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1429
 *                 raise ValueError('No NA values allowed')
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
        __pyx_t_15 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1431
 *                 outbuf[i] = values[idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_v_fill_value); if (unlikely((__pyx_t_17 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_17;

    /* "pandas/src/generated.pyx":1432
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1433
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 outbuf[i] = fv
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1434
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 outbuf[i] = fv
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1435
 *             idx = indexer[i]
 *             if idx == -1:
 *                 outbuf[i] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides) = __pyx_v_fv;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1437
 *                 outbuf[i] = fv
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
        __pyx_t_20 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L10:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_1d_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_207take_1d_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_207take_1d_object = {__Pyx_NAMESTR("take_1d_object"), (PyCFunction)__pyx_pw_6pandas_5algos_207take_1d_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_207take_1d_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_1d_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1442
 * def take_1d_object(ndarray[object] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_94;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_1d_object", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_1d_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_1d_object", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_1d_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_206take_1d_object(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1440
 * 
 * @cython.wraparound(False)
 * def take_1d_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_206take_1d_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  PyObject *__pyx_v_fv = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  PyObject **__pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_1d_object", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1448
 *         object fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1450
 *     n = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1451
 * 
 *     if out is None:
 *         outbuf = np.empty(n, dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1453
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1455
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1456
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1457
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1458
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 raise ValueError('No NA values allowed')
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1459
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_95), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1461
 *                 raise ValueError('No NA values allowed')
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
        __pyx_t_15 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_values.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_17 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_outbuf.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_17);
        __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_17);
        *__pyx_t_17 = __pyx_t_6;
        __Pyx_GIVEREF(*__pyx_t_17);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1463
 *                 outbuf[i] = values[idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __Pyx_INCREF(__pyx_v_fill_value);
    __pyx_v_fv = __pyx_v_fill_value;

    /* "pandas/src/generated.pyx":1464
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1465
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 outbuf[i] = fv
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1466
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 outbuf[i] = fv
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1467
 *             idx = indexer[i]
 *             if idx == -1:
 *                 outbuf[i] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_17 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_17);
        __Pyx_INCREF(__pyx_v_fv); __Pyx_DECREF(*__pyx_t_17);
        *__pyx_t_17 = __pyx_v_fv;
        __Pyx_GIVEREF(*__pyx_t_17);
        goto __pyx_L10;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1469
 *                 outbuf[i] = fv
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
        __pyx_t_20 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_17 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_17);
        __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_17);
        *__pyx_t_17 = __pyx_t_6;
        __Pyx_GIVEREF(*__pyx_t_17);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __pyx_L10:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_1d_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XDECREF(__pyx_v_fv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_209take_1d_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_209take_1d_int32 = {__Pyx_NAMESTR("take_1d_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_209take_1d_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_209take_1d_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_1d_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1474
 * def take_1d_int32(ndarray[int32_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_96;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_1d_int32", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_1d_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_1d_int32", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_1d_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_208take_1d_int32(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1472
 * 
 * @cython.wraparound(False)
 * def take_1d_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_208take_1d_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int32_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __pyx_t_5numpy_int32_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_1d_int32", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1480
 *         int32_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1482
 *     n = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1483
 * 
 *     if out is None:
 *         outbuf = np.empty(n, dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1485
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1487
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1488
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1489
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1490
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 raise ValueError('No NA values allowed')
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1491
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_97), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1493
 *                 raise ValueError('No NA values allowed')
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
        __pyx_t_15 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1495
 *                 outbuf[i] = values[idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_17 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_fill_value); if (unlikely((__pyx_t_17 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_17;

    /* "pandas/src/generated.pyx":1496
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1497
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 outbuf[i] = fv
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1498
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 outbuf[i] = fv
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1499
 *             idx = indexer[i]
 *             if idx == -1:
 *                 outbuf[i] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides) = __pyx_v_fv;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1501
 *                 outbuf[i] = fv
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
        __pyx_t_20 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L10:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_1d_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_211take_1d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_211take_1d_int64 = {__Pyx_NAMESTR("take_1d_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_211take_1d_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_211take_1d_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_1d_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1506
 * def take_1d_int64(ndarray[int64_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_98;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_1d_int64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_1d_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_1d_int64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_1d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_210take_1d_int64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1504
 * 
 * @cython.wraparound(False)
 * def take_1d_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_210take_1d_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __pyx_t_5numpy_int64_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_1d_int64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1512
 *         int64_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1514
 *     n = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1515
 * 
 *     if out is None:
 *         outbuf = np.empty(n, dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1517
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1519
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1520
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1521
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1522
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 raise ValueError('No NA values allowed')
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1523
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_99), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1525
 *                 raise ValueError('No NA values allowed')
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
        __pyx_t_15 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1527
 *                 outbuf[i] = values[idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_17 = __Pyx_PyInt_from_py_npy_int64(__pyx_v_fill_value); if (unlikely((__pyx_t_17 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_17;

    /* "pandas/src/generated.pyx":1528
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1529
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 outbuf[i] = fv
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1530
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 outbuf[i] = fv
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1531
 *             idx = indexer[i]
 *             if idx == -1:
 *                 outbuf[i] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides) = __pyx_v_fv;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1533
 *                 outbuf[i] = fv
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
        __pyx_t_20 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L10:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_1d_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_213take_1d_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_213take_1d_bool = {__Pyx_NAMESTR("take_1d_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_213take_1d_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_213take_1d_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_1d_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1538
 * def take_1d_bool(ndarray[uint8_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_100;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_1d_bool", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_1d_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_1d_bool", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_1d_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_212take_1d_bool(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1536
 * 
 * @cython.wraparound(False)
 * def take_1d_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_212take_1d_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  __pyx_t_5numpy_uint8_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_1d_bool", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1544
 *         uint8_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1546
 *     n = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1547
 * 
 *     if out is None:
 *         outbuf = np.empty(n, dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1549
 *         outbuf = np.empty(n, dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1551
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1552
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1553
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_14 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1554
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 raise ValueError('No NA values allowed')
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1555
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_101), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_Raise(__pyx_t_6, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1557
 *                 raise ValueError('No NA values allowed')
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
        __pyx_t_15 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_15 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1559
 *                 outbuf[i] = values[idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_17 = __Pyx_PyInt_from_py_npy_uint8(__pyx_v_fill_value); if (unlikely((__pyx_t_17 == (npy_uint8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_17;

    /* "pandas/src/generated.pyx":1560
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1561
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 outbuf[i] = fv
 */
      __pyx_t_18 = __pyx_v_i;
      __pyx_t_8 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_8 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_indexer.diminfo[0].shape)) __pyx_t_8 = 0;
      if (unlikely(__pyx_t_8 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_8);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1562
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 outbuf[i] = fv
 *             else:
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1563
 *             idx = indexer[i]
 *             if idx == -1:
 *                 outbuf[i] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
        __pyx_t_19 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_19 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides) = __pyx_v_fv;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1565
 *                 outbuf[i] = fv
 *             else:
 *                 outbuf[i] = values[idx]             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_20 = __pyx_v_idx;
        __pyx_t_8 = -1;
        if (__pyx_t_20 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_values.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_21 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_21 < 0) {
          __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_outbuf.diminfo[0].shape)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_values.diminfo[0].strides));
      }
      __pyx_L10:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_1d_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_215is_monotonic_float64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_214is_monotonic_float64[] = "\n    Returns\n    -------\n    is_monotonic, is_unique\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_215is_monotonic_float64 = {__Pyx_NAMESTR("is_monotonic_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_215is_monotonic_float64, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_214is_monotonic_float64)};
static PyObject *__pyx_pw_6pandas_5algos_215is_monotonic_float64(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_monotonic_float64 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_214is_monotonic_float64(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1570
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_float64(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */

static PyObject *__pyx_pf_6pandas_5algos_214is_monotonic_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_float64_t __pyx_v_prev;
  __pyx_t_5numpy_float64_t __pyx_v_cur;
  int __pyx_v_is_unique;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_monotonic_float64", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1579
 *         Py_ssize_t i, n
 *         float64_t prev, cur
 *         bint is_unique = 1             # <<<<<<<<<<<<<<
 * 
 *     n = len(arr)
 */
  __pyx_v_is_unique = 1;

  /* "pandas/src/generated.pyx":1581
 *         bint is_unique = 1
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if n < 2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1583
 *     n = len(arr)
 * 
 *     if n < 2:             # <<<<<<<<<<<<<<
 *         return True, True
 * 
 */
  __pyx_t_2 = (__pyx_v_n < 2);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1584
 * 
 *     if n < 2:
 *         return True, True             # <<<<<<<<<<<<<<
 * 
 *     prev = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1586
 *         return True, True
 * 
 *     prev = arr[0]             # <<<<<<<<<<<<<<
 *     for i in range(1, n):
 *         cur = arr[i]
 */
  __pyx_t_6 = 0;
  __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1587
 * 
 *     prev = arr[0]
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         cur = arr[i]
 *         if cur < prev:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/src/generated.pyx":1588
 *     prev = arr[0]
 *     for i in range(1, n):
 *         cur = arr[i]             # <<<<<<<<<<<<<<
 *         if cur < prev:
 *             return False, None
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_arr.diminfo[0].strides));

    /* "pandas/src/generated.pyx":1589
 *     for i in range(1, n):
 *         cur = arr[i]
 *         if cur < prev:             # <<<<<<<<<<<<<<
 *             return False, None
 *         elif cur == prev:
 */
    __pyx_t_2 = (__pyx_v_cur < __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1590
 *         cur = arr[i]
 *         if cur < prev:
 *             return False, None             # <<<<<<<<<<<<<<
 *         elif cur == prev:
 *             is_unique = 0
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }

    /* "pandas/src/generated.pyx":1591
 *         if cur < prev:
 *             return False, None
 *         elif cur == prev:             # <<<<<<<<<<<<<<
 *             is_unique = 0
 *         prev = cur
 */
    __pyx_t_2 = (__pyx_v_cur == __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1592
 *             return False, None
 *         elif cur == prev:
 *             is_unique = 0             # <<<<<<<<<<<<<<
 *         prev = cur
 *     return True, is_unique
 */
      __pyx_v_is_unique = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1593
 *         elif cur == prev:
 *             is_unique = 0
 *         prev = cur             # <<<<<<<<<<<<<<
 *     return True, is_unique
 * @cython.boundscheck(False)
 */
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/generated.pyx":1594
 *             is_unique = 0
 *         prev = cur
 *     return True, is_unique             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_unique); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.is_monotonic_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_217is_monotonic_object(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_216is_monotonic_object[] = "\n    Returns\n    -------\n    is_monotonic, is_unique\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_217is_monotonic_object = {__Pyx_NAMESTR("is_monotonic_object"), (PyCFunction)__pyx_pw_6pandas_5algos_217is_monotonic_object, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_216is_monotonic_object)};
static PyObject *__pyx_pw_6pandas_5algos_217is_monotonic_object(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_monotonic_object (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_216is_monotonic_object(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1597
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_object(ndarray[object] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */

static PyObject *__pyx_pf_6pandas_5algos_216is_monotonic_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_prev = 0;
  PyObject *__pyx_v_cur = 0;
  int __pyx_v_is_unique;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_monotonic_object", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1606
 *         Py_ssize_t i, n
 *         object prev, cur
 *         bint is_unique = 1             # <<<<<<<<<<<<<<
 * 
 *     n = len(arr)
 */
  __pyx_v_is_unique = 1;

  /* "pandas/src/generated.pyx":1608
 *         bint is_unique = 1
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if n < 2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1610
 *     n = len(arr)
 * 
 *     if n < 2:             # <<<<<<<<<<<<<<
 *         return True, True
 * 
 */
  __pyx_t_2 = (__pyx_v_n < 2);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1611
 * 
 *     if n < 2:
 *         return True, True             # <<<<<<<<<<<<<<
 * 
 *     prev = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1613
 *         return True, True
 * 
 *     prev = arr[0]             # <<<<<<<<<<<<<<
 *     for i in range(1, n):
 *         cur = arr[i]
 */
  __pyx_t_6 = 0;
  __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides);
  __Pyx_INCREF((PyObject*)__pyx_t_5);
  __pyx_v_prev = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1614
 * 
 *     prev = arr[0]
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         cur = arr[i]
 *         if cur < prev:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/src/generated.pyx":1615
 *     prev = arr[0]
 *     for i in range(1, n):
 *         cur = arr[i]             # <<<<<<<<<<<<<<
 *         if cur < prev:
 *             return False, None
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_arr.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_5);
    __Pyx_XDECREF(__pyx_v_cur);
    __pyx_v_cur = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pandas/src/generated.pyx":1616
 *     for i in range(1, n):
 *         cur = arr[i]
 *         if cur < prev:             # <<<<<<<<<<<<<<
 *             return False, None
 *         elif cur == prev:
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_cur, __pyx_v_prev, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1617
 *         cur = arr[i]
 *         if cur < prev:
 *             return False, None             # <<<<<<<<<<<<<<
 *         elif cur == prev:
 *             is_unique = 0
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }

    /* "pandas/src/generated.pyx":1618
 *         if cur < prev:
 *             return False, None
 *         elif cur == prev:             # <<<<<<<<<<<<<<
 *             is_unique = 0
 *         prev = cur
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_cur, __pyx_v_prev, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1619
 *             return False, None
 *         elif cur == prev:
 *             is_unique = 0             # <<<<<<<<<<<<<<
 *         prev = cur
 *     return True, is_unique
 */
      __pyx_v_is_unique = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1620
 *         elif cur == prev:
 *             is_unique = 0
 *         prev = cur             # <<<<<<<<<<<<<<
 *     return True, is_unique
 * @cython.boundscheck(False)
 */
    __Pyx_INCREF(__pyx_v_cur);
    __Pyx_DECREF(__pyx_v_prev);
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/generated.pyx":1621
 *             is_unique = 0
 *         prev = cur
 *     return True, is_unique             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_unique); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.is_monotonic_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_prev);
  __Pyx_XDECREF(__pyx_v_cur);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_219is_monotonic_int32(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_218is_monotonic_int32[] = "\n    Returns\n    -------\n    is_monotonic, is_unique\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_219is_monotonic_int32 = {__Pyx_NAMESTR("is_monotonic_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_219is_monotonic_int32, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_218is_monotonic_int32)};
static PyObject *__pyx_pw_6pandas_5algos_219is_monotonic_int32(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_monotonic_int32 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_218is_monotonic_int32(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1624
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int32(ndarray[int32_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */

static PyObject *__pyx_pf_6pandas_5algos_218is_monotonic_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_int32_t __pyx_v_prev;
  __pyx_t_5numpy_int32_t __pyx_v_cur;
  int __pyx_v_is_unique;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_monotonic_int32", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1633
 *         Py_ssize_t i, n
 *         int32_t prev, cur
 *         bint is_unique = 1             # <<<<<<<<<<<<<<
 * 
 *     n = len(arr)
 */
  __pyx_v_is_unique = 1;

  /* "pandas/src/generated.pyx":1635
 *         bint is_unique = 1
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if n < 2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1637
 *     n = len(arr)
 * 
 *     if n < 2:             # <<<<<<<<<<<<<<
 *         return True, True
 * 
 */
  __pyx_t_2 = (__pyx_v_n < 2);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1638
 * 
 *     if n < 2:
 *         return True, True             # <<<<<<<<<<<<<<
 * 
 *     prev = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1640
 *         return True, True
 * 
 *     prev = arr[0]             # <<<<<<<<<<<<<<
 *     for i in range(1, n):
 *         cur = arr[i]
 */
  __pyx_t_6 = 0;
  __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1641
 * 
 *     prev = arr[0]
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         cur = arr[i]
 *         if cur < prev:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/src/generated.pyx":1642
 *     prev = arr[0]
 *     for i in range(1, n):
 *         cur = arr[i]             # <<<<<<<<<<<<<<
 *         if cur < prev:
 *             return False, None
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_arr.diminfo[0].strides));

    /* "pandas/src/generated.pyx":1643
 *     for i in range(1, n):
 *         cur = arr[i]
 *         if cur < prev:             # <<<<<<<<<<<<<<
 *             return False, None
 *         elif cur == prev:
 */
    __pyx_t_2 = (__pyx_v_cur < __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1644
 *         cur = arr[i]
 *         if cur < prev:
 *             return False, None             # <<<<<<<<<<<<<<
 *         elif cur == prev:
 *             is_unique = 0
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }

    /* "pandas/src/generated.pyx":1645
 *         if cur < prev:
 *             return False, None
 *         elif cur == prev:             # <<<<<<<<<<<<<<
 *             is_unique = 0
 *         prev = cur
 */
    __pyx_t_2 = (__pyx_v_cur == __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1646
 *             return False, None
 *         elif cur == prev:
 *             is_unique = 0             # <<<<<<<<<<<<<<
 *         prev = cur
 *     return True, is_unique
 */
      __pyx_v_is_unique = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1647
 *         elif cur == prev:
 *             is_unique = 0
 *         prev = cur             # <<<<<<<<<<<<<<
 *     return True, is_unique
 * @cython.boundscheck(False)
 */
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/generated.pyx":1648
 *             is_unique = 0
 *         prev = cur
 *     return True, is_unique             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_unique); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.is_monotonic_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_221is_monotonic_int64(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_220is_monotonic_int64[] = "\n    Returns\n    -------\n    is_monotonic, is_unique\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_221is_monotonic_int64 = {__Pyx_NAMESTR("is_monotonic_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_221is_monotonic_int64, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_220is_monotonic_int64)};
static PyObject *__pyx_pw_6pandas_5algos_221is_monotonic_int64(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_monotonic_int64 (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_220is_monotonic_int64(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1651
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int64(ndarray[int64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */

static PyObject *__pyx_pf_6pandas_5algos_220is_monotonic_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_int64_t __pyx_v_prev;
  __pyx_t_5numpy_int64_t __pyx_v_cur;
  int __pyx_v_is_unique;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_monotonic_int64", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1660
 *         Py_ssize_t i, n
 *         int64_t prev, cur
 *         bint is_unique = 1             # <<<<<<<<<<<<<<
 * 
 *     n = len(arr)
 */
  __pyx_v_is_unique = 1;

  /* "pandas/src/generated.pyx":1662
 *         bint is_unique = 1
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if n < 2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1664
 *     n = len(arr)
 * 
 *     if n < 2:             # <<<<<<<<<<<<<<
 *         return True, True
 * 
 */
  __pyx_t_2 = (__pyx_v_n < 2);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1665
 * 
 *     if n < 2:
 *         return True, True             # <<<<<<<<<<<<<<
 * 
 *     prev = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1667
 *         return True, True
 * 
 *     prev = arr[0]             # <<<<<<<<<<<<<<
 *     for i in range(1, n):
 *         cur = arr[i]
 */
  __pyx_t_6 = 0;
  __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1668
 * 
 *     prev = arr[0]
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         cur = arr[i]
 *         if cur < prev:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/src/generated.pyx":1669
 *     prev = arr[0]
 *     for i in range(1, n):
 *         cur = arr[i]             # <<<<<<<<<<<<<<
 *         if cur < prev:
 *             return False, None
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_arr.diminfo[0].strides));

    /* "pandas/src/generated.pyx":1670
 *     for i in range(1, n):
 *         cur = arr[i]
 *         if cur < prev:             # <<<<<<<<<<<<<<
 *             return False, None
 *         elif cur == prev:
 */
    __pyx_t_2 = (__pyx_v_cur < __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1671
 *         cur = arr[i]
 *         if cur < prev:
 *             return False, None             # <<<<<<<<<<<<<<
 *         elif cur == prev:
 *             is_unique = 0
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }

    /* "pandas/src/generated.pyx":1672
 *         if cur < prev:
 *             return False, None
 *         elif cur == prev:             # <<<<<<<<<<<<<<
 *             is_unique = 0
 *         prev = cur
 */
    __pyx_t_2 = (__pyx_v_cur == __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1673
 *             return False, None
 *         elif cur == prev:
 *             is_unique = 0             # <<<<<<<<<<<<<<
 *         prev = cur
 *     return True, is_unique
 */
      __pyx_v_is_unique = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1674
 *         elif cur == prev:
 *             is_unique = 0
 *         prev = cur             # <<<<<<<<<<<<<<
 *     return True, is_unique
 * @cython.boundscheck(False)
 */
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/generated.pyx":1675
 *             is_unique = 0
 *         prev = cur
 *     return True, is_unique             # <<<<<<<<<<<<<<
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_unique); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.is_monotonic_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_223is_monotonic_bool(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
static char __pyx_doc_6pandas_5algos_222is_monotonic_bool[] = "\n    Returns\n    -------\n    is_monotonic, is_unique\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_223is_monotonic_bool = {__Pyx_NAMESTR("is_monotonic_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_223is_monotonic_bool, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_222is_monotonic_bool)};
static PyObject *__pyx_pw_6pandas_5algos_223is_monotonic_bool(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_monotonic_bool (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_222is_monotonic_bool(__pyx_self, ((PyArrayObject *)__pyx_v_arr));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1678
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_bool(ndarray[uint8_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */

static PyObject *__pyx_pf_6pandas_5algos_222is_monotonic_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_arr) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  __pyx_t_5numpy_uint8_t __pyx_v_prev;
  __pyx_t_5numpy_uint8_t __pyx_v_cur;
  int __pyx_v_is_unique;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_arr;
  __Pyx_Buffer __pyx_pybuffer_arr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_monotonic_bool", 0);
  __pyx_pybuffer_arr.pybuffer.buf = NULL;
  __pyx_pybuffer_arr.refcount = 0;
  __pyx_pybuffernd_arr.data = NULL;
  __pyx_pybuffernd_arr.rcbuffer = &__pyx_pybuffer_arr;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_arr.rcbuffer->pybuffer, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_arr.diminfo[0].strides = __pyx_pybuffernd_arr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_arr.diminfo[0].shape = __pyx_pybuffernd_arr.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1687
 *         Py_ssize_t i, n
 *         uint8_t prev, cur
 *         bint is_unique = 1             # <<<<<<<<<<<<<<
 * 
 *     n = len(arr)
 */
  __pyx_v_is_unique = 1;

  /* "pandas/src/generated.pyx":1689
 *         bint is_unique = 1
 * 
 *     n = len(arr)             # <<<<<<<<<<<<<<
 * 
 *     if n < 2:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1691
 *     n = len(arr)
 * 
 *     if n < 2:             # <<<<<<<<<<<<<<
 *         return True, True
 * 
 */
  __pyx_t_2 = (__pyx_v_n < 2);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1692
 * 
 *     if n < 2:
 *         return True, True             # <<<<<<<<<<<<<<
 * 
 *     prev = arr[0]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = ((PyObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1694
 *         return True, True
 * 
 *     prev = arr[0]             # <<<<<<<<<<<<<<
 *     for i in range(1, n):
 *         cur = arr[i]
 */
  __pyx_t_6 = 0;
  __pyx_v_prev = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_arr.diminfo[0].strides));

  /* "pandas/src/generated.pyx":1695
 * 
 *     prev = arr[0]
 *     for i in range(1, n):             # <<<<<<<<<<<<<<
 *         cur = arr[i]
 *         if cur < prev:
 */
  __pyx_t_1 = __pyx_v_n;
  for (__pyx_t_7 = 1; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
    __pyx_v_i = __pyx_t_7;

    /* "pandas/src/generated.pyx":1696
 *     prev = arr[0]
 *     for i in range(1, n):
 *         cur = arr[i]             # <<<<<<<<<<<<<<
 *         if cur < prev:
 *             return False, None
 */
    __pyx_t_8 = __pyx_v_i;
    __pyx_v_cur = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_arr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_arr.diminfo[0].strides));

    /* "pandas/src/generated.pyx":1697
 *     for i in range(1, n):
 *         cur = arr[i]
 *         if cur < prev:             # <<<<<<<<<<<<<<
 *             return False, None
 *         elif cur == prev:
 */
    __pyx_t_2 = (__pyx_v_cur < __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1698
 *         cur = arr[i]
 *         if cur < prev:
 *             return False, None             # <<<<<<<<<<<<<<
 *         elif cur == prev:
 *             is_unique = 0
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1698; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None);
      __Pyx_GIVEREF(Py_None);
      __pyx_t_5 = 0;
      __pyx_r = ((PyObject *)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;
      goto __pyx_L6;
    }

    /* "pandas/src/generated.pyx":1699
 *         if cur < prev:
 *             return False, None
 *         elif cur == prev:             # <<<<<<<<<<<<<<
 *             is_unique = 0
 *         prev = cur
 */
    __pyx_t_2 = (__pyx_v_cur == __pyx_v_prev);
    if (__pyx_t_2) {

      /* "pandas/src/generated.pyx":1700
 *             return False, None
 *         elif cur == prev:
 *             is_unique = 0             # <<<<<<<<<<<<<<
 *         prev = cur
 *     return True, is_unique
 */
      __pyx_v_is_unique = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":1701
 *         elif cur == prev:
 *             is_unique = 0
 *         prev = cur             # <<<<<<<<<<<<<<
 *     return True, is_unique
 * 
 */
    __pyx_v_prev = __pyx_v_cur;
  }

  /* "pandas/src/generated.pyx":1702
 *             is_unique = 0
 *         prev = cur
 *     return True, is_unique             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_is_unique); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.is_monotonic_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_225groupby_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_225groupby_float64 = {__Pyx_NAMESTR("groupby_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_225groupby_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_225groupby_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupby_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupby_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupby_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_224groupby_float64(__pyx_self, __pyx_v_index, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1706
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_float64(ndarray[float64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */

static PyObject *__pyx_pf_6pandas_5algos_224groupby_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_members = 0;
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_key = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_float64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1707
 * @cython.boundscheck(False)
 * def groupby_float64(ndarray[float64_t] index, ndarray labels):
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, length
 *     cdef list members
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1712
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":1714
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         key = util.get_value_1d(labels, i)
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":1715
 * 
 *     for i in range(length):
 *         key = util.get_value_1d(labels, i)             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(key):
 */
    __pyx_t_1 = get_value_1d(__pyx_v_labels, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1717
 *         key = util.get_value_1d(labels, i)
 * 
 *         if _checknull(key):             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_4 = __pyx_f_4util__checknull(__pyx_v_key);
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1718
 * 
 *         if _checknull(key):
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         idx = index[i]
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":1720
 *             continue
 * 
 *         idx = index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1721
 * 
 *         idx = index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_key, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1722
 *         idx = index[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pandas/src/generated.pyx":1723
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(((PyObject *)__pyx_v_members) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1725
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/generated.pyx":1727
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_227groupby_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_227groupby_object = {__Pyx_NAMESTR("groupby_object"), (PyCFunction)__pyx_pw_6pandas_5algos_227groupby_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_227groupby_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupby_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupby_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupby_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_226groupby_object(__pyx_self, __pyx_v_index, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_object(ndarray[object] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */

static PyObject *__pyx_pf_6pandas_5algos_226groupby_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_members = 0;
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_key = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_object", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1732
 * @cython.boundscheck(False)
 * def groupby_object(ndarray[object] index, ndarray labels):
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, length
 *     cdef list members
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1737
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":1739
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         key = util.get_value_1d(labels, i)
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":1740
 * 
 *     for i in range(length):
 *         key = util.get_value_1d(labels, i)             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(key):
 */
    __pyx_t_1 = get_value_1d(__pyx_v_labels, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1742
 *         key = util.get_value_1d(labels, i)
 * 
 *         if _checknull(key):             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_4 = __pyx_f_4util__checknull(__pyx_v_key);
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1743
 * 
 *         if _checknull(key):
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         idx = index[i]
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":1745
 *             continue
 * 
 *         idx = index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1746
 * 
 *         idx = index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_key, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1747
 *         idx = index[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pandas/src/generated.pyx":1748
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(((PyObject *)__pyx_v_members) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1750
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/generated.pyx":1752
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_229groupby_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_229groupby_int32 = {__Pyx_NAMESTR("groupby_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_229groupby_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_229groupby_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupby_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupby_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupby_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_228groupby_int32(__pyx_self, __pyx_v_index, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1756
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int32(ndarray[int32_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */

static PyObject *__pyx_pf_6pandas_5algos_228groupby_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_members = 0;
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_key = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_int32", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1757
 * @cython.boundscheck(False)
 * def groupby_int32(ndarray[int32_t] index, ndarray labels):
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, length
 *     cdef list members
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1762
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":1764
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         key = util.get_value_1d(labels, i)
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":1765
 * 
 *     for i in range(length):
 *         key = util.get_value_1d(labels, i)             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(key):
 */
    __pyx_t_1 = get_value_1d(__pyx_v_labels, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1767
 *         key = util.get_value_1d(labels, i)
 * 
 *         if _checknull(key):             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_4 = __pyx_f_4util__checknull(__pyx_v_key);
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1768
 * 
 *         if _checknull(key):
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         idx = index[i]
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":1770
 *             continue
 * 
 *         idx = index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1771
 * 
 *         idx = index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_key, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1772
 *         idx = index[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pandas/src/generated.pyx":1773
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(((PyObject *)__pyx_v_members) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1775
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/generated.pyx":1777
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_231groupby_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_231groupby_int64 = {__Pyx_NAMESTR("groupby_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_231groupby_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_231groupby_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupby_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupby_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupby_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_230groupby_int64(__pyx_self, __pyx_v_index, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1781
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int64(ndarray[int64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */

static PyObject *__pyx_pf_6pandas_5algos_230groupby_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_members = 0;
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_key = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_int64", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1782
 * @cython.boundscheck(False)
 * def groupby_int64(ndarray[int64_t] index, ndarray labels):
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, length
 *     cdef list members
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1787
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":1789
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         key = util.get_value_1d(labels, i)
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":1790
 * 
 *     for i in range(length):
 *         key = util.get_value_1d(labels, i)             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(key):
 */
    __pyx_t_1 = get_value_1d(__pyx_v_labels, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1792
 *         key = util.get_value_1d(labels, i)
 * 
 *         if _checknull(key):             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_4 = __pyx_f_4util__checknull(__pyx_v_key);
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1793
 * 
 *         if _checknull(key):
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         idx = index[i]
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":1795
 *             continue
 * 
 *         idx = index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1796
 * 
 *         idx = index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_key, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1797
 *         idx = index[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pandas/src/generated.pyx":1798
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(((PyObject *)__pyx_v_members) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1800
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/generated.pyx":1802
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_233groupby_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_233groupby_bool = {__Pyx_NAMESTR("groupby_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_233groupby_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_233groupby_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyArrayObject *__pyx_v_labels = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("groupby_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__labels,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("groupby_bool", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "groupby_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_labels = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("groupby_bool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.groupby_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_232groupby_bool(__pyx_self, __pyx_v_index, __pyx_v_labels);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1806
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_bool(ndarray[uint8_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */

static PyObject *__pyx_pf_6pandas_5algos_232groupby_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyArrayObject *__pyx_v_labels) {
  PyObject *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_v_members = 0;
  PyObject *__pyx_v_idx = 0;
  PyObject *__pyx_v_key = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("groupby_bool", 0);
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1807
 * @cython.boundscheck(False)
 * def groupby_bool(ndarray[uint8_t] index, ndarray labels):
 *     cdef dict result = {}             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, length
 *     cdef list members
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1812
 *     cdef object idx, key
 * 
 *     length = len(index)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_index)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_2;

  /* "pandas/src/generated.pyx":1814
 *     length = len(index)
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         key = util.get_value_1d(labels, i)
 * 
 */
  __pyx_t_2 = __pyx_v_length;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pandas/src/generated.pyx":1815
 * 
 *     for i in range(length):
 *         key = util.get_value_1d(labels, i)             # <<<<<<<<<<<<<<
 * 
 *         if _checknull(key):
 */
    __pyx_t_1 = get_value_1d(__pyx_v_labels, __pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_key);
    __pyx_v_key = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1817
 *         key = util.get_value_1d(labels, i)
 * 
 *         if _checknull(key):             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_4 = __pyx_f_4util__checknull(__pyx_v_key);
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1818
 * 
 *         if _checknull(key):
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         idx = index[i]
 */
      goto __pyx_L3_continue;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":1820
 *             continue
 * 
 *         idx = index[i]             # <<<<<<<<<<<<<<
 *         if key in result:
 *             members = result[key]
 */
    __pyx_t_5 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint8((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_idx);
    __pyx_v_idx = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pandas/src/generated.pyx":1821
 * 
 *         idx = index[i]
 *         if key in result:             # <<<<<<<<<<<<<<
 *             members = result[key]
 *             members.append(idx)
 */
    __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_v_key, ((PyObject *)__pyx_v_result), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_4) {

      /* "pandas/src/generated.pyx":1822
 *         idx = index[i]
 *         if key in result:
 *             members = result[key]             # <<<<<<<<<<<<<<
 *             members.append(idx)
 *         else:
 */
      __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_result), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_members));
      __pyx_v_members = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "pandas/src/generated.pyx":1823
 *         if key in result:
 *             members = result[key]
 *             members.append(idx)             # <<<<<<<<<<<<<<
 *         else:
 *             result[key] = [idx]
 */
      if (unlikely(((PyObject *)__pyx_v_members) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append");
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = PyList_Append(__pyx_v_members, __pyx_v_idx); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":1825
 *             members.append(idx)
 *         else:
 *             result[key] = [idx]             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_idx);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_idx);
      __Pyx_GIVEREF(__pyx_v_idx);
      if (PyDict_SetItem(((PyObject *)__pyx_v_result), __pyx_v_key, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    }
    __pyx_L6:;
    __pyx_L3_continue:;
  }

  /* "pandas/src/generated.pyx":1827
 *             result[key] = [idx]
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.groupby_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_members);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_235arrmap_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_235arrmap_float64 = {__Pyx_NAMESTR("arrmap_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_235arrmap_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_235arrmap_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arrmap_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arrmap_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.arrmap_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_234arrmap_float64(__pyx_self, __pyx_v_index, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1832
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_float64(ndarray[float64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_234arrmap_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
  Py_ssize_t __pyx_v_length;
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  PyObject *__pyx_v_maybe_convert_objects = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject **__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arrmap_float64", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1833
 * @cython.boundscheck(False)
 * def arrmap_float64(ndarray[float64_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "pandas/src/generated.pyx":1834
 * def arrmap_float64(ndarray[float64_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":1836
 *     cdef Py_ssize_t i = 0
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     from pandas.lib import maybe_convert_objects
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1838
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 * 
 *     from pandas.lib import maybe_convert_objects             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_102), ((PyObject *)__pyx_t_5), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_103);
  if (__pyx_t_5 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_103);
    if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_maybe_convert_objects = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1840
 *     from pandas.lib import maybe_convert_objects
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[i] = func(index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pandas/src/generated.pyx":1841
 * 
 *     for i in range(length):
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 * 
 *     return maybe_convert_objects(result)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_1 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides);
    __Pyx_GOTREF(*__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(*__pyx_t_11);
    *__pyx_t_11 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":1843
 *         result[i] = func(index[i])
 * 
 *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __pyx_t_5 = PyObject_Call(__pyx_v_maybe_convert_objects, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.arrmap_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_maybe_convert_objects);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_237arrmap_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_237arrmap_object = {__Pyx_NAMESTR("arrmap_object"), (PyCFunction)__pyx_pw_6pandas_5algos_237arrmap_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_237arrmap_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arrmap_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arrmap_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.arrmap_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_236arrmap_object(__pyx_self, __pyx_v_index, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1847
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_object(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_236arrmap_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
  Py_ssize_t __pyx_v_length;
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  PyObject *__pyx_v_maybe_convert_objects = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject **__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arrmap_object", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1848
 * @cython.boundscheck(False)
 * def arrmap_object(ndarray[object] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "pandas/src/generated.pyx":1849
 * def arrmap_object(ndarray[object] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":1851
 *     cdef Py_ssize_t i = 0
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     from pandas.lib import maybe_convert_objects
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1853
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 * 
 *     from pandas.lib import maybe_convert_objects             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_102), ((PyObject *)__pyx_t_5), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_103);
  if (__pyx_t_5 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_103);
    if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_maybe_convert_objects = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1855
 *     from pandas.lib import maybe_convert_objects
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[i] = func(index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pandas/src/generated.pyx":1856
 * 
 *     for i in range(length):
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 * 
 *     return maybe_convert_objects(result)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_index.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides);
    __Pyx_GOTREF(*__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(*__pyx_t_11);
    *__pyx_t_11 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":1858
 *         result[i] = func(index[i])
 * 
 *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __pyx_t_5 = PyObject_Call(__pyx_v_maybe_convert_objects, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.arrmap_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_maybe_convert_objects);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_239arrmap_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_239arrmap_int32 = {__Pyx_NAMESTR("arrmap_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_239arrmap_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_239arrmap_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arrmap_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arrmap_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.arrmap_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_238arrmap_int32(__pyx_self, __pyx_v_index, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1862
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int32(ndarray[int32_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_238arrmap_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
  Py_ssize_t __pyx_v_length;
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  PyObject *__pyx_v_maybe_convert_objects = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject **__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arrmap_int32", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1863
 * @cython.boundscheck(False)
 * def arrmap_int32(ndarray[int32_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "pandas/src/generated.pyx":1864
 * def arrmap_int32(ndarray[int32_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":1866
 *     cdef Py_ssize_t i = 0
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     from pandas.lib import maybe_convert_objects
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1868
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 * 
 *     from pandas.lib import maybe_convert_objects             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_102), ((PyObject *)__pyx_t_5), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_103);
  if (__pyx_t_5 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_103);
    if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_maybe_convert_objects = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1870
 *     from pandas.lib import maybe_convert_objects
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[i] = func(index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pandas/src/generated.pyx":1871
 * 
 *     for i in range(length):
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 * 
 *     return maybe_convert_objects(result)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides);
    __Pyx_GOTREF(*__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(*__pyx_t_11);
    *__pyx_t_11 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":1873
 *         result[i] = func(index[i])
 * 
 *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __pyx_t_5 = PyObject_Call(__pyx_v_maybe_convert_objects, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.arrmap_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_maybe_convert_objects);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_241arrmap_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_241arrmap_int64 = {__Pyx_NAMESTR("arrmap_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_241arrmap_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_241arrmap_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arrmap_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arrmap_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.arrmap_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_240arrmap_int64(__pyx_self, __pyx_v_index, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1877
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int64(ndarray[int64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_240arrmap_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
  Py_ssize_t __pyx_v_length;
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  PyObject *__pyx_v_maybe_convert_objects = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject **__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arrmap_int64", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1878
 * @cython.boundscheck(False)
 * def arrmap_int64(ndarray[int64_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "pandas/src/generated.pyx":1879
 * def arrmap_int64(ndarray[int64_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":1881
 *     cdef Py_ssize_t i = 0
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     from pandas.lib import maybe_convert_objects
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1883
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 * 
 *     from pandas.lib import maybe_convert_objects             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_102), ((PyObject *)__pyx_t_5), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_103);
  if (__pyx_t_5 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_103);
    if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_maybe_convert_objects = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1885
 *     from pandas.lib import maybe_convert_objects
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[i] = func(index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pandas/src/generated.pyx":1886
 * 
 *     for i in range(length):
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 * 
 *     return maybe_convert_objects(result)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_int64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides);
    __Pyx_GOTREF(*__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(*__pyx_t_11);
    *__pyx_t_11 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":1888
 *         result[i] = func(index[i])
 * 
 *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __pyx_t_5 = PyObject_Call(__pyx_v_maybe_convert_objects, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1888; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.arrmap_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_maybe_convert_objects);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_243arrmap_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_243arrmap_bool = {__Pyx_NAMESTR("arrmap_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_243arrmap_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_243arrmap_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_index = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arrmap_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__index,&__pyx_n_s__func,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arrmap_bool", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arrmap_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_index = ((PyArrayObject *)values[0]);
    __pyx_v_func = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arrmap_bool", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.arrmap_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_index), __pyx_ptype_5numpy_ndarray, 1, "index", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_242arrmap_bool(__pyx_self, __pyx_v_index, __pyx_v_func);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1892
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_bool(ndarray[uint8_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */

static PyObject *__pyx_pf_6pandas_5algos_242arrmap_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_index, PyObject *__pyx_v_func) {
  Py_ssize_t __pyx_v_length;
  Py_ssize_t __pyx_v_i;
  PyArrayObject *__pyx_v_result = 0;
  PyObject *__pyx_v_maybe_convert_objects = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
  __Pyx_Buffer __pyx_pybuffer_index;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject **__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arrmap_bool", 0);
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_index.pybuffer.buf = NULL;
  __pyx_pybuffer_index.refcount = 0;
  __pyx_pybuffernd_index.data = NULL;
  __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1893
 * @cython.boundscheck(False)
 * def arrmap_bool(ndarray[uint8_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i = 0
 * 
 */
  __pyx_v_length = (__pyx_v_index->dimensions[0]);

  /* "pandas/src/generated.pyx":1894
 * def arrmap_bool(ndarray[uint8_t] index, object func):
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":1896
 *     cdef Py_ssize_t i = 0
 * 
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)             # <<<<<<<<<<<<<<
 * 
 *     from pandas.lib import maybe_convert_objects
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__object_); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_result.rcbuffer->pybuffer.buf = NULL;
      {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else {__pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pandas/src/generated.pyx":1898
 *     cdef ndarray[object] result = np.empty(length, dtype=np.object_)
 * 
 *     from pandas.lib import maybe_convert_objects             # <<<<<<<<<<<<<<
 * 
 *     for i in range(length):
 */
  __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_102), ((PyObject *)__pyx_t_5), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_103);
  if (__pyx_t_5 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_103);
    if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_v_maybe_convert_objects = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1900
 *     from pandas.lib import maybe_convert_objects
 * 
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         result[i] = func(index[i])
 * 
 */
  __pyx_t_7 = __pyx_v_length;
  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
    __pyx_v_i = __pyx_t_8;

    /* "pandas/src/generated.pyx":1901
 * 
 *     for i in range(length):
 *         result[i] = func(index[i])             # <<<<<<<<<<<<<<
 * 
 *     return maybe_convert_objects(result)
 */
    __pyx_t_9 = __pyx_v_i;
    __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint8((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_index.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_index.diminfo[0].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_func, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __pyx_t_10 = __pyx_v_i;
    __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_result.diminfo[0].strides);
    __Pyx_GOTREF(*__pyx_t_11);
    __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(*__pyx_t_11);
    *__pyx_t_11 = __pyx_t_1;
    __Pyx_GIVEREF(*__pyx_t_11);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "pandas/src/generated.pyx":1903
 *         result[i] = func(index[i])
 * 
 *     return maybe_convert_objects(result)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __pyx_t_5 = PyObject_Call(__pyx_v_maybe_convert_objects, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.arrmap_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_maybe_convert_objects);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_245take_2d_axis0_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_245take_2d_axis0_float64 = {__Pyx_NAMESTR("take_2d_axis0_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_245take_2d_axis0_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_245take_2d_axis0_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis0_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1910
 * def take_2d_axis0_float64(ndarray[float64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_104;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis0_float64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis0_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis0_float64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_244take_2d_axis0_float64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1908
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_244take_2d_axis0_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_float64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis0_float64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1916
 *         float64_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 *     k = values.shape[1]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1917
 * 
 *     n = len(indexer)
 *     k = values.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_v_k = (__pyx_v_values->dimensions[1]);

  /* "pandas/src/generated.pyx":1919
 *     k = values.shape[1]
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1920
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1922
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1922; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1924
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1925
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1926
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1927
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1928
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":1929
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_105), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1931
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":1932
 *             else:
 *                 for j from 0 <= j < k:
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_19 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1934
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_fill_value); if (unlikely((__pyx_t_20 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_20;

    /* "pandas/src/generated.pyx":1935
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1936
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1937
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1938
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":1939
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1941
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 * 
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":1942
 *             else:
 *                 for j in range(k):
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_247take_2d_axis0_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_247take_2d_axis0_object = {__Pyx_NAMESTR("take_2d_axis0_object"), (PyCFunction)__pyx_pw_6pandas_5algos_247take_2d_axis0_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_247take_2d_axis0_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis0_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1948
 * def take_2d_axis0_object(ndarray[object, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_106;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis0_object", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis0_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis0_object", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_246take_2d_axis0_object(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1946
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_246take_2d_axis0_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  PyObject *__pyx_v_fv = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  PyObject **__pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis0_object", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1954
 *         object fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 *     k = values.shape[1]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1955
 * 
 *     n = len(indexer)
 *     k = values.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_v_k = (__pyx_v_values->dimensions[1]);

  /* "pandas/src/generated.pyx":1957
 *     k = values.shape[1]
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1958
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1960
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1960; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":1962
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":1963
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1964
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1965
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1966
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":1967
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_107), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1969
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":1970
 *             else:
 *                 for j from 0 <= j < k:
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_19 = __pyx_v_j;
          __pyx_t_20 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_20);
          __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_20);
          *__pyx_t_20 = __pyx_t_3;
          __Pyx_GIVEREF(*__pyx_t_20);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1972
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __Pyx_INCREF(__pyx_v_fill_value);
    __pyx_v_fv = __pyx_v_fill_value;

    /* "pandas/src/generated.pyx":1973
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":1974
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":1975
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":1976
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":1977
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_20 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_20);
          __Pyx_INCREF(__pyx_v_fv); __Pyx_DECREF(*__pyx_t_20);
          *__pyx_t_20 = __pyx_v_fv;
          __Pyx_GIVEREF(*__pyx_t_20);
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":1979
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 * 
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":1980
 *             else:
 *                 for j in range(k):
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          __pyx_t_20 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_20);
          __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_20);
          *__pyx_t_20 = __pyx_t_3;
          __Pyx_GIVEREF(*__pyx_t_20);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XDECREF(__pyx_v_fv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_249take_2d_axis0_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_249take_2d_axis0_int32 = {__Pyx_NAMESTR("take_2d_axis0_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_249take_2d_axis0_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_249take_2d_axis0_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis0_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":1986
 * def take_2d_axis0_int32(ndarray[int32_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_108;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis0_int32", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis0_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis0_int32", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_248take_2d_axis0_int32(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":1984
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_248take_2d_axis0_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int32_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int32_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis0_int32", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":1992
 *         int32_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 *     k = values.shape[1]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":1993
 * 
 *     n = len(indexer)
 *     k = values.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_v_k = (__pyx_v_values->dimensions[1]);

  /* "pandas/src/generated.pyx":1995
 *     k = values.shape[1]
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":1996
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":1998
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2000
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2001
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2002
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2003
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2004
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2005
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_109), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2007
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2008
 *             else:
 *                 for j from 0 <= j < k:
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_19 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2010
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_20 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_fill_value); if (unlikely((__pyx_t_20 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_20;

    /* "pandas/src/generated.pyx":2011
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2012
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2013
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2014
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2015
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2017
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 * 
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2018
 *             else:
 *                 for j in range(k):
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_251take_2d_axis0_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_251take_2d_axis0_int64 = {__Pyx_NAMESTR("take_2d_axis0_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_251take_2d_axis0_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_251take_2d_axis0_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis0_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2024
 * def take_2d_axis0_int64(ndarray[int64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_110;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis0_int64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis0_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis0_int64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_250take_2d_axis0_int64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2022
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_250take_2d_axis0_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis0_int64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2030
 *         int64_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 *     k = values.shape[1]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2031
 * 
 *     n = len(indexer)
 *     k = values.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_v_k = (__pyx_v_values->dimensions[1]);

  /* "pandas/src/generated.pyx":2033
 *     k = values.shape[1]
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2034
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2036
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2038
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2039
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2040
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2041
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2042
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2043
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_111), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2045
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2046
 *             else:
 *                 for j from 0 <= j < k:
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_19 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2048
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_20 = __Pyx_PyInt_from_py_npy_int64(__pyx_v_fill_value); if (unlikely((__pyx_t_20 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_20;

    /* "pandas/src/generated.pyx":2049
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2050
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2051
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2052
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2053
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2055
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 * 
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2056
 *             else:
 *                 for j in range(k):
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_253take_2d_axis0_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_253take_2d_axis0_bool = {__Pyx_NAMESTR("take_2d_axis0_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_253take_2d_axis0_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_253take_2d_axis0_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis0_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2062
 * def take_2d_axis0_bool(ndarray[uint8_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_112;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis0_bool", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis0_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis0_bool", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_252take_2d_axis0_bool(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2060
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_252take_2d_axis0_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_uint8_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis0_bool", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2068
 *         uint8_t fv
 * 
 *     n = len(indexer)             # <<<<<<<<<<<<<<
 *     k = values.shape[1]
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2069
 * 
 *     n = len(indexer)
 *     k = values.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_v_k = (__pyx_v_values->dimensions[1]);

  /* "pandas/src/generated.pyx":2071
 *     k = values.shape[1]
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2072
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2074
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2076
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2077
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2078
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2079
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2080
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2081
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_113), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2083
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j from 0 <= j < k:             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_15; __pyx_v_j++) {

          /* "pandas/src/generated.pyx":2084
 *             else:
 *                 for j from 0 <= j < k:
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_19 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2086
 *                     outbuf[i, j] = values[idx, j]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = indexer[i]
 */
    __pyx_t_20 = __Pyx_PyInt_from_py_npy_uint8(__pyx_v_fill_value); if (unlikely((__pyx_t_20 == (npy_uint8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_20;

    /* "pandas/src/generated.pyx":2087
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = indexer[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2088
 *         fv = fill_value
 *         for i in range(n):
 *             idx = indexer[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2089
 *         for i in range(n):
 *             idx = indexer[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2090
 *             idx = indexer[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2091
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2093
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[idx, j]
 * 
 */
        __pyx_t_21 = __pyx_v_k;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
          __pyx_v_j = __pyx_t_22;

          /* "pandas/src/generated.pyx":2094
 *             else:
 *                 for j in range(k):
 *                     outbuf[i, j] = values[idx, j]             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_25 = __pyx_v_idx;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis0_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_255take_2d_axis1_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_255take_2d_axis1_float64 = {__Pyx_NAMESTR("take_2d_axis1_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_255take_2d_axis1_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_255take_2d_axis1_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis1_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2101
 * def take_2d_axis1_float64(ndarray[float64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_114;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis1_float64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis1_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis1_float64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_254take_2d_axis1_float64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2099
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_254take_2d_axis1_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __pyx_t_5numpy_float64_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis1_float64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2107
 *         float64_t fv
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     k = len(indexer)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2108
 * 
 *     n = len(values)
 *     k = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2110
 *     k = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2111
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2113
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2115
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2116
 * 
 *     if False and _checknan(fill_value):
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2117
 *     if False and _checknan(fill_value):
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2119
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2120
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2121
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_115), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2123
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2124
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_idx;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2126
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_fill_value); if (unlikely((__pyx_t_21 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_21;

    /* "pandas/src/generated.pyx":2127
 *     else:
 *         fv = fill_value
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2128
 *         fv = fill_value
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_15 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2130
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2131
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2132
 *             if idx == -1:
 *                 for i in range(n):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2134
 *                     outbuf[i, j] = fv
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 * 
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2135
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_257take_2d_axis1_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_257take_2d_axis1_object = {__Pyx_NAMESTR("take_2d_axis1_object"), (PyCFunction)__pyx_pw_6pandas_5algos_257take_2d_axis1_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_257take_2d_axis1_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis1_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2141
 * def take_2d_axis1_object(ndarray[object, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_116;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis1_object", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis1_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis1_object", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_256take_2d_axis1_object(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2139
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_256take_2d_axis1_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  PyObject *__pyx_v_fv = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  PyObject **__pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis1_object", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2147
 *         object fv
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     k = len(indexer)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2148
 * 
 *     n = len(values)
 *     k = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2150
 *     k = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2151
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2153
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if False and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2155
 *         outbuf = out
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2156
 * 
 *     if False and _checknan(fill_value):
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2157
 *     if False and _checknan(fill_value):
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2159
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2160
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2161
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_117), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2163
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2164
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_idx;
          __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_j;
          __pyx_t_21 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_21);
          __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_21);
          *__pyx_t_21 = __pyx_t_3;
          __Pyx_GIVEREF(*__pyx_t_21);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2166
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
    __Pyx_INCREF(__pyx_v_fill_value);
    __pyx_v_fv = __pyx_v_fill_value;

    /* "pandas/src/generated.pyx":2167
 *     else:
 *         fv = fill_value
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2168
 *         fv = fill_value
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_15 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2170
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2171
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2172
 *             if idx == -1:
 *                 for i in range(n):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          __pyx_t_21 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_21);
          __Pyx_INCREF(__pyx_v_fv); __Pyx_DECREF(*__pyx_t_21);
          *__pyx_t_21 = __pyx_v_fv;
          __Pyx_GIVEREF(*__pyx_t_21);
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2174
 *                     outbuf[i, j] = fv
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 * 
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2175
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          __pyx_t_21 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_21);
          __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_21);
          *__pyx_t_21 = __pyx_t_3;
          __Pyx_GIVEREF(*__pyx_t_21);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XDECREF(__pyx_v_fv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_259take_2d_axis1_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_259take_2d_axis1_int32 = {__Pyx_NAMESTR("take_2d_axis1_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_259take_2d_axis1_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_259take_2d_axis1_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis1_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2181
 * def take_2d_axis1_int32(ndarray[int32_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_118;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis1_int32", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis1_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis1_int32", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_258take_2d_axis1_int32(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2179
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_258take_2d_axis1_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int32_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __pyx_t_5numpy_int32_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis1_int32", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2187
 *         int32_t fv
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     k = len(indexer)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2188
 * 
 *     n = len(values)
 *     k = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2190
 *     k = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2191
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2193
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2195
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2196
 * 
 *     if True and _checknan(fill_value):
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2197
 *     if True and _checknan(fill_value):
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2199
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2200
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2201
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_119), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2203
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2204
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_idx;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2206
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
    __pyx_t_21 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_fill_value); if (unlikely((__pyx_t_21 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_21;

    /* "pandas/src/generated.pyx":2207
 *     else:
 *         fv = fill_value
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2208
 *         fv = fill_value
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_15 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2210
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2211
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2212
 *             if idx == -1:
 *                 for i in range(n):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2214
 *                     outbuf[i, j] = fv
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 * 
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2215
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_261take_2d_axis1_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_261take_2d_axis1_int64 = {__Pyx_NAMESTR("take_2d_axis1_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_261take_2d_axis1_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_261take_2d_axis1_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis1_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2221
 * def take_2d_axis1_int64(ndarray[int64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_120;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis1_int64", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis1_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis1_int64", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_260take_2d_axis1_int64(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2219
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_260take_2d_axis1_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __pyx_t_5numpy_int64_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis1_int64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2227
 *         int64_t fv
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     k = len(indexer)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2228
 * 
 *     n = len(values)
 *     k = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2230
 *     k = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2231
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2233
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2235
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2236
 * 
 *     if True and _checknan(fill_value):
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2237
 *     if True and _checknan(fill_value):
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2239
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2240
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2241
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_121), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2243
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2244
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_idx;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2246
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
    __pyx_t_21 = __Pyx_PyInt_from_py_npy_int64(__pyx_v_fill_value); if (unlikely((__pyx_t_21 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_21;

    /* "pandas/src/generated.pyx":2247
 *     else:
 *         fv = fill_value
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2248
 *         fv = fill_value
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_15 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2250
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2251
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2252
 *             if idx == -1:
 *                 for i in range(n):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2254
 *                     outbuf[i, j] = fv
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 * 
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2255
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_263take_2d_axis1_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_263take_2d_axis1_bool = {__Pyx_NAMESTR("take_2d_axis1_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_263take_2d_axis1_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_263take_2d_axis1_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_axis1_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__indexer,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[4] = {0,0,0,0};

    /* "pandas/src/generated.pyx":2261
 * def take_2d_axis1_bool(ndarray[uint8_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[2] = ((PyObject *)Py_None);
    values[3] = __pyx_k_122;
    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);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indexer)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_axis1_bool", 0, 2, 4, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_axis1_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_values = ((PyArrayObject *)values[0]);
    __pyx_v_indexer = ((PyArrayObject *)values[1]);
    __pyx_v_out = values[2];
    __pyx_v_fill_value = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_axis1_bool", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indexer), __pyx_ptype_5numpy_ndarray, 1, "indexer", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_262take_2d_axis1_bool(__pyx_self, __pyx_v_values, __pyx_v_indexer, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2259
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */

static PyObject *__pyx_pf_6pandas_5algos_262take_2d_axis1_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_indexer, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  __pyx_t_5numpy_uint8_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_axis1_bool", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2267
 *         uint8_t fv
 * 
 *     n = len(values)             # <<<<<<<<<<<<<<
 *     k = len(indexer)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_values)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2268
 * 
 *     n = len(values)
 *     k = len(indexer)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_indexer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2270
 *     k = len(indexer)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2271
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2273
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 *     if True and _checknan(fill_value):
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2275
 *         outbuf = out
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2276
 * 
 *     if True and _checknan(fill_value):
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2277
 *     if True and _checknan(fill_value):
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_14 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2279
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2280
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2281
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_123), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2283
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 */
        __pyx_t_15 = __pyx_v_n;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_i = __pyx_t_16;

          /* "pandas/src/generated.pyx":2284
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
          __pyx_t_17 = __pyx_v_i;
          __pyx_t_18 = __pyx_v_idx;
          __pyx_t_19 = __pyx_v_i;
          __pyx_t_20 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2286
 *                     outbuf[i, j] = values[i, idx]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for j in range(k):
 *             idx = indexer[j]
 */
    __pyx_t_21 = __Pyx_PyInt_from_py_npy_uint8(__pyx_v_fill_value); if (unlikely((__pyx_t_21 == (npy_uint8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_21;

    /* "pandas/src/generated.pyx":2287
 *     else:
 *         fv = fill_value
 *         for j in range(k):             # <<<<<<<<<<<<<<
 *             idx = indexer[j]
 * 
 */
    __pyx_t_1 = __pyx_v_k;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_j = __pyx_t_13;

      /* "pandas/src/generated.pyx":2288
 *         fv = fill_value
 *         for j in range(k):
 *             idx = indexer[j]             # <<<<<<<<<<<<<<
 * 
 *             if idx == -1:
 */
      __pyx_t_15 = __pyx_v_j;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_indexer.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2290
 *             idx = indexer[j]
 * 
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for i in range(n):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2291
 * 
 *             if idx == -1:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2292
 *             if idx == -1:
 *                 for i in range(n):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
          __pyx_t_23 = __pyx_v_i;
          __pyx_t_24 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L14;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2294
 *                     outbuf[i, j] = fv
 *             else:
 *                 for i in range(n):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = values[i, idx]
 * 
 */
        __pyx_t_16 = __pyx_v_n;
        for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_16; __pyx_t_22+=1) {
          __pyx_v_i = __pyx_t_22;

          /* "pandas/src/generated.pyx":2295
 *             else:
 *                 for i in range(n):
 *                     outbuf[i, j] = values[i, idx]             # <<<<<<<<<<<<<<
 * 
 * 
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_idx;
          __pyx_t_27 = __pyx_v_i;
          __pyx_t_28 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_values.diminfo[1].strides));
        }
      }
      __pyx_L14:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_axis1_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_265take_2d_multi_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_265take_2d_multi_float64 = {__Pyx_NAMESTR("take_2d_multi_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_265take_2d_multi_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_265take_2d_multi_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_idx0 = 0;
  PyArrayObject *__pyx_v_idx1 = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_multi_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__idx0,&__pyx_n_s__idx1,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pandas/src/generated.pyx":2303
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_124;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_float64", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_float64", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_multi_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_values = ((PyArrayObject *)values[0]);
    __pyx_v_idx0 = ((PyArrayObject *)values[1]);
    __pyx_v_idx1 = ((PyArrayObject *)values[2]);
    __pyx_v_out = values[3];
    __pyx_v_fill_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_multi_float64", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx0), __pyx_ptype_5numpy_ndarray, 1, "idx0", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx1), __pyx_ptype_5numpy_ndarray, 1, "idx1", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_264take_2d_multi_float64(__pyx_self, __pyx_v_values, __pyx_v_idx0, __pyx_v_idx1, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2300
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */

static PyObject *__pyx_pf_6pandas_5algos_264take_2d_multi_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_float64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx0;
  __Pyx_Buffer __pyx_pybuffer_idx0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx1;
  __Pyx_Buffer __pyx_pybuffer_idx1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __pyx_t_5numpy_float64_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  __pyx_t_5numpy_int64_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_multi_float64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_idx0.pybuffer.buf = NULL;
  __pyx_pybuffer_idx0.refcount = 0;
  __pyx_pybuffernd_idx0.data = NULL;
  __pyx_pybuffernd_idx0.rcbuffer = &__pyx_pybuffer_idx0;
  __pyx_pybuffer_idx1.pybuffer.buf = NULL;
  __pyx_pybuffer_idx1.refcount = 0;
  __pyx_pybuffernd_idx1.data = NULL;
  __pyx_pybuffernd_idx1.rcbuffer = &__pyx_pybuffer_idx1;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx0.diminfo[0].strides = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx0.diminfo[0].shape = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx1.diminfo[0].strides = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx1.diminfo[0].shape = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2309
 *         float64_t fv
 * 
 *     n = len(idx0)             # <<<<<<<<<<<<<<
 *     k = len(idx1)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx0)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2310
 * 
 *     n = len(idx0)
 *     k = len(idx1)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2312
 *     k = len(idx1)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2313
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2315
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2318
 * 
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2319
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2320
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2321
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2322
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2323
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_125), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2325
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2326
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         raise ValueError('No NA values allowed')
 *                     else:
 */
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2327
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_126), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L12;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2329
 *                         raise ValueError('No NA values allowed')
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_19 = __pyx_v_idx;
            __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_21 = __pyx_v_i;
            __pyx_t_22 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L12:;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2331
 *                         outbuf[i, j] = values[idx, idx1[j]]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
    __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_fill_value); if (unlikely((__pyx_t_23 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_23;

    /* "pandas/src/generated.pyx":2332
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2333
 *         fv = fill_value
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2334
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2335
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2336
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2338
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2339
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         outbuf[i, j] = fv
 *                     else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2340
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2342
 *                         outbuf[i, j] = fv
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
            __pyx_t_30 = __pyx_v_j;
            __pyx_t_31 = __pyx_v_idx;
            __pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_33 = __pyx_v_i;
            __pyx_t_34 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L20:;
        }
      }
      __pyx_L15:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_267take_2d_multi_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_267take_2d_multi_object = {__Pyx_NAMESTR("take_2d_multi_object"), (PyCFunction)__pyx_pw_6pandas_5algos_267take_2d_multi_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_267take_2d_multi_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_idx0 = 0;
  PyArrayObject *__pyx_v_idx1 = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_multi_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__idx0,&__pyx_n_s__idx1,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pandas/src/generated.pyx":2349
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_127;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_object", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_object", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_multi_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_values = ((PyArrayObject *)values[0]);
    __pyx_v_idx0 = ((PyArrayObject *)values[1]);
    __pyx_v_idx1 = ((PyArrayObject *)values[2]);
    __pyx_v_out = values[3];
    __pyx_v_fill_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_multi_object", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx0), __pyx_ptype_5numpy_ndarray, 1, "idx0", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx1), __pyx_ptype_5numpy_ndarray, 1, "idx1", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_266take_2d_multi_object(__pyx_self, __pyx_v_values, __pyx_v_idx0, __pyx_v_idx1, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */

static PyObject *__pyx_pf_6pandas_5algos_266take_2d_multi_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  PyObject *__pyx_v_fv = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx0;
  __Pyx_Buffer __pyx_pybuffer_idx0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx1;
  __Pyx_Buffer __pyx_pybuffer_idx1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  PyObject **__pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  __pyx_t_5numpy_int64_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_multi_object", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_idx0.pybuffer.buf = NULL;
  __pyx_pybuffer_idx0.refcount = 0;
  __pyx_pybuffernd_idx0.data = NULL;
  __pyx_pybuffernd_idx0.rcbuffer = &__pyx_pybuffer_idx0;
  __pyx_pybuffer_idx1.pybuffer.buf = NULL;
  __pyx_pybuffer_idx1.refcount = 0;
  __pyx_pybuffernd_idx1.data = NULL;
  __pyx_pybuffernd_idx1.rcbuffer = &__pyx_pybuffer_idx1;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx0.diminfo[0].strides = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx0.diminfo[0].shape = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx1.diminfo[0].strides = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx1.diminfo[0].shape = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2355
 *         object fv
 * 
 *     n = len(idx0)             # <<<<<<<<<<<<<<
 *     k = len(idx1)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx0)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2356
 * 
 *     n = len(idx0)
 *     k = len(idx1)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2358
 *     k = len(idx1)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2359
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2361
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2364
 * 
 * 
 *     if False and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
  if (0) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 0;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2365
 * 
 *     if False and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2366
 *     if False and _checknan(fill_value):
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2367
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2368
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2369
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_128), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2371
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2372
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         raise ValueError('No NA values allowed')
 *                     else:
 */
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2373
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_129), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L12;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2375
 *                         raise ValueError('No NA values allowed')
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_19 = __pyx_v_idx;
            __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_3);
            __pyx_t_21 = __pyx_v_i;
            __pyx_t_22 = __pyx_v_j;
            __pyx_t_23 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_outbuf.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_23);
            __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_23);
            *__pyx_t_23 = __pyx_t_3;
            __Pyx_GIVEREF(*__pyx_t_23);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_L12:;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2377
 *                         outbuf[i, j] = values[idx, idx1[j]]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
    __Pyx_INCREF(__pyx_v_fill_value);
    __pyx_v_fv = __pyx_v_fill_value;

    /* "pandas/src/generated.pyx":2378
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2379
 *         fv = fill_value
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2380
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2381
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2382
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_j;
          __pyx_t_23 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_outbuf.diminfo[1].strides);
          __Pyx_GOTREF(*__pyx_t_23);
          __Pyx_INCREF(__pyx_v_fv); __Pyx_DECREF(*__pyx_t_23);
          *__pyx_t_23 = __pyx_v_fv;
          __Pyx_GIVEREF(*__pyx_t_23);
        }
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2384
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2385
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         outbuf[i, j] = fv
 *                     else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2386
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = __pyx_v_j;
            __pyx_t_23 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_outbuf.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_23);
            __Pyx_INCREF(__pyx_v_fv); __Pyx_DECREF(*__pyx_t_23);
            *__pyx_t_23 = __pyx_v_fv;
            __Pyx_GIVEREF(*__pyx_t_23);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2388
 *                         outbuf[i, j] = fv
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
            __pyx_t_30 = __pyx_v_j;
            __pyx_t_31 = __pyx_v_idx;
            __pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_3);
            __pyx_t_33 = __pyx_v_i;
            __pyx_t_34 = __pyx_v_j;
            __pyx_t_23 = __Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_outbuf.diminfo[1].strides);
            __Pyx_GOTREF(*__pyx_t_23);
            __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(*__pyx_t_23);
            *__pyx_t_23 = __pyx_t_3;
            __Pyx_GIVEREF(*__pyx_t_23);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
          __pyx_L20:;
        }
      }
      __pyx_L15:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XDECREF(__pyx_v_fv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_269take_2d_multi_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_269take_2d_multi_int32 = {__Pyx_NAMESTR("take_2d_multi_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_269take_2d_multi_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_269take_2d_multi_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_idx0 = 0;
  PyArrayObject *__pyx_v_idx1 = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_multi_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__idx0,&__pyx_n_s__idx1,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pandas/src/generated.pyx":2395
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_130;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_int32", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_int32", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_multi_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_values = ((PyArrayObject *)values[0]);
    __pyx_v_idx0 = ((PyArrayObject *)values[1]);
    __pyx_v_idx1 = ((PyArrayObject *)values[2]);
    __pyx_v_out = values[3];
    __pyx_v_fill_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_multi_int32", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx0), __pyx_ptype_5numpy_ndarray, 1, "idx0", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx1), __pyx_ptype_5numpy_ndarray, 1, "idx1", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_268take_2d_multi_int32(__pyx_self, __pyx_v_values, __pyx_v_idx0, __pyx_v_idx1, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2392
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */

static PyObject *__pyx_pf_6pandas_5algos_268take_2d_multi_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int32_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx0;
  __Pyx_Buffer __pyx_pybuffer_idx0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx1;
  __Pyx_Buffer __pyx_pybuffer_idx1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __pyx_t_5numpy_int32_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  __pyx_t_5numpy_int64_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_multi_int32", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_idx0.pybuffer.buf = NULL;
  __pyx_pybuffer_idx0.refcount = 0;
  __pyx_pybuffernd_idx0.data = NULL;
  __pyx_pybuffernd_idx0.rcbuffer = &__pyx_pybuffer_idx0;
  __pyx_pybuffer_idx1.pybuffer.buf = NULL;
  __pyx_pybuffer_idx1.refcount = 0;
  __pyx_pybuffernd_idx1.data = NULL;
  __pyx_pybuffernd_idx1.rcbuffer = &__pyx_pybuffer_idx1;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx0.diminfo[0].strides = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx0.diminfo[0].shape = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx1.diminfo[0].strides = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx1.diminfo[0].shape = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2401
 *         int32_t fv
 * 
 *     n = len(idx0)             # <<<<<<<<<<<<<<
 *     k = len(idx1)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx0)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2402
 * 
 *     n = len(idx0)
 *     k = len(idx1)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2404
 *     k = len(idx1)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2405
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2407
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2410
 * 
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2411
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2412
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2413
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2414
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2415
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_131), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2417
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2418
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         raise ValueError('No NA values allowed')
 *                     else:
 */
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2419
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_132), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L12;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2421
 *                         raise ValueError('No NA values allowed')
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_19 = __pyx_v_idx;
            __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_21 = __pyx_v_i;
            __pyx_t_22 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L12:;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2423
 *                         outbuf[i, j] = values[idx, idx1[j]]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
    __pyx_t_23 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_fill_value); if (unlikely((__pyx_t_23 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_23;

    /* "pandas/src/generated.pyx":2424
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2425
 *         fv = fill_value
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2426
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2427
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2428
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2430
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2431
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         outbuf[i, j] = fv
 *                     else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2432
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2434
 *                         outbuf[i, j] = fv
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
            __pyx_t_30 = __pyx_v_j;
            __pyx_t_31 = __pyx_v_idx;
            __pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_33 = __pyx_v_i;
            __pyx_t_34 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L20:;
        }
      }
      __pyx_L15:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_271take_2d_multi_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_271take_2d_multi_int64 = {__Pyx_NAMESTR("take_2d_multi_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_271take_2d_multi_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_271take_2d_multi_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_idx0 = 0;
  PyArrayObject *__pyx_v_idx1 = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_multi_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__idx0,&__pyx_n_s__idx1,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pandas/src/generated.pyx":2441
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_133;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_int64", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_int64", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_multi_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_values = ((PyArrayObject *)values[0]);
    __pyx_v_idx0 = ((PyArrayObject *)values[1]);
    __pyx_v_idx1 = ((PyArrayObject *)values[2]);
    __pyx_v_out = values[3];
    __pyx_v_fill_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_multi_int64", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx0), __pyx_ptype_5numpy_ndarray, 1, "idx0", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx1), __pyx_ptype_5numpy_ndarray, 1, "idx1", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_270take_2d_multi_int64(__pyx_self, __pyx_v_values, __pyx_v_idx0, __pyx_v_idx1, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2438
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */

static PyObject *__pyx_pf_6pandas_5algos_270take_2d_multi_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_int64_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx0;
  __Pyx_Buffer __pyx_pybuffer_idx0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx1;
  __Pyx_Buffer __pyx_pybuffer_idx1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __pyx_t_5numpy_int64_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_multi_int64", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_idx0.pybuffer.buf = NULL;
  __pyx_pybuffer_idx0.refcount = 0;
  __pyx_pybuffernd_idx0.data = NULL;
  __pyx_pybuffernd_idx0.rcbuffer = &__pyx_pybuffer_idx0;
  __pyx_pybuffer_idx1.pybuffer.buf = NULL;
  __pyx_pybuffer_idx1.refcount = 0;
  __pyx_pybuffernd_idx1.data = NULL;
  __pyx_pybuffernd_idx1.rcbuffer = &__pyx_pybuffer_idx1;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx0.diminfo[0].strides = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx0.diminfo[0].shape = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx1.diminfo[0].strides = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx1.diminfo[0].shape = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2447
 *         int64_t fv
 * 
 *     n = len(idx0)             # <<<<<<<<<<<<<<
 *     k = len(idx1)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx0)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2448
 * 
 *     n = len(idx0)
 *     k = len(idx1)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2450
 *     k = len(idx1)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2451
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2453
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2456
 * 
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2457
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2458
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2459
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2460
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2461
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_134), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2463
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2464
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         raise ValueError('No NA values allowed')
 *                     else:
 */
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2465
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_135), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L12;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2467
 *                         raise ValueError('No NA values allowed')
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_19 = __pyx_v_idx;
            __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_21 = __pyx_v_i;
            __pyx_t_22 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L12:;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2469
 *                         outbuf[i, j] = values[idx, idx1[j]]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
    __pyx_t_23 = __Pyx_PyInt_from_py_npy_int64(__pyx_v_fill_value); if (unlikely((__pyx_t_23 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_23;

    /* "pandas/src/generated.pyx":2470
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2471
 *         fv = fill_value
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2472
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2473
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2474
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2476
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2477
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         outbuf[i, j] = fv
 *                     else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2478
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2480
 *                         outbuf[i, j] = fv
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
            __pyx_t_30 = __pyx_v_j;
            __pyx_t_31 = __pyx_v_idx;
            __pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_32 = __pyx_v_i;
            __pyx_t_33 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L20:;
        }
      }
      __pyx_L15:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_273take_2d_multi_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_273take_2d_multi_bool = {__Pyx_NAMESTR("take_2d_multi_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_273take_2d_multi_bool, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_273take_2d_multi_bool(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_values = 0;
  PyArrayObject *__pyx_v_idx0 = 0;
  PyArrayObject *__pyx_v_idx1 = 0;
  PyObject *__pyx_v_out = 0;
  PyObject *__pyx_v_fill_value = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_2d_multi_bool (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__idx0,&__pyx_n_s__idx1,&__pyx_n_s__out,&__pyx_n_s__fill_value,0};
    PyObject* values[5] = {0,0,0,0,0};

    /* "pandas/src/generated.pyx":2487
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = __pyx_k_136;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_bool", 0, 3, 5, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_2d_multi_bool", 0, 3, 5, 2); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_2d_multi_bool") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_values = ((PyArrayObject *)values[0]);
    __pyx_v_idx0 = ((PyArrayObject *)values[1]);
    __pyx_v_idx1 = ((PyArrayObject *)values[2]);
    __pyx_v_out = values[3];
    __pyx_v_fill_value = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_2d_multi_bool", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx0), __pyx_ptype_5numpy_ndarray, 1, "idx0", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx1), __pyx_ptype_5numpy_ndarray, 1, "idx1", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_272take_2d_multi_bool(__pyx_self, __pyx_v_values, __pyx_v_idx0, __pyx_v_idx1, __pyx_v_out, __pyx_v_fill_value);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2484
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */

static PyObject *__pyx_pf_6pandas_5algos_272take_2d_multi_bool(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_idx0, PyArrayObject *__pyx_v_idx1, PyObject *__pyx_v_out, PyObject *__pyx_v_fill_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_k;
  Py_ssize_t __pyx_v_n;
  Py_ssize_t __pyx_v_idx;
  PyArrayObject *__pyx_v_outbuf = 0;
  __pyx_t_5numpy_uint8_t __pyx_v_fv;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx0;
  __Pyx_Buffer __pyx_pybuffer_idx0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_idx1;
  __Pyx_Buffer __pyx_pybuffer_idx1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_outbuf;
  __Pyx_Buffer __pyx_pybuffer_outbuf;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_values;
  __Pyx_Buffer __pyx_pybuffer_values;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  __pyx_t_5numpy_int64_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  __pyx_t_5numpy_uint8_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  __pyx_t_5numpy_int64_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_2d_multi_bool", 0);
  __pyx_pybuffer_outbuf.pybuffer.buf = NULL;
  __pyx_pybuffer_outbuf.refcount = 0;
  __pyx_pybuffernd_outbuf.data = NULL;
  __pyx_pybuffernd_outbuf.rcbuffer = &__pyx_pybuffer_outbuf;
  __pyx_pybuffer_values.pybuffer.buf = NULL;
  __pyx_pybuffer_values.refcount = 0;
  __pyx_pybuffernd_values.data = NULL;
  __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values;
  __pyx_pybuffer_idx0.pybuffer.buf = NULL;
  __pyx_pybuffer_idx0.refcount = 0;
  __pyx_pybuffernd_idx0.data = NULL;
  __pyx_pybuffernd_idx0.rcbuffer = &__pyx_pybuffer_idx0;
  __pyx_pybuffer_idx1.pybuffer.buf = NULL;
  __pyx_pybuffer_idx1.refcount = 0;
  __pyx_pybuffernd_idx1.data = NULL;
  __pyx_pybuffernd_idx1.rcbuffer = &__pyx_pybuffer_idx1;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_values.diminfo[1].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_values.diminfo[1].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx0.diminfo[0].strides = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx0.diminfo[0].shape = __pyx_pybuffernd_idx0.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_idx1.diminfo[0].strides = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx1.diminfo[0].shape = __pyx_pybuffernd_idx1.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2493
 *         uint8_t fv
 * 
 *     n = len(idx0)             # <<<<<<<<<<<<<<
 *     k = len(idx1)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx0)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_n = __pyx_t_1;

  /* "pandas/src/generated.pyx":2494
 * 
 *     n = len(idx0)
 *     k = len(idx1)             # <<<<<<<<<<<<<<
 * 
 *     if out is None:
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_idx1)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_k = __pyx_t_1;

  /* "pandas/src/generated.pyx":2496
 *     k = len(idx1)
 * 
 *     if out is None:             # <<<<<<<<<<<<<<
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_out == Py_None);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2497
 * 
 *     if out is None:
 *         outbuf = np.empty((n, k), dtype=values.dtype)             # <<<<<<<<<<<<<<
 *     else:
 *         outbuf = out
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_values), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2499
 *         outbuf = np.empty((n, k), dtype=values.dtype)
 *     else:
 *         outbuf = out             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = ((PyArrayObject *)__pyx_v_out);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
      __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_8 < 0)) {
        PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer, (PyObject*)__pyx_v_outbuf, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9);
        }
      }
      __pyx_pybuffernd_outbuf.diminfo[0].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_outbuf.diminfo[0].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_outbuf.diminfo[1].strides = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_outbuf.diminfo[1].shape = __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_v_out);
    __pyx_v_outbuf = ((PyArrayObject *)__pyx_v_out);
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2502
 * 
 * 
 *     if True and _checknan(fill_value):             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
  if (1) {
    __pyx_t_2 = __pyx_f_4util__checknan(__pyx_v_fill_value);
    __pyx_t_12 = __pyx_t_2;
  } else {
    __pyx_t_12 = 1;
  }
  if (__pyx_t_12) {

    /* "pandas/src/generated.pyx":2503
 * 
 *     if True and _checknan(fill_value):
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2504
 *     if True and _checknan(fill_value):
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_14 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2505
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2506
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     raise ValueError('No NA values allowed')
 *             else:
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2507
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_137), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_Raise(__pyx_t_3, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2509
 *                     raise ValueError('No NA values allowed')
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')
 */
        __pyx_t_15 = __pyx_v_k;
        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
          __pyx_v_j = __pyx_t_16;

          /* "pandas/src/generated.pyx":2510
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         raise ValueError('No NA values allowed')
 *                     else:
 */
          __pyx_t_17 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2511
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_138), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_Raise(__pyx_t_3, 0, 0, 0);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            goto __pyx_L12;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2513
 *                         raise ValueError('No NA values allowed')
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 *     else:
 *         fv = fill_value
 */
            __pyx_t_18 = __pyx_v_j;
            __pyx_t_19 = __pyx_v_idx;
            __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_21 = __pyx_v_i;
            __pyx_t_22 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L12:;
        }
      }
      __pyx_L7:;
    }
    goto __pyx_L4;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":2515
 *                         outbuf[i, j] = values[idx, idx1[j]]
 *     else:
 *         fv = fill_value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             idx = idx0[i]
 */
    __pyx_t_23 = __Pyx_PyInt_from_py_npy_uint8(__pyx_v_fill_value); if (unlikely((__pyx_t_23 == (npy_uint8)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_fv = __pyx_t_23;

    /* "pandas/src/generated.pyx":2516
 *     else:
 *         fv = fill_value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             idx = idx0[i]
 *             if idx == -1:
 */
    __pyx_t_1 = __pyx_v_n;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_1; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pandas/src/generated.pyx":2517
 *         fv = fill_value
 *         for i in range(n):
 *             idx = idx0[i]             # <<<<<<<<<<<<<<
 *             if idx == -1:
 *                 for j in range(k):
 */
      __pyx_t_15 = __pyx_v_i;
      __pyx_v_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx0.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_idx0.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2518
 *         for i in range(n):
 *             idx = idx0[i]
 *             if idx == -1:             # <<<<<<<<<<<<<<
 *                 for j in range(k):
 *                     outbuf[i, j] = fv
 */
      __pyx_t_12 = (__pyx_v_idx == -1);
      if (__pyx_t_12) {

        /* "pandas/src/generated.pyx":2519
 *             idx = idx0[i]
 *             if idx == -1:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     outbuf[i, j] = fv
 *             else:
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2520
 *             if idx == -1:
 *                 for j in range(k):
 *                     outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
          __pyx_t_25 = __pyx_v_i;
          __pyx_t_26 = __pyx_v_j;
          *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
        }
        goto __pyx_L15;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2522
 *                     outbuf[i, j] = fv
 *             else:
 *                 for j in range(k):             # <<<<<<<<<<<<<<
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv
 */
        __pyx_t_16 = __pyx_v_k;
        for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_16; __pyx_t_24+=1) {
          __pyx_v_j = __pyx_t_24;

          /* "pandas/src/generated.pyx":2523
 *             else:
 *                 for j in range(k):
 *                     if idx1[j] == -1:             # <<<<<<<<<<<<<<
 *                         outbuf[i, j] = fv
 *                     else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_idx1.diminfo[0].strides)) == -1);
          if (__pyx_t_12) {

            /* "pandas/src/generated.pyx":2524
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         outbuf[i, j] = fv             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
            __pyx_t_28 = __pyx_v_i;
            __pyx_t_29 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_outbuf.diminfo[1].strides) = __pyx_v_fv;
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2526
 *                         outbuf[i, j] = fv
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]             # <<<<<<<<<<<<<<
 * 
 * 
 */
            __pyx_t_30 = __pyx_v_j;
            __pyx_t_31 = __pyx_v_idx;
            __pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_idx1.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_idx1.diminfo[0].strides));
            __pyx_t_33 = __pyx_v_i;
            __pyx_t_34 = __pyx_v_j;
            *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_outbuf.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_outbuf.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_outbuf.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint8_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_values.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_values.diminfo[1].strides));
          }
          __pyx_L20:;
        }
      }
      __pyx_L15:;
    }
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.take_2d_multi_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_outbuf.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_outbuf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_275left_join_indexer_unique_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_275left_join_indexer_unique_float64 = {__Pyx_NAMESTR("left_join_indexer_unique_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_275left_join_indexer_unique_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_275left_join_indexer_unique_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_unique_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_unique_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_274left_join_indexer_unique_float64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2531
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[float64_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_274left_join_indexer_unique_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_float64_t __pyx_v_rval;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_unique_float64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2538
 *         float64_t lval, rval
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     nleft = len(left)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2539
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     nleft = len(left)
 *     nright = len(right)
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2540
 *     i = 0
 *     j = 0
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2541
 *     j = 0
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2543
 *     nright = len(right)
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     while True:
 *         if i == nleft:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nleft); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":2544
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:             # <<<<<<<<<<<<<<
 *         if i == nleft:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":2545
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:
 *         if i == nleft:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_12 = (__pyx_v_i == __pyx_v_nleft);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2546
 *     while True:
 *         if i == nleft:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if j == nright:
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":2548
 *             break
 * 
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             i += 1
 */
    __pyx_t_12 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2549
 * 
 *         if j == nright:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *             continue
 */
      __pyx_t_1 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2550
 *         if j == nright:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2551
 *             indexer[i] = -1
 *             i += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         rval = right[j]
 */
      goto __pyx_L3_continue;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":2553
 *             continue
 * 
 *         rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *         while i < nleft - 1 and left[i] == rval:
 */
    __pyx_t_13 = __pyx_v_j;
    __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_right.diminfo[0].strides));

    /* "pandas/src/generated.pyx":2555
 *         rval = right[j]
 * 
 *         while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_i < (__pyx_v_nleft - 1));
      if (__pyx_t_12) {
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
        __pyx_t_16 = __pyx_t_15;
      } else {
        __pyx_t_16 = __pyx_t_12;
      }
      if (!__pyx_t_16) break;

      /* "pandas/src/generated.pyx":2556
 * 
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
      __pyx_t_17 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2557
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         if left[i] == right[j]:
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "pandas/src/generated.pyx":2559
 *             i += 1
 * 
 *         if left[i] == right[j]:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = __pyx_v_j;
    __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left.diminfo[0].strides)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right.diminfo[0].strides)));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":2560
 * 
 *         if left[i] == right[j]:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2561
 *         if left[i] == right[j]:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2562
 *             indexer[i] = j
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *                 indexer[i] = j
 *                 i += 1
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_16) {
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
          __pyx_t_15 = __pyx_t_12;
        } else {
          __pyx_t_15 = __pyx_t_16;
        }
        if (!__pyx_t_15) break;

        /* "pandas/src/generated.pyx":2563
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j             # <<<<<<<<<<<<<<
 *                 i += 1
 *             j += 1
 */
        __pyx_t_22 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2564
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 *                 i += 1             # <<<<<<<<<<<<<<
 *             j += 1
 *         elif left[i] > rval:
 */
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/src/generated.pyx":2565
 *                 indexer[i] = j
 *                 i += 1
 *             j += 1             # <<<<<<<<<<<<<<
 *         elif left[i] > rval:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }

    /* "pandas/src/generated.pyx":2566
 *                 i += 1
 *             j += 1
 *         elif left[i] > rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             j += 1
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_left.diminfo[0].strides)) > __pyx_v_rval);
    if (__pyx_t_15) {

      /* "pandas/src/generated.pyx":2567
 *             j += 1
 *         elif left[i] > rval:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             j += 1
 *         else:
 */
      __pyx_t_24 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2568
 *         elif left[i] > rval:
 *             indexer[i] = -1
 *             j += 1             # <<<<<<<<<<<<<<
 *         else:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":2570
 *             j += 1
 *         else:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *     return indexer
 */
      __pyx_t_25 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2571
 *         else:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *     return indexer
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __pyx_L9:;
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pandas/src/generated.pyx":2572
 *             indexer[i] = -1
 *             i += 1
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_277left_join_indexer_unique_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_277left_join_indexer_unique_object = {__Pyx_NAMESTR("left_join_indexer_unique_object"), (PyCFunction)__pyx_pw_6pandas_5algos_277left_join_indexer_unique_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_277left_join_indexer_unique_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_unique_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_unique_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_276left_join_indexer_unique_object(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2576
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[object] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_276left_join_indexer_unique_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  PyObject *__pyx_v_rval = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_unique_object", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2583
 *         object lval, rval
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     nleft = len(left)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2584
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     nleft = len(left)
 *     nright = len(right)
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2585
 *     i = 0
 *     j = 0
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2586
 *     j = 0
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2588
 *     nright = len(right)
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     while True:
 *         if i == nleft:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nleft); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":2589
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:             # <<<<<<<<<<<<<<
 *         if i == nleft:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":2590
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:
 *         if i == nleft:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_12 = (__pyx_v_i == __pyx_v_nleft);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2591
 *     while True:
 *         if i == nleft:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if j == nright:
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":2593
 *             break
 * 
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             i += 1
 */
    __pyx_t_12 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2594
 * 
 *         if j == nright:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *             continue
 */
      __pyx_t_1 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2595
 *         if j == nright:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2596
 *             indexer[i] = -1
 *             i += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         rval = right[j]
 */
      goto __pyx_L3_continue;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":2598
 *             continue
 * 
 *         rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *         while i < nleft - 1 and left[i] == rval:
 */
    __pyx_t_13 = __pyx_v_j;
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_right.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __Pyx_XDECREF(__pyx_v_rval);
    __pyx_v_rval = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "pandas/src/generated.pyx":2600
 *         rval = right[j]
 * 
 *         while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_i < (__pyx_v_nleft - 1));
      if (__pyx_t_12) {
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_6);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_16 = __pyx_t_15;
      } else {
        __pyx_t_16 = __pyx_t_12;
      }
      if (!__pyx_t_16) break;

      /* "pandas/src/generated.pyx":2601
 * 
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
      __pyx_t_17 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2602
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         if left[i] == right[j]:
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "pandas/src/generated.pyx":2604
 *             i += 1
 * 
 *         if left[i] == right[j]:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_2 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_2);
    __pyx_t_19 = __pyx_v_j;
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":2605
 * 
 *         if left[i] == right[j]:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2606
 *         if left[i] == right[j]:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2607
 *             indexer[i] = j
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *                 indexer[i] = j
 *                 i += 1
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_16) {
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_4 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_left.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_4);
          __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_15 = __pyx_t_12;
        } else {
          __pyx_t_15 = __pyx_t_16;
        }
        if (!__pyx_t_15) break;

        /* "pandas/src/generated.pyx":2608
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j             # <<<<<<<<<<<<<<
 *                 i += 1
 *             j += 1
 */
        __pyx_t_22 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2609
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 *                 i += 1             # <<<<<<<<<<<<<<
 *             j += 1
 *         elif left[i] > rval:
 */
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/src/generated.pyx":2610
 *                 indexer[i] = j
 *                 i += 1
 *             j += 1             # <<<<<<<<<<<<<<
 *         elif left[i] > rval:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }

    /* "pandas/src/generated.pyx":2611
 *                 i += 1
 *             j += 1
 *         elif left[i] > rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             j += 1
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_left.diminfo[0].strides);
    __Pyx_INCREF((PyObject*)__pyx_t_6);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_v_rval, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_15) {

      /* "pandas/src/generated.pyx":2612
 *             j += 1
 *         elif left[i] > rval:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             j += 1
 *         else:
 */
      __pyx_t_24 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2613
 *         elif left[i] > rval:
 *             indexer[i] = -1
 *             j += 1             # <<<<<<<<<<<<<<
 *         else:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":2615
 *             j += 1
 *         else:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *     return indexer
 */
      __pyx_t_25 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2616
 *         else:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *     return indexer
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __pyx_L9:;
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pandas/src/generated.pyx":2617
 *             indexer[i] = -1
 *             i += 1
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XDECREF(__pyx_v_rval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_279left_join_indexer_unique_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_279left_join_indexer_unique_int32 = {__Pyx_NAMESTR("left_join_indexer_unique_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_279left_join_indexer_unique_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_279left_join_indexer_unique_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_unique_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_unique_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2622; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_278left_join_indexer_unique_int32(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int32_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_278left_join_indexer_unique_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int32_t __pyx_v_rval;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_unique_int32", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2628
 *         int32_t lval, rval
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     nleft = len(left)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2629
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     nleft = len(left)
 *     nright = len(right)
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2630
 *     i = 0
 *     j = 0
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2631
 *     j = 0
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2633
 *     nright = len(right)
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     while True:
 *         if i == nleft:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nleft); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":2634
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:             # <<<<<<<<<<<<<<
 *         if i == nleft:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":2635
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:
 *         if i == nleft:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_12 = (__pyx_v_i == __pyx_v_nleft);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2636
 *     while True:
 *         if i == nleft:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if j == nright:
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":2638
 *             break
 * 
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             i += 1
 */
    __pyx_t_12 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2639
 * 
 *         if j == nright:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *             continue
 */
      __pyx_t_1 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2640
 *         if j == nright:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2641
 *             indexer[i] = -1
 *             i += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         rval = right[j]
 */
      goto __pyx_L3_continue;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":2643
 *             continue
 * 
 *         rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *         while i < nleft - 1 and left[i] == rval:
 */
    __pyx_t_13 = __pyx_v_j;
    __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_right.diminfo[0].strides));

    /* "pandas/src/generated.pyx":2645
 *         rval = right[j]
 * 
 *         while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_i < (__pyx_v_nleft - 1));
      if (__pyx_t_12) {
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
        __pyx_t_16 = __pyx_t_15;
      } else {
        __pyx_t_16 = __pyx_t_12;
      }
      if (!__pyx_t_16) break;

      /* "pandas/src/generated.pyx":2646
 * 
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
      __pyx_t_17 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2647
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         if left[i] == right[j]:
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "pandas/src/generated.pyx":2649
 *             i += 1
 * 
 *         if left[i] == right[j]:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = __pyx_v_j;
    __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left.diminfo[0].strides)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right.diminfo[0].strides)));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":2650
 * 
 *         if left[i] == right[j]:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2651
 *         if left[i] == right[j]:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2652
 *             indexer[i] = j
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *                 indexer[i] = j
 *                 i += 1
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_16) {
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
          __pyx_t_15 = __pyx_t_12;
        } else {
          __pyx_t_15 = __pyx_t_16;
        }
        if (!__pyx_t_15) break;

        /* "pandas/src/generated.pyx":2653
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j             # <<<<<<<<<<<<<<
 *                 i += 1
 *             j += 1
 */
        __pyx_t_22 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2654
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 *                 i += 1             # <<<<<<<<<<<<<<
 *             j += 1
 *         elif left[i] > rval:
 */
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/src/generated.pyx":2655
 *                 indexer[i] = j
 *                 i += 1
 *             j += 1             # <<<<<<<<<<<<<<
 *         elif left[i] > rval:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }

    /* "pandas/src/generated.pyx":2656
 *                 i += 1
 *             j += 1
 *         elif left[i] > rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             j += 1
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_left.diminfo[0].strides)) > __pyx_v_rval);
    if (__pyx_t_15) {

      /* "pandas/src/generated.pyx":2657
 *             j += 1
 *         elif left[i] > rval:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             j += 1
 *         else:
 */
      __pyx_t_24 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2658
 *         elif left[i] > rval:
 *             indexer[i] = -1
 *             j += 1             # <<<<<<<<<<<<<<
 *         else:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":2660
 *             j += 1
 *         else:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *     return indexer
 */
      __pyx_t_25 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2661
 *         else:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *     return indexer
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __pyx_L9:;
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pandas/src/generated.pyx":2662
 *             indexer[i] = -1
 *             i += 1
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_281left_join_indexer_unique_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_281left_join_indexer_unique_int64 = {__Pyx_NAMESTR("left_join_indexer_unique_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_281left_join_indexer_unique_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_281left_join_indexer_unique_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_unique_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_unique_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_unique_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_280left_join_indexer_unique_int64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2666
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int64_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_280left_join_indexer_unique_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_nright;
  PyArrayObject *__pyx_v_indexer = 0;
  __pyx_t_5numpy_int64_t __pyx_v_rval;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indexer;
  __Pyx_Buffer __pyx_pybuffer_indexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_unique_int64", 0);
  __pyx_pybuffer_indexer.pybuffer.buf = NULL;
  __pyx_pybuffer_indexer.refcount = 0;
  __pyx_pybuffernd_indexer.data = NULL;
  __pyx_pybuffernd_indexer.rcbuffer = &__pyx_pybuffer_indexer;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2673
 *         int64_t lval, rval
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     nleft = len(left)
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2674
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     nleft = len(left)
 *     nright = len(right)
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2675
 *     i = 0
 *     j = 0
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2676
 *     j = 0
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2678
 *     nright = len(right)
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     while True:
 *         if i == nleft:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nleft); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_8 < 0)) {
      PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
    }
    __pyx_pybuffernd_indexer.diminfo[0].strides = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indexer.diminfo[0].shape = __pyx_pybuffernd_indexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_7 = 0;
  __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":2679
 * 
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:             # <<<<<<<<<<<<<<
 *         if i == nleft:
 *             break
 */
  while (1) {
    if (!1) break;

    /* "pandas/src/generated.pyx":2680
 *     indexer = np.empty(nleft, dtype=np.int64)
 *     while True:
 *         if i == nleft:             # <<<<<<<<<<<<<<
 *             break
 * 
 */
    __pyx_t_12 = (__pyx_v_i == __pyx_v_nleft);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2681
 *     while True:
 *         if i == nleft:
 *             break             # <<<<<<<<<<<<<<
 * 
 *         if j == nright:
 */
      goto __pyx_L4_break;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "pandas/src/generated.pyx":2683
 *             break
 * 
 *         if j == nright:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             i += 1
 */
    __pyx_t_12 = (__pyx_v_j == __pyx_v_nright);
    if (__pyx_t_12) {

      /* "pandas/src/generated.pyx":2684
 * 
 *         if j == nright:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *             continue
 */
      __pyx_t_1 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2685
 *         if j == nright:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2686
 *             indexer[i] = -1
 *             i += 1
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         rval = right[j]
 */
      goto __pyx_L3_continue;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "pandas/src/generated.pyx":2688
 *             continue
 * 
 *         rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *         while i < nleft - 1 and left[i] == rval:
 */
    __pyx_t_13 = __pyx_v_j;
    __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_right.diminfo[0].strides));

    /* "pandas/src/generated.pyx":2690
 *         rval = right[j]
 * 
 *         while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    while (1) {
      __pyx_t_12 = (__pyx_v_i < (__pyx_v_nleft - 1));
      if (__pyx_t_12) {
        __pyx_t_14 = __pyx_v_i;
        __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
        __pyx_t_16 = __pyx_t_15;
      } else {
        __pyx_t_16 = __pyx_t_12;
      }
      if (!__pyx_t_16) break;

      /* "pandas/src/generated.pyx":2691
 * 
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 * 
 */
      __pyx_t_17 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2692
 *         while i < nleft - 1 and left[i] == rval:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 * 
 *         if left[i] == right[j]:
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }

    /* "pandas/src/generated.pyx":2694
 *             i += 1
 * 
 *         if left[i] == right[j]:             # <<<<<<<<<<<<<<
 *             indexer[i] = j
 *             i += 1
 */
    __pyx_t_18 = __pyx_v_i;
    __pyx_t_19 = __pyx_v_j;
    __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_left.diminfo[0].strides)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_right.diminfo[0].strides)));
    if (__pyx_t_16) {

      /* "pandas/src/generated.pyx":2695
 * 
 *         if left[i] == right[j]:
 *             indexer[i] = j             # <<<<<<<<<<<<<<
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":2696
 *         if left[i] == right[j]:
 *             indexer[i] = j
 *             i += 1             # <<<<<<<<<<<<<<
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "pandas/src/generated.pyx":2697
 *             indexer[i] = j
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:             # <<<<<<<<<<<<<<
 *                 indexer[i] = j
 *                 i += 1
 */
      while (1) {
        __pyx_t_16 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_16) {
          __pyx_t_21 = __pyx_v_i;
          __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_left.diminfo[0].strides)) == __pyx_v_rval);
          __pyx_t_15 = __pyx_t_12;
        } else {
          __pyx_t_15 = __pyx_t_16;
        }
        if (!__pyx_t_15) break;

        /* "pandas/src/generated.pyx":2698
 *             i += 1
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j             # <<<<<<<<<<<<<<
 *                 i += 1
 *             j += 1
 */
        __pyx_t_22 = __pyx_v_i;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_indexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2699
 *             while i < nleft - 1 and left[i] == rval:
 *                 indexer[i] = j
 *                 i += 1             # <<<<<<<<<<<<<<
 *             j += 1
 *         elif left[i] > rval:
 */
        __pyx_v_i = (__pyx_v_i + 1);
      }

      /* "pandas/src/generated.pyx":2700
 *                 indexer[i] = j
 *                 i += 1
 *             j += 1             # <<<<<<<<<<<<<<
 *         elif left[i] > rval:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }

    /* "pandas/src/generated.pyx":2701
 *                 i += 1
 *             j += 1
 *         elif left[i] > rval:             # <<<<<<<<<<<<<<
 *             indexer[i] = -1
 *             j += 1
 */
    __pyx_t_23 = __pyx_v_i;
    __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_left.diminfo[0].strides)) > __pyx_v_rval);
    if (__pyx_t_15) {

      /* "pandas/src/generated.pyx":2702
 *             j += 1
 *         elif left[i] > rval:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             j += 1
 *         else:
 */
      __pyx_t_24 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2703
 *         elif left[i] > rval:
 *             indexer[i] = -1
 *             j += 1             # <<<<<<<<<<<<<<
 *         else:
 *             indexer[i] = -1
 */
      __pyx_v_j = (__pyx_v_j + 1);
      goto __pyx_L9;
    }
    /*else*/ {

      /* "pandas/src/generated.pyx":2705
 *             j += 1
 *         else:
 *             indexer[i] = -1             # <<<<<<<<<<<<<<
 *             i += 1
 *     return indexer
 */
      __pyx_t_25 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indexer.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_indexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":2706
 *         else:
 *             indexer[i] = -1
 *             i += 1             # <<<<<<<<<<<<<<
 *     return indexer
 * 
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __pyx_L9:;
    __pyx_L3_continue:;
  }
  __pyx_L4_break:;

  /* "pandas/src/generated.pyx":2707
 *             indexer[i] = -1
 *             i += 1
 *     return indexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_indexer));
  __pyx_r = ((PyObject *)__pyx_v_indexer);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_unique_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_indexer);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_283left_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_282left_join_indexer_float64[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_283left_join_indexer_float64 = {__Pyx_NAMESTR("left_join_indexer_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_283left_join_indexer_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_282left_join_indexer_float64)};
static PyObject *__pyx_pw_6pandas_5algos_283left_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_282left_join_indexer_float64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2711
 * 
 * 
 * def left_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_282left_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_float64_t __pyx_v_lval;
  __pyx_t_5numpy_float64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_float64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2722
 *         ndarray[float64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2723
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2725
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2726
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2727
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2728
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2729
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_2) break;

      /* "pandas/src/generated.pyx":2730
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2731
 *         while i < nleft:
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":2732
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":2734
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_1 < 0) {
        __pyx_t_1 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2735
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_4 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_4 < 0) {
        __pyx_t_4 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2735; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2737
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2738
 * 
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2739
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":2740
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_5 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_5 < 0) {
              __pyx_t_5 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_5 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_2;
          }
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":2741
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L9;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2743
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2744
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_8 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_8 < 0) {
              __pyx_t_8 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_7) {

              /* "pandas/src/generated.pyx":2745
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L10;
            }
            __pyx_L10:;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }

        /* "pandas/src/generated.pyx":2746
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":2747
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":2748
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_9 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_9 < 0) {
            __pyx_t_9 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":2749
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":2752
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "pandas/src/generated.pyx":2753
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_7 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2754
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2755
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2757
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L7:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2761
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)
 */
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2761; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "pandas/src/generated.pyx":2762
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.float64)
 * 
 */
  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":2763
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__float64); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_11);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "pandas/src/generated.pyx":2765
 *     result = np.empty(count, dtype=np.float64)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2766
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2767
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2768
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_7 = (__pyx_v_nleft > 0);
  if (__pyx_t_7) {

    /* "pandas/src/generated.pyx":2769
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
    while (1) {
      __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_7) break;

      /* "pandas/src/generated.pyx":2770
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_7 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2771
 *         while i < nleft:
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_7) break;

          /* "pandas/src/generated.pyx":2772
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_20 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":2773
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     i += 1
 */
          __pyx_t_21 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":2774
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     i += 1
 *                     count += 1
 */
          __pyx_t_22 = __pyx_v_i;
          __pyx_t_3 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_left.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_23 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":2775
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     i += 1             # <<<<<<<<<<<<<<
 *                     count += 1
 *                 break
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "pandas/src/generated.pyx":2776
 *                     result[count] = left[i]
 *                     i += 1
 *                     count += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_count = (__pyx_v_count + 1);
        }

        /* "pandas/src/generated.pyx":2777
 *                     i += 1
 *                     count += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L14_break;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/src/generated.pyx":2779
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2780
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2782
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_7 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2783
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_26 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":2784
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_27 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2785
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_28 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":2786
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2787
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_7 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":2788
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_7) {
            __pyx_t_29 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_29 < 0) {
              __pyx_t_29 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_2;
          } else {
            __pyx_t_6 = __pyx_t_7;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":2789
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2791
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2792
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_30 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":2793
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":2794
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":2795
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":2796
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_31 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_31 < 0) {
            __pyx_t_31 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":2797
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":2800
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L14_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":2801
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":2802
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 */
        __pyx_t_32 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_32 < 0) {
          __pyx_t_32 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":2803
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = left[i]
 *                 count += 1
 */
        __pyx_t_33 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_33 < 0) {
          __pyx_t_33 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_33 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":2804
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = left[i]             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_34 < 0) {
          __pyx_t_34 += __pyx_pybuffernd_left.diminfo[0].shape;
          if (unlikely(__pyx_t_34 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_35 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_35 < 0) {
          __pyx_t_35 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_35 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

        /* "pandas/src/generated.pyx":2805
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2806
 *                 result[count] = left[i]
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2808
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L14_break:;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "pandas/src/generated.pyx":2810
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_285left_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_284left_join_indexer_object[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_285left_join_indexer_object = {__Pyx_NAMESTR("left_join_indexer_object"), (PyCFunction)__pyx_pw_6pandas_5algos_285left_join_indexer_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_284left_join_indexer_object)};
static PyObject *__pyx_pw_6pandas_5algos_285left_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_284left_join_indexer_object(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2813
 * 
 * 
 * def left_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_284left_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_v_lval = 0;
  PyObject *__pyx_v_rval = 0;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  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;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  PyObject **__pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_object", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2824
 *         ndarray[object] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2825
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2827
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2828
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2829
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2830
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2831
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_2) break;

      /* "pandas/src/generated.pyx":2832
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2833
 *         while i < nleft:
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":2834
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":2836
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_1 < 0) {
        __pyx_t_1 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_1 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pandas/src/generated.pyx":2837
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_5 = __pyx_v_j;
      __pyx_t_4 = -1;
      if (__pyx_t_5 < 0) {
        __pyx_t_5 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pandas/src/generated.pyx":2839
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2840
 * 
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2841
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":2842
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_6 = (__pyx_v_j + 1);
            __pyx_t_4 = -1;
            if (__pyx_t_6 < 0) {
              __pyx_t_6 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 0;
            } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
            if (unlikely(__pyx_t_4 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_4);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_3);
            __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_9 = __pyx_t_8;
          } else {
            __pyx_t_9 = __pyx_t_2;
          }
          if (__pyx_t_9) {

            /* "pandas/src/generated.pyx":2843
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L9;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2845
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2846
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_10 = __pyx_v_i;
            __pyx_t_4 = -1;
            if (__pyx_t_10 < 0) {
              __pyx_t_10 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 0;
            } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
            if (unlikely(__pyx_t_4 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_4);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_7);
            __pyx_t_3 = PyObject_RichCompare(__pyx_t_7, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2846; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (__pyx_t_9) {

              /* "pandas/src/generated.pyx":2847
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L10;
            }
            __pyx_L10:;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }

        /* "pandas/src/generated.pyx":2848
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_9 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_9) {

          /* "pandas/src/generated.pyx":2849
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":2850
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_11 = __pyx_v_j;
          __pyx_t_4 = -1;
          if (__pyx_t_11 < 0) {
            __pyx_t_11 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_7 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (__pyx_t_9) {

            /* "pandas/src/generated.pyx":2851
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":2854
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "pandas/src/generated.pyx":2855
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_9) {

        /* "pandas/src/generated.pyx":2856
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2857
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2859
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L7:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2863
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2863; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "pandas/src/generated.pyx":2864
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=object)
 * 
 */
  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":2865
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_7 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_4 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pandas/src/generated.pyx":2867
 *     result = np.empty(count, dtype=object)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2868
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2869
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2870
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_9 = (__pyx_v_nleft > 0);
  if (__pyx_t_9) {

    /* "pandas/src/generated.pyx":2871
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
    while (1) {
      __pyx_t_9 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_9) break;

      /* "pandas/src/generated.pyx":2872
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_9 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_9) {

        /* "pandas/src/generated.pyx":2873
 *         while i < nleft:
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_9 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_9) break;

          /* "pandas/src/generated.pyx":2874
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_20 = __pyx_v_count;
          __pyx_t_4 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":2875
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     i += 1
 */
          __pyx_t_21 = __pyx_v_count;
          __pyx_t_4 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":2876
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     i += 1
 *                     count += 1
 */
          __pyx_t_22 = __pyx_v_i;
          __pyx_t_4 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_left.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_7);
          __pyx_t_23 = __pyx_v_count;
          __pyx_t_4 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_24 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_24);
          __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(*__pyx_t_24);
          *__pyx_t_24 = __pyx_t_7;
          __Pyx_GIVEREF(*__pyx_t_24);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "pandas/src/generated.pyx":2877
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     i += 1             # <<<<<<<<<<<<<<
 *                     count += 1
 *                 break
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "pandas/src/generated.pyx":2878
 *                     result[count] = left[i]
 *                     i += 1
 *                     count += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_count = (__pyx_v_count + 1);
        }

        /* "pandas/src/generated.pyx":2879
 *                     i += 1
 *                     count += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L14_break;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/src/generated.pyx":2881
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_25 = __pyx_v_i;
      __pyx_t_4 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_7);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pandas/src/generated.pyx":2882
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_26 = __pyx_v_j;
      __pyx_t_4 = -1;
      if (__pyx_t_26 < 0) {
        __pyx_t_26 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_26 < 0)) __pyx_t_4 = 0;
      } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
      if (unlikely(__pyx_t_4 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_4);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2882; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_7);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "pandas/src/generated.pyx":2884
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_7 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_9) {

        /* "pandas/src/generated.pyx":2885
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_27 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":2886
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_28 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2887
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_29 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_29 < 0) {
          __pyx_t_29 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_29 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2887; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_24 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_24);
        __Pyx_INCREF(__pyx_v_lval); __Pyx_DECREF(*__pyx_t_24);
        *__pyx_t_24 = __pyx_v_lval;
        __Pyx_GIVEREF(*__pyx_t_24);

        /* "pandas/src/generated.pyx":2888
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2889
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_9 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_9) {

          /* "pandas/src/generated.pyx":2890
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_9 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_9) {
            __pyx_t_30 = (__pyx_v_j + 1);
            __pyx_t_4 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_4 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
            if (unlikely(__pyx_t_4 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_4);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_7);
            __pyx_t_13 = PyObject_RichCompare(__pyx_t_7, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_8 = __pyx_t_2;
          } else {
            __pyx_t_8 = __pyx_t_9;
          }
          if (__pyx_t_8) {

            /* "pandas/src/generated.pyx":2891
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2893
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2894
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_31 = __pyx_v_i;
            __pyx_t_4 = -1;
            if (__pyx_t_31 < 0) {
              __pyx_t_31 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_31 < 0)) __pyx_t_4 = 0;
            } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
            if (unlikely(__pyx_t_4 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_4);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_13 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_13);
            __pyx_t_7 = PyObject_RichCompare(__pyx_t_13, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            if (__pyx_t_8) {

              /* "pandas/src/generated.pyx":2895
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":2896
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_8 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":2897
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":2898
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_32 = __pyx_v_j;
          __pyx_t_4 = -1;
          if (__pyx_t_32 < 0) {
            __pyx_t_32 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_32 < 0)) __pyx_t_4 = 0;
          } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_4 = 0;
          if (unlikely(__pyx_t_4 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_4);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_7);
          __pyx_t_13 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (__pyx_t_8) {

            /* "pandas/src/generated.pyx":2899
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":2902
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L14_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":2903
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_13 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (__pyx_t_8) {

        /* "pandas/src/generated.pyx":2904
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 */
        __pyx_t_33 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_33 < 0) {
          __pyx_t_33 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_33 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":2905
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = left[i]
 *                 count += 1
 */
        __pyx_t_34 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_34 < 0) {
          __pyx_t_34 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_34 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":2906
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = left[i]             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_35 = __pyx_v_i;
        __pyx_t_4 = -1;
        if (__pyx_t_35 < 0) {
          __pyx_t_35 += __pyx_pybuffernd_left.diminfo[0].shape;
          if (unlikely(__pyx_t_35 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_13 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_left.diminfo[0].strides);
        __Pyx_INCREF((PyObject*)__pyx_t_13);
        __pyx_t_36 = __pyx_v_count;
        __pyx_t_4 = -1;
        if (__pyx_t_36 < 0) {
          __pyx_t_36 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_36 < 0)) __pyx_t_4 = 0;
        } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_4 = 0;
        if (unlikely(__pyx_t_4 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_4);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_24 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_24);
        __Pyx_INCREF(__pyx_t_13); __Pyx_DECREF(*__pyx_t_24);
        *__pyx_t_24 = __pyx_t_13;
        __Pyx_GIVEREF(*__pyx_t_24);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

        /* "pandas/src/generated.pyx":2907
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2908
 *                 result[count] = left[i]
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2910
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L14_break:;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "pandas/src/generated.pyx":2912
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2912; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_13, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_13);
  __pyx_t_13 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_lval);
  __Pyx_XDECREF(__pyx_v_rval);
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_287left_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_286left_join_indexer_int32[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_287left_join_indexer_int32 = {__Pyx_NAMESTR("left_join_indexer_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_287left_join_indexer_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_286left_join_indexer_int32)};
static PyObject *__pyx_pw_6pandas_5algos_287left_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2916; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_286left_join_indexer_int32(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":2915
 * 
 * 
 * def left_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_286left_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int32_t __pyx_v_lval;
  __pyx_t_5numpy_int32_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_int32", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":2926
 *         ndarray[int32_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":2927
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":2929
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2930
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2931
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2932
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":2933
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_2) break;

      /* "pandas/src/generated.pyx":2934
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2935
 *         while i < nleft:
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":2936
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":2938
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_1 < 0) {
        __pyx_t_1 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2939
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_4 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_4 < 0) {
        __pyx_t_4 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2941
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":2942
 * 
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2943
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":2944
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_5 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_5 < 0) {
              __pyx_t_5 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_5 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_2;
          }
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":2945
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L9;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2947
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2948
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_8 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_8 < 0) {
              __pyx_t_8 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_7) {

              /* "pandas/src/generated.pyx":2949
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L10;
            }
            __pyx_L10:;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }

        /* "pandas/src/generated.pyx":2950
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":2951
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":2952
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_9 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_9 < 0) {
            __pyx_t_9 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":2953
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":2956
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "pandas/src/generated.pyx":2957
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_7 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2958
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2959
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":2961
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L7:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":2965
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)
 */
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "pandas/src/generated.pyx":2966
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int32)
 * 
 */
  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":2967
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int32); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_11);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "pandas/src/generated.pyx":2969
 *     result = np.empty(count, dtype=np.int32)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":2970
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":2971
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":2972
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_7 = (__pyx_v_nleft > 0);
  if (__pyx_t_7) {

    /* "pandas/src/generated.pyx":2973
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
    while (1) {
      __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_7) break;

      /* "pandas/src/generated.pyx":2974
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_7 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2975
 *         while i < nleft:
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_7) break;

          /* "pandas/src/generated.pyx":2976
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_20 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":2977
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     i += 1
 */
          __pyx_t_21 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":2978
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     i += 1
 *                     count += 1
 */
          __pyx_t_22 = __pyx_v_i;
          __pyx_t_3 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_left.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_23 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":2979
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     i += 1             # <<<<<<<<<<<<<<
 *                     count += 1
 *                 break
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "pandas/src/generated.pyx":2980
 *                     result[count] = left[i]
 *                     i += 1
 *                     count += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_count = (__pyx_v_count + 1);
        }

        /* "pandas/src/generated.pyx":2981
 *                     i += 1
 *                     count += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L14_break;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/src/generated.pyx":2983
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2983; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2984
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":2986
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_7 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":2987
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_26 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":2988
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_27 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":2989
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_28 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2989; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":2990
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":2991
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_7 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":2992
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_7) {
            __pyx_t_29 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_29 < 0) {
              __pyx_t_29 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_2;
          } else {
            __pyx_t_6 = __pyx_t_7;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":2993
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":2995
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":2996
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_30 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2996; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":2997
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":2998
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":2999
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3000
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_31 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_31 < 0) {
            __pyx_t_31 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3001
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3004
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L14_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":3005
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3006
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 */
        __pyx_t_32 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_32 < 0) {
          __pyx_t_32 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3007
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = left[i]
 *                 count += 1
 */
        __pyx_t_33 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_33 < 0) {
          __pyx_t_33 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_33 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3008
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = left[i]             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_34 < 0) {
          __pyx_t_34 += __pyx_pybuffernd_left.diminfo[0].shape;
          if (unlikely(__pyx_t_34 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_35 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_35 < 0) {
          __pyx_t_35 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_35 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

        /* "pandas/src/generated.pyx":3009
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3010
 *                 result[count] = left[i]
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3012
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L14_break:;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "pandas/src/generated.pyx":3014
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_289left_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_288left_join_indexer_int64[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_289left_join_indexer_int64 = {__Pyx_NAMESTR("left_join_indexer_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_289left_join_indexer_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_288left_join_indexer_int64)};
static PyObject *__pyx_pw_6pandas_5algos_289left_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("left_join_indexer_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("left_join_indexer_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "left_join_indexer_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("left_join_indexer_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_288left_join_indexer_int64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3017
 * 
 * 
 * def left_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_288left_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int64_t __pyx_v_lval;
  __pyx_t_5numpy_int64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("left_join_indexer_int64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3028
 *         ndarray[int64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3029
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3031
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3032
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3033
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3034
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3035
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
    while (1) {
      __pyx_t_2 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_2) break;

      /* "pandas/src/generated.pyx":3036
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3037
 *         while i < nleft:
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":3038
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3040
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_1 < 0) {
        __pyx_t_1 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3041
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_4 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_4 < 0) {
        __pyx_t_4 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3041; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3043
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3044
 * 
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3045
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3046
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_5 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_5 < 0) {
              __pyx_t_5 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_5 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_7 = __pyx_t_6;
          } else {
            __pyx_t_7 = __pyx_t_2;
          }
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":3047
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L9;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3049
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3050
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_8 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_8 < 0) {
              __pyx_t_8 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_7) {

              /* "pandas/src/generated.pyx":3051
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L10;
            }
            __pyx_L10:;
          }
          __pyx_L9:;
          goto __pyx_L8;
        }

        /* "pandas/src/generated.pyx":3052
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":3053
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3054
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_9 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_9 < 0) {
            __pyx_t_9 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_7 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":3055
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L11;
          }
          __pyx_L11:;
          goto __pyx_L8;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3058
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L8:;
        goto __pyx_L7;
      }

      /* "pandas/src/generated.pyx":3059
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_7 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":3060
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3061
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L7;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3063
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L7:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3067
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)
 */
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__int64); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "pandas/src/generated.pyx":3068
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_14));
  __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3068; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_15 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3069
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_12), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_11);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "pandas/src/generated.pyx":3071
 *     result = np.empty(count, dtype=np.int64)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3072
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3073
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0:
 *         while i < nleft:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3074
 *     j = 0
 *     count = 0
 *     if nleft > 0:             # <<<<<<<<<<<<<<
 *         while i < nleft:
 *             if j == nright:
 */
  __pyx_t_7 = (__pyx_v_nleft > 0);
  if (__pyx_t_7) {

    /* "pandas/src/generated.pyx":3075
 *     count = 0
 *     if nleft > 0:
 *         while i < nleft:             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
    while (1) {
      __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
      if (!__pyx_t_7) break;

      /* "pandas/src/generated.pyx":3076
 *     if nleft > 0:
 *         while i < nleft:
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_7 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":3077
 *         while i < nleft:
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_7 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_7) break;

          /* "pandas/src/generated.pyx":3078
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_20 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_20 < 0) {
            __pyx_t_20 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_20 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":3079
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     i += 1
 */
          __pyx_t_21 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_21 < 0) {
            __pyx_t_21 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
            if (unlikely(__pyx_t_21 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3079; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3080
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     i += 1
 *                     count += 1
 */
          __pyx_t_22 = __pyx_v_i;
          __pyx_t_3 = -1;
          if (__pyx_t_22 < 0) {
            __pyx_t_22 += __pyx_pybuffernd_left.diminfo[0].shape;
            if (unlikely(__pyx_t_22 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_23 = __pyx_v_count;
          __pyx_t_3 = -1;
          if (__pyx_t_23 < 0) {
            __pyx_t_23 += __pyx_pybuffernd_result.diminfo[0].shape;
            if (unlikely(__pyx_t_23 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3081
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     i += 1             # <<<<<<<<<<<<<<
 *                     count += 1
 *                 break
 */
          __pyx_v_i = (__pyx_v_i + 1);

          /* "pandas/src/generated.pyx":3082
 *                     result[count] = left[i]
 *                     i += 1
 *                     count += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_count = (__pyx_v_count + 1);
        }

        /* "pandas/src/generated.pyx":3083
 *                     i += 1
 *                     count += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L14_break;
        goto __pyx_L15;
      }
      __pyx_L15:;

      /* "pandas/src/generated.pyx":3085
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_24 = __pyx_v_i;
      __pyx_t_3 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_pybuffernd_left.diminfo[0].shape;
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3086
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_3 = -1;
      if (__pyx_t_25 < 0) {
        __pyx_t_25 += __pyx_pybuffernd_right.diminfo[0].shape;
        if (unlikely(__pyx_t_25 < 0)) __pyx_t_3 = 0;
      } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
      if (unlikely(__pyx_t_3 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_3);
        {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3088
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_7 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":3089
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_26 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_26 < 0) {
          __pyx_t_26 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_26 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3090
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_27 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_27 < 0) {
          __pyx_t_27 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_27 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3090; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3091
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_28 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_28 < 0) {
          __pyx_t_28 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_28 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3092
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3093
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_7 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":3094
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_7) {
            __pyx_t_29 = (__pyx_v_j + 1);
            __pyx_t_3 = -1;
            if (__pyx_t_29 < 0) {
              __pyx_t_29 += __pyx_pybuffernd_right.diminfo[0].shape;
              if (unlikely(__pyx_t_29 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_2;
          } else {
            __pyx_t_6 = __pyx_t_7;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3095
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3097
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3098
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_30 = __pyx_v_i;
            __pyx_t_3 = -1;
            if (__pyx_t_30 < 0) {
              __pyx_t_30 += __pyx_pybuffernd_left.diminfo[0].shape;
              if (unlikely(__pyx_t_30 < 0)) __pyx_t_3 = 0;
            } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
            if (unlikely(__pyx_t_3 != -1)) {
              __Pyx_RaiseBufferIndexError(__pyx_t_3);
              {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":3099
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":3100
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3101
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3102
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_31 = __pyx_v_j;
          __pyx_t_3 = -1;
          if (__pyx_t_31 < 0) {
            __pyx_t_31 += __pyx_pybuffernd_right.diminfo[0].shape;
            if (unlikely(__pyx_t_31 < 0)) __pyx_t_3 = 0;
          } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_right.diminfo[0].shape)) __pyx_t_3 = 0;
          if (unlikely(__pyx_t_3 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_3);
            {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3103
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3106
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L14_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":3107
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3108
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 */
        __pyx_t_32 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_32 < 0) {
          __pyx_t_32 += __pyx_pybuffernd_lindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_32 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_lindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3109
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = left[i]
 *                 count += 1
 */
        __pyx_t_33 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_33 < 0) {
          __pyx_t_33 += __pyx_pybuffernd_rindexer.diminfo[0].shape;
          if (unlikely(__pyx_t_33 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_rindexer.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3110
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = left[i]             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_34 = __pyx_v_i;
        __pyx_t_3 = -1;
        if (__pyx_t_34 < 0) {
          __pyx_t_34 += __pyx_pybuffernd_left.diminfo[0].shape;
          if (unlikely(__pyx_t_34 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_left.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_35 = __pyx_v_count;
        __pyx_t_3 = -1;
        if (__pyx_t_35 < 0) {
          __pyx_t_35 += __pyx_pybuffernd_result.diminfo[0].shape;
          if (unlikely(__pyx_t_35 < 0)) __pyx_t_3 = 0;
        } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_result.diminfo[0].shape)) __pyx_t_3 = 0;
        if (unlikely(__pyx_t_3 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_3);
          {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

        /* "pandas/src/generated.pyx":3111
 *                 rindexer[count] = -1
 *                 result[count] = left[i]
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3112
 *                 result[count] = left[i]
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3114
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L14_break:;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "pandas/src/generated.pyx":3116
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_11);
  __pyx_t_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.left_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_291outer_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_291outer_join_indexer_float64 = {__Pyx_NAMESTR("outer_join_indexer_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_291outer_join_indexer_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_291outer_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outer_join_indexer_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outer_join_indexer_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outer_join_indexer_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outer_join_indexer_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_290outer_join_indexer_float64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3121
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[float64_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_290outer_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_float64_t __pyx_v_lval;
  __pyx_t_5numpy_float64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outer_join_indexer_float64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3129
 *         ndarray[float64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3130
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3132
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3133
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3134
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         count = nright
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3135
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         count = nright
 *     elif nright == 0:
 */
  __pyx_t_2 = (__pyx_v_nleft == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3136
 *     count = 0
 *     if nleft == 0:
 *         count = nright             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         count = nleft
 */
    __pyx_v_count = __pyx_v_nright;
    goto __pyx_L3;
  }

  /* "pandas/src/generated.pyx":3137
 *     if nleft == 0:
 *         count = nright
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         count = nleft
 *     else:
 */
  __pyx_t_2 = (__pyx_v_nright == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3138
 *         count = nright
 *     elif nright == 0:
 *         count = nleft             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
    __pyx_v_count = __pyx_v_nleft;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3140
 *         count = nleft
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 count += nright - j
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3141
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 count += nright - j
 *                 break
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3142
 *         while True:
 *             if i == nleft:
 *                 count += nright - j             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nright - __pyx_v_j));

        /* "pandas/src/generated.pyx":3143
 *             if i == nleft:
 *                 count += nright - j
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3144
 *                 count += nright - j
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3145
 *                 break
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":3146
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3148
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3149
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_3 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3150
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3151
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3152
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3153
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_4 = (__pyx_v_j + 1);
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_5;
          } else {
            __pyx_t_6 = __pyx_t_2;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3154
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3156
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3157
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":3158
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3159
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3160
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3161
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3162
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3165
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3166
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3167
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3168
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 count += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3170
 *                 i += 1
 *             else:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3171
 *             else:
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3173
 *                 j += 1
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3174
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.float64)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3175
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     # do it again, but populate the indexers / result
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3179
 *     # do it again, but populate the indexers / result
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3180
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3181
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         for j in range(nright):
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3182
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         for j in range(nright):
 *             lindexer[j] = -1
 */
  __pyx_t_6 = (__pyx_v_nleft == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3183
 *     count = 0
 *     if nleft == 0:
 *         for j in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[j] = -1
 *             rindexer[j] = j
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;

      /* "pandas/src/generated.pyx":3184
 *     if nleft == 0:
 *         for j in range(nright):
 *             lindexer[j] = -1             # <<<<<<<<<<<<<<
 *             rindexer[j] = j
 *             result[j] = right[j]
 */
      __pyx_t_22 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3185
 *         for j in range(nright):
 *             lindexer[j] = -1
 *             rindexer[j] = j             # <<<<<<<<<<<<<<
 *             result[j] = right[j]
 *     elif nright == 0:
 */
      __pyx_t_23 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":3186
 *             lindexer[j] = -1
 *             rindexer[j] = j
 *             result[j] = right[j]             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         for i in range(nright):
 */
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_25 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_right.diminfo[0].strides));
    }
    goto __pyx_L13;
  }

  /* "pandas/src/generated.pyx":3187
 *             rindexer[j] = j
 *             result[j] = right[j]
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         for i in range(nright):
 *             lindexer[i] = i
 */
  __pyx_t_6 = (__pyx_v_nright == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3188
 *             result[j] = right[j]
 *     elif nright == 0:
 *         for i in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[i] = i
 *             rindexer[i] = -1
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_i = __pyx_t_21;

      /* "pandas/src/generated.pyx":3189
 *     elif nright == 0:
 *         for i in range(nright):
 *             lindexer[i] = i             # <<<<<<<<<<<<<<
 *             rindexer[i] = -1
 *             result[i] = left[i]
 */
      __pyx_t_26 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

      /* "pandas/src/generated.pyx":3190
 *         for i in range(nright):
 *             lindexer[i] = i
 *             rindexer[i] = -1             # <<<<<<<<<<<<<<
 *             result[i] = left[i]
 *     else:
 */
      __pyx_t_27 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3191
 *             lindexer[i] = i
 *             rindexer[i] = -1
 *             result[i] = left[i]             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
      __pyx_t_28 = __pyx_v_i;
      __pyx_t_29 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_left.diminfo[0].strides));
    }
    goto __pyx_L13;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3193
 *             result[i] = left[i]
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 while j < nright:
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3194
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 while j < nright:
 *                     lindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3195
 *         while True:
 *             if i == nleft:
 *                 while j < nright:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_j < __pyx_v_nright);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3196
 *             if i == nleft:
 *                 while j < nright:
 *                     lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 */
          __pyx_t_20 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3197
 *                 while j < nright:
 *                     lindexer[count] = -1
 *                     rindexer[count] = j             # <<<<<<<<<<<<<<
 *                     result[count] = right[j]
 *                     count += 1
 */
          __pyx_t_21 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

          /* "pandas/src/generated.pyx":3198
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 *                     result[count] = right[j]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     j += 1
 */
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3199
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     j += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3200
 *                     result[count] = right[j]
 *                     count += 1
 *                     j += 1             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
          __pyx_v_j = (__pyx_v_j + 1);
        }

        /* "pandas/src/generated.pyx":3201
 *                     count += 1
 *                     j += 1
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
        goto __pyx_L19_break;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "pandas/src/generated.pyx":3202
 *                     j += 1
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_6 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3203
 *                 break
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3204
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_32 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":3205
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     count += 1
 */
          __pyx_t_33 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3206
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     i += 1
 */
          __pyx_t_34 = __pyx_v_i;
          __pyx_t_35 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3207
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     i += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3208
 *                     result[count] = left[i]
 *                     count += 1
 *                     i += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }

        /* "pandas/src/generated.pyx":3209
 *                     count += 1
 *                     i += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L19_break;
        goto __pyx_L23;
      }
      __pyx_L23:;

      /* "pandas/src/generated.pyx":3211
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3212
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_37 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3214
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_6 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3215
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_38 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3216
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_39 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3217
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_40 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3218
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3219
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_6 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3220
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_6) {
            __pyx_t_41 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_5 = __pyx_t_2;
          } else {
            __pyx_t_5 = __pyx_t_6;
          }
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3221
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L28;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3223
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3224
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_5) {

              /* "pandas/src/generated.pyx":3225
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L29;
            }
            __pyx_L29:;
          }
          __pyx_L28:;
          goto __pyx_L27;
        }

        /* "pandas/src/generated.pyx":3226
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_5 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_5) {

          /* "pandas/src/generated.pyx":3227
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3228
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_43 = __pyx_v_j;
          __pyx_t_5 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3229
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L30;
          }
          __pyx_L30:;
          goto __pyx_L27;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3232
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L19_break;
        }
        __pyx_L27:;
        goto __pyx_L26;
      }

      /* "pandas/src/generated.pyx":3233
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_5 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_5) {

        /* "pandas/src/generated.pyx":3234
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = lval
 */
        __pyx_t_44 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3235
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_45 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3236
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_46 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3237
 *                 rindexer[count] = -1
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3238
 *                 result[count] = lval
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 lindexer[count] = -1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L26;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3240
 *                 i += 1
 *             else:
 *                 lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_47 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3241
 *             else:
 *                 lindexer[count] = -1
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_48 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3242
 *                 lindexer[count] = -1
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 j += 1
 */
        __pyx_t_49 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3243
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3244
 *                 result[count] = rval
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L26:;
    }
    __pyx_L19_break:;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3246
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_293outer_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_293outer_join_indexer_object = {__Pyx_NAMESTR("outer_join_indexer_object"), (PyCFunction)__pyx_pw_6pandas_5algos_293outer_join_indexer_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_293outer_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outer_join_indexer_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outer_join_indexer_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outer_join_indexer_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outer_join_indexer_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_292outer_join_indexer_object(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3250
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[object] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_292outer_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_v_lval = 0;
  PyObject *__pyx_v_rval = 0;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  PyObject **__pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outer_join_indexer_object", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3258
 *         ndarray[object] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3259
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3261
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3262
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3263
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         count = nright
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3264
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         count = nright
 *     elif nright == 0:
 */
  __pyx_t_2 = (__pyx_v_nleft == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3265
 *     count = 0
 *     if nleft == 0:
 *         count = nright             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         count = nleft
 */
    __pyx_v_count = __pyx_v_nright;
    goto __pyx_L3;
  }

  /* "pandas/src/generated.pyx":3266
 *     if nleft == 0:
 *         count = nright
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         count = nleft
 *     else:
 */
  __pyx_t_2 = (__pyx_v_nright == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3267
 *         count = nright
 *     elif nright == 0:
 *         count = nleft             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
    __pyx_v_count = __pyx_v_nleft;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3269
 *         count = nleft
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 count += nright - j
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3270
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 count += nright - j
 *                 break
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3271
 *         while True:
 *             if i == nleft:
 *                 count += nright - j             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nright - __pyx_v_j));

        /* "pandas/src/generated.pyx":3272
 *             if i == nleft:
 *                 count += nright - j
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3273
 *                 count += nright - j
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3274
 *                 break
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":3275
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3277
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pandas/src/generated.pyx":3278
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_4 = __pyx_v_j;
      __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "pandas/src/generated.pyx":3279
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3280
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3281
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3282
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_5 = (__pyx_v_j + 1);
            __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_3);
            __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_8 = __pyx_t_7;
          } else {
            __pyx_t_8 = __pyx_t_2;
          }
          if (__pyx_t_8) {

            /* "pandas/src/generated.pyx":3283
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3285
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3286
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_9 = __pyx_v_i;
            __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_6);
            __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (__pyx_t_8) {

              /* "pandas/src/generated.pyx":3287
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3288
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_8 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":3289
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3290
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_10 = __pyx_v_j;
          __pyx_t_3 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_3);
          __pyx_t_6 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (__pyx_t_8) {

            /* "pandas/src/generated.pyx":3291
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3294
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3295
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_8) {

        /* "pandas/src/generated.pyx":3296
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3297
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 count += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3299
 *                 i += 1
 *             else:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3300
 *             else:
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3302
 *                 j += 1
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3303
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=object)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3304
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     # do it again, but populate the indexers / result
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "pandas/src/generated.pyx":3308
 *     # do it again, but populate the indexers / result
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3309
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3310
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         for j in range(nright):
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3311
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         for j in range(nright):
 *             lindexer[j] = -1
 */
  __pyx_t_8 = (__pyx_v_nleft == 0);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":3312
 *     count = 0
 *     if nleft == 0:
 *         for j in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[j] = -1
 *             rindexer[j] = j
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;

      /* "pandas/src/generated.pyx":3313
 *     if nleft == 0:
 *         for j in range(nright):
 *             lindexer[j] = -1             # <<<<<<<<<<<<<<
 *             rindexer[j] = j
 *             result[j] = right[j]
 */
      __pyx_t_22 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3314
 *         for j in range(nright):
 *             lindexer[j] = -1
 *             rindexer[j] = j             # <<<<<<<<<<<<<<
 *             result[j] = right[j]
 *     elif nright == 0:
 */
      __pyx_t_23 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":3315
 *             lindexer[j] = -1
 *             rindexer[j] = j
 *             result[j] = right[j]             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         for i in range(nright):
 */
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __pyx_t_25 = __pyx_v_j;
      __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_result.diminfo[0].strides);
      __Pyx_GOTREF(*__pyx_t_26);
      __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_26);
      *__pyx_t_26 = __pyx_t_6;
      __Pyx_GIVEREF(*__pyx_t_26);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    goto __pyx_L13;
  }

  /* "pandas/src/generated.pyx":3316
 *             rindexer[j] = j
 *             result[j] = right[j]
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         for i in range(nright):
 *             lindexer[i] = i
 */
  __pyx_t_8 = (__pyx_v_nright == 0);
  if (__pyx_t_8) {

    /* "pandas/src/generated.pyx":3317
 *             result[j] = right[j]
 *     elif nright == 0:
 *         for i in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[i] = i
 *             rindexer[i] = -1
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_i = __pyx_t_21;

      /* "pandas/src/generated.pyx":3318
 *     elif nright == 0:
 *         for i in range(nright):
 *             lindexer[i] = i             # <<<<<<<<<<<<<<
 *             rindexer[i] = -1
 *             result[i] = left[i]
 */
      __pyx_t_27 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

      /* "pandas/src/generated.pyx":3319
 *         for i in range(nright):
 *             lindexer[i] = i
 *             rindexer[i] = -1             # <<<<<<<<<<<<<<
 *             result[i] = left[i]
 *     else:
 */
      __pyx_t_28 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3320
 *             lindexer[i] = i
 *             rindexer[i] = -1
 *             result[i] = left[i]             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
      __pyx_t_29 = __pyx_v_i;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __pyx_t_30 = __pyx_v_i;
      __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_result.diminfo[0].strides);
      __Pyx_GOTREF(*__pyx_t_26);
      __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_26);
      *__pyx_t_26 = __pyx_t_6;
      __Pyx_GIVEREF(*__pyx_t_26);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    goto __pyx_L13;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3322
 *             result[i] = left[i]
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 while j < nright:
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3323
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 while j < nright:
 *                     lindexer[count] = -1
 */
      __pyx_t_8 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_8) {

        /* "pandas/src/generated.pyx":3324
 *         while True:
 *             if i == nleft:
 *                 while j < nright:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 */
        while (1) {
          __pyx_t_8 = (__pyx_v_j < __pyx_v_nright);
          if (!__pyx_t_8) break;

          /* "pandas/src/generated.pyx":3325
 *             if i == nleft:
 *                 while j < nright:
 *                     lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 */
          __pyx_t_20 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3326
 *                 while j < nright:
 *                     lindexer[count] = -1
 *                     rindexer[count] = j             # <<<<<<<<<<<<<<
 *                     result[count] = right[j]
 *                     count += 1
 */
          __pyx_t_21 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

          /* "pandas/src/generated.pyx":3327
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 *                     result[count] = right[j]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     j += 1
 */
          __pyx_t_31 = __pyx_v_j;
          __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_6);
          __pyx_t_32 = __pyx_v_count;
          __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_26);
          __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_26);
          *__pyx_t_26 = __pyx_t_6;
          __Pyx_GIVEREF(*__pyx_t_26);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "pandas/src/generated.pyx":3328
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     j += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3329
 *                     result[count] = right[j]
 *                     count += 1
 *                     j += 1             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
          __pyx_v_j = (__pyx_v_j + 1);
        }

        /* "pandas/src/generated.pyx":3330
 *                     count += 1
 *                     j += 1
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
        goto __pyx_L19_break;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "pandas/src/generated.pyx":3331
 *                     j += 1
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_8 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_8) {

        /* "pandas/src/generated.pyx":3332
 *                 break
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_8 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_8) break;

          /* "pandas/src/generated.pyx":3333
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_33 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":3334
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     count += 1
 */
          __pyx_t_34 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3335
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     i += 1
 */
          __pyx_t_35 = __pyx_v_i;
          __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_left.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_6);
          __pyx_t_36 = __pyx_v_count;
          __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_result.diminfo[0].strides);
          __Pyx_GOTREF(*__pyx_t_26);
          __Pyx_INCREF(__pyx_t_6); __Pyx_DECREF(*__pyx_t_26);
          *__pyx_t_26 = __pyx_t_6;
          __Pyx_GIVEREF(*__pyx_t_26);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "pandas/src/generated.pyx":3336
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     i += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3337
 *                     result[count] = left[i]
 *                     count += 1
 *                     i += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }

        /* "pandas/src/generated.pyx":3338
 *                     count += 1
 *                     i += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L19_break;
        goto __pyx_L23;
      }
      __pyx_L23:;

      /* "pandas/src/generated.pyx":3340
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_37 = __pyx_v_i;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pandas/src/generated.pyx":3341
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_38 = __pyx_v_j;
      __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_6);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "pandas/src/generated.pyx":3343
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_8) {

        /* "pandas/src/generated.pyx":3344
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_39 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3345
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_40 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3346
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_41 = __pyx_v_count;
        __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_v_lval); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_v_lval;
        __Pyx_GIVEREF(*__pyx_t_26);

        /* "pandas/src/generated.pyx":3347
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3348
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_8 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_8) {

          /* "pandas/src/generated.pyx":3349
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_8 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_8) {
            __pyx_t_42 = (__pyx_v_j + 1);
            __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_6);
            __pyx_t_12 = PyObject_RichCompare(__pyx_t_6, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_7 = __pyx_t_2;
          } else {
            __pyx_t_7 = __pyx_t_8;
          }
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":3350
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L28;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3352
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3353
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_43 = __pyx_v_i;
            __pyx_t_12 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_12);
            __pyx_t_6 = PyObject_RichCompare(__pyx_t_12, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (__pyx_t_7) {

              /* "pandas/src/generated.pyx":3354
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L29;
            }
            __pyx_L29:;
          }
          __pyx_L28:;
          goto __pyx_L27;
        }

        /* "pandas/src/generated.pyx":3355
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_7 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_7) {

          /* "pandas/src/generated.pyx":3356
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3357
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_44 = __pyx_v_j;
          __pyx_t_6 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_6);
          __pyx_t_12 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_7) {

            /* "pandas/src/generated.pyx":3358
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L30;
          }
          __pyx_L30:;
          goto __pyx_L27;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3361
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L19_break;
        }
        __pyx_L27:;
        goto __pyx_L26;
      }

      /* "pandas/src/generated.pyx":3362
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_12 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_7) {

        /* "pandas/src/generated.pyx":3363
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = lval
 */
        __pyx_t_45 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3364
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_46 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3365
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_47 = __pyx_v_count;
        __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_v_lval); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_v_lval;
        __Pyx_GIVEREF(*__pyx_t_26);

        /* "pandas/src/generated.pyx":3366
 *                 rindexer[count] = -1
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3367
 *                 result[count] = lval
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 lindexer[count] = -1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L26;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3369
 *                 i += 1
 *             else:
 *                 lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_48 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3370
 *             else:
 *                 lindexer[count] = -1
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_49 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3371
 *                 lindexer[count] = -1
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 j += 1
 */
        __pyx_t_50 = __pyx_v_count;
        __pyx_t_26 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_26);
        __Pyx_INCREF(__pyx_v_rval); __Pyx_DECREF(*__pyx_t_26);
        *__pyx_t_26 = __pyx_v_rval;
        __Pyx_GIVEREF(*__pyx_t_26);

        /* "pandas/src/generated.pyx":3372
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3373
 *                 result[count] = rval
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L26:;
    }
    __pyx_L19_break:;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3375
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_12);
  __pyx_t_12 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_lval);
  __Pyx_XDECREF(__pyx_v_rval);
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_295outer_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_295outer_join_indexer_int32 = {__Pyx_NAMESTR("outer_join_indexer_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_295outer_join_indexer_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_295outer_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outer_join_indexer_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outer_join_indexer_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outer_join_indexer_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outer_join_indexer_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_294outer_join_indexer_int32(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3379
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int32_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_294outer_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int32_t __pyx_v_lval;
  __pyx_t_5numpy_int32_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outer_join_indexer_int32", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3387
 *         ndarray[int32_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3388
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3390
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3391
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3392
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         count = nright
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3393
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         count = nright
 *     elif nright == 0:
 */
  __pyx_t_2 = (__pyx_v_nleft == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3394
 *     count = 0
 *     if nleft == 0:
 *         count = nright             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         count = nleft
 */
    __pyx_v_count = __pyx_v_nright;
    goto __pyx_L3;
  }

  /* "pandas/src/generated.pyx":3395
 *     if nleft == 0:
 *         count = nright
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         count = nleft
 *     else:
 */
  __pyx_t_2 = (__pyx_v_nright == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3396
 *         count = nright
 *     elif nright == 0:
 *         count = nleft             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
    __pyx_v_count = __pyx_v_nleft;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3398
 *         count = nleft
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 count += nright - j
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3399
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 count += nright - j
 *                 break
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3400
 *         while True:
 *             if i == nleft:
 *                 count += nright - j             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nright - __pyx_v_j));

        /* "pandas/src/generated.pyx":3401
 *             if i == nleft:
 *                 count += nright - j
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3402
 *                 count += nright - j
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3403
 *                 break
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":3404
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3406
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3407
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_3 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3408
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3409
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3410
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3411
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_4 = (__pyx_v_j + 1);
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_5;
          } else {
            __pyx_t_6 = __pyx_t_2;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3412
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3414
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3415
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":3416
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3417
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3418
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3419
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3420
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3423
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3424
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3425
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3426
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 count += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3428
 *                 i += 1
 *             else:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3429
 *             else:
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3431
 *                 j += 1
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3432
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int32)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3433
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *     # do it again, but populate the indexers / result
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3437
 *     # do it again, but populate the indexers / result
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3438
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3439
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         for j in range(nright):
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3440
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         for j in range(nright):
 *             lindexer[j] = -1
 */
  __pyx_t_6 = (__pyx_v_nleft == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3441
 *     count = 0
 *     if nleft == 0:
 *         for j in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[j] = -1
 *             rindexer[j] = j
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;

      /* "pandas/src/generated.pyx":3442
 *     if nleft == 0:
 *         for j in range(nright):
 *             lindexer[j] = -1             # <<<<<<<<<<<<<<
 *             rindexer[j] = j
 *             result[j] = right[j]
 */
      __pyx_t_22 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3443
 *         for j in range(nright):
 *             lindexer[j] = -1
 *             rindexer[j] = j             # <<<<<<<<<<<<<<
 *             result[j] = right[j]
 *     elif nright == 0:
 */
      __pyx_t_23 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":3444
 *             lindexer[j] = -1
 *             rindexer[j] = j
 *             result[j] = right[j]             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         for i in range(nright):
 */
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_25 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_right.diminfo[0].strides));
    }
    goto __pyx_L13;
  }

  /* "pandas/src/generated.pyx":3445
 *             rindexer[j] = j
 *             result[j] = right[j]
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         for i in range(nright):
 *             lindexer[i] = i
 */
  __pyx_t_6 = (__pyx_v_nright == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3446
 *             result[j] = right[j]
 *     elif nright == 0:
 *         for i in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[i] = i
 *             rindexer[i] = -1
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_i = __pyx_t_21;

      /* "pandas/src/generated.pyx":3447
 *     elif nright == 0:
 *         for i in range(nright):
 *             lindexer[i] = i             # <<<<<<<<<<<<<<
 *             rindexer[i] = -1
 *             result[i] = left[i]
 */
      __pyx_t_26 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

      /* "pandas/src/generated.pyx":3448
 *         for i in range(nright):
 *             lindexer[i] = i
 *             rindexer[i] = -1             # <<<<<<<<<<<<<<
 *             result[i] = left[i]
 *     else:
 */
      __pyx_t_27 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3449
 *             lindexer[i] = i
 *             rindexer[i] = -1
 *             result[i] = left[i]             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
      __pyx_t_28 = __pyx_v_i;
      __pyx_t_29 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_left.diminfo[0].strides));
    }
    goto __pyx_L13;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3451
 *             result[i] = left[i]
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 while j < nright:
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3452
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 while j < nright:
 *                     lindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3453
 *         while True:
 *             if i == nleft:
 *                 while j < nright:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_j < __pyx_v_nright);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3454
 *             if i == nleft:
 *                 while j < nright:
 *                     lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 */
          __pyx_t_20 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3455
 *                 while j < nright:
 *                     lindexer[count] = -1
 *                     rindexer[count] = j             # <<<<<<<<<<<<<<
 *                     result[count] = right[j]
 *                     count += 1
 */
          __pyx_t_21 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

          /* "pandas/src/generated.pyx":3456
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 *                     result[count] = right[j]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     j += 1
 */
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3457
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     j += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3458
 *                     result[count] = right[j]
 *                     count += 1
 *                     j += 1             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
          __pyx_v_j = (__pyx_v_j + 1);
        }

        /* "pandas/src/generated.pyx":3459
 *                     count += 1
 *                     j += 1
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
        goto __pyx_L19_break;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "pandas/src/generated.pyx":3460
 *                     j += 1
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_6 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3461
 *                 break
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3462
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_32 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":3463
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     count += 1
 */
          __pyx_t_33 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3464
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     i += 1
 */
          __pyx_t_34 = __pyx_v_i;
          __pyx_t_35 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3465
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     i += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3466
 *                     result[count] = left[i]
 *                     count += 1
 *                     i += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }

        /* "pandas/src/generated.pyx":3467
 *                     count += 1
 *                     i += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L19_break;
        goto __pyx_L23;
      }
      __pyx_L23:;

      /* "pandas/src/generated.pyx":3469
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3470
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_37 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3472
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_6 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3473
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_38 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3474
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_39 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3475
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_40 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3476
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3477
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_6 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3478
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_6) {
            __pyx_t_41 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_5 = __pyx_t_2;
          } else {
            __pyx_t_5 = __pyx_t_6;
          }
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3479
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L28;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3481
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3482
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_5) {

              /* "pandas/src/generated.pyx":3483
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L29;
            }
            __pyx_L29:;
          }
          __pyx_L28:;
          goto __pyx_L27;
        }

        /* "pandas/src/generated.pyx":3484
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_5 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_5) {

          /* "pandas/src/generated.pyx":3485
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3486
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_43 = __pyx_v_j;
          __pyx_t_5 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3487
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L30;
          }
          __pyx_L30:;
          goto __pyx_L27;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3490
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L19_break;
        }
        __pyx_L27:;
        goto __pyx_L26;
      }

      /* "pandas/src/generated.pyx":3491
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_5 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_5) {

        /* "pandas/src/generated.pyx":3492
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = lval
 */
        __pyx_t_44 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3493
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_45 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3494
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_46 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3495
 *                 rindexer[count] = -1
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3496
 *                 result[count] = lval
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 lindexer[count] = -1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L26;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3498
 *                 i += 1
 *             else:
 *                 lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_47 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3499
 *             else:
 *                 lindexer[count] = -1
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_48 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3500
 *                 lindexer[count] = -1
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 j += 1
 */
        __pyx_t_49 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3501
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3502
 *                 result[count] = rval
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L26:;
    }
    __pyx_L19_break:;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3504
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_297outer_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6pandas_5algos_297outer_join_indexer_int64 = {__Pyx_NAMESTR("outer_join_indexer_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_297outer_join_indexer_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6pandas_5algos_297outer_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("outer_join_indexer_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("outer_join_indexer_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "outer_join_indexer_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("outer_join_indexer_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_296outer_join_indexer_int64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3508
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int64_t] right):
 *     cdef:
 */

static PyObject *__pyx_pf_6pandas_5algos_296outer_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int64_t __pyx_v_lval;
  __pyx_t_5numpy_int64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("outer_join_indexer_int64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3516
 *         ndarray[int64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3517
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3519
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3520
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3521
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         count = nright
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3522
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         count = nright
 *     elif nright == 0:
 */
  __pyx_t_2 = (__pyx_v_nleft == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3523
 *     count = 0
 *     if nleft == 0:
 *         count = nright             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         count = nleft
 */
    __pyx_v_count = __pyx_v_nright;
    goto __pyx_L3;
  }

  /* "pandas/src/generated.pyx":3524
 *     if nleft == 0:
 *         count = nright
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         count = nleft
 *     else:
 */
  __pyx_t_2 = (__pyx_v_nright == 0);
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3525
 *         count = nright
 *     elif nright == 0:
 *         count = nleft             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
    __pyx_v_count = __pyx_v_nleft;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3527
 *         count = nleft
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 count += nright - j
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3528
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 count += nright - j
 *                 break
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3529
 *         while True:
 *             if i == nleft:
 *                 count += nright - j             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nright - __pyx_v_j));

        /* "pandas/src/generated.pyx":3530
 *             if i == nleft:
 *                 count += nright - j
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 count += nleft - i
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3531
 *                 count += nright - j
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 count += nleft - i
 *                 break
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3532
 *                 break
 *             if j == nright:
 *                 count += nleft - i             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
        __pyx_v_count = (__pyx_v_count + (__pyx_v_nleft - __pyx_v_i));

        /* "pandas/src/generated.pyx":3533
 *             if j == nright:
 *                 count += nleft - i
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3535
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3536
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_3 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3537
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3538
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3539
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3540
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_4 = (__pyx_v_j + 1);
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_6 = __pyx_t_5;
          } else {
            __pyx_t_6 = __pyx_t_2;
          }
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3541
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3543
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3544
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_6 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_6) {

              /* "pandas/src/generated.pyx":3545
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3546
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3547
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3548
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_6 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_6) {

            /* "pandas/src/generated.pyx":3549
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3552
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 count += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3553
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
      __pyx_t_6 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3554
 *                     break
 *             elif lval < rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3555
 *             elif lval < rval:
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 count += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3557
 *                 i += 1
 *             else:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3558
 *             else:
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3560
 *                 j += 1
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3561
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3562
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     # do it again, but populate the indexers / result
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3566
 *     # do it again, but populate the indexers / result
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3567
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft == 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3568
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft == 0:
 *         for j in range(nright):
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3569
 *     j = 0
 *     count = 0
 *     if nleft == 0:             # <<<<<<<<<<<<<<
 *         for j in range(nright):
 *             lindexer[j] = -1
 */
  __pyx_t_6 = (__pyx_v_nleft == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3570
 *     count = 0
 *     if nleft == 0:
 *         for j in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[j] = -1
 *             rindexer[j] = j
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_j = __pyx_t_21;

      /* "pandas/src/generated.pyx":3571
 *     if nleft == 0:
 *         for j in range(nright):
 *             lindexer[j] = -1             # <<<<<<<<<<<<<<
 *             rindexer[j] = j
 *             result[j] = right[j]
 */
      __pyx_t_22 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3572
 *         for j in range(nright):
 *             lindexer[j] = -1
 *             rindexer[j] = j             # <<<<<<<<<<<<<<
 *             result[j] = right[j]
 *     elif nright == 0:
 */
      __pyx_t_23 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

      /* "pandas/src/generated.pyx":3573
 *             lindexer[j] = -1
 *             rindexer[j] = j
 *             result[j] = right[j]             # <<<<<<<<<<<<<<
 *     elif nright == 0:
 *         for i in range(nright):
 */
      __pyx_t_24 = __pyx_v_j;
      __pyx_t_25 = __pyx_v_j;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_right.diminfo[0].strides));
    }
    goto __pyx_L13;
  }

  /* "pandas/src/generated.pyx":3574
 *             rindexer[j] = j
 *             result[j] = right[j]
 *     elif nright == 0:             # <<<<<<<<<<<<<<
 *         for i in range(nright):
 *             lindexer[i] = i
 */
  __pyx_t_6 = (__pyx_v_nright == 0);
  if (__pyx_t_6) {

    /* "pandas/src/generated.pyx":3575
 *             result[j] = right[j]
 *     elif nright == 0:
 *         for i in range(nright):             # <<<<<<<<<<<<<<
 *             lindexer[i] = i
 *             rindexer[i] = -1
 */
    __pyx_t_20 = __pyx_v_nright;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_i = __pyx_t_21;

      /* "pandas/src/generated.pyx":3576
 *     elif nright == 0:
 *         for i in range(nright):
 *             lindexer[i] = i             # <<<<<<<<<<<<<<
 *             rindexer[i] = -1
 *             result[i] = left[i]
 */
      __pyx_t_26 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

      /* "pandas/src/generated.pyx":3577
 *         for i in range(nright):
 *             lindexer[i] = i
 *             rindexer[i] = -1             # <<<<<<<<<<<<<<
 *             result[i] = left[i]
 *     else:
 */
      __pyx_t_27 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

      /* "pandas/src/generated.pyx":3578
 *             lindexer[i] = i
 *             rindexer[i] = -1
 *             result[i] = left[i]             # <<<<<<<<<<<<<<
 *     else:
 *         while True:
 */
      __pyx_t_28 = __pyx_v_i;
      __pyx_t_29 = __pyx_v_i;
      *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_left.diminfo[0].strides));
    }
    goto __pyx_L13;
  }
  /*else*/ {

    /* "pandas/src/generated.pyx":3580
 *             result[i] = left[i]
 *     else:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 while j < nright:
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3581
 *     else:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 while j < nright:
 *                     lindexer[count] = -1
 */
      __pyx_t_6 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3582
 *         while True:
 *             if i == nleft:
 *                 while j < nright:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_j < __pyx_v_nright);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3583
 *             if i == nleft:
 *                 while j < nright:
 *                     lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 */
          __pyx_t_20 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3584
 *                 while j < nright:
 *                     lindexer[count] = -1
 *                     rindexer[count] = j             # <<<<<<<<<<<<<<
 *                     result[count] = right[j]
 *                     count += 1
 */
          __pyx_t_21 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

          /* "pandas/src/generated.pyx":3585
 *                     lindexer[count] = -1
 *                     rindexer[count] = j
 *                     result[count] = right[j]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     j += 1
 */
          __pyx_t_30 = __pyx_v_j;
          __pyx_t_31 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_right.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3586
 *                     rindexer[count] = j
 *                     result[count] = right[j]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     j += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3587
 *                     result[count] = right[j]
 *                     count += 1
 *                     j += 1             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
          __pyx_v_j = (__pyx_v_j + 1);
        }

        /* "pandas/src/generated.pyx":3588
 *                     count += 1
 *                     j += 1
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 while i < nleft:
 */
        goto __pyx_L19_break;
        goto __pyx_L20;
      }
      __pyx_L20:;

      /* "pandas/src/generated.pyx":3589
 *                     j += 1
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 while i < nleft:
 *                     lindexer[count] = i
 */
      __pyx_t_6 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3590
 *                 break
 *             if j == nright:
 *                 while i < nleft:             # <<<<<<<<<<<<<<
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 */
        while (1) {
          __pyx_t_6 = (__pyx_v_i < __pyx_v_nleft);
          if (!__pyx_t_6) break;

          /* "pandas/src/generated.pyx":3591
 *             if j == nright:
 *                 while i < nleft:
 *                     lindexer[count] = i             # <<<<<<<<<<<<<<
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 */
          __pyx_t_32 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

          /* "pandas/src/generated.pyx":3592
 *                 while i < nleft:
 *                     lindexer[count] = i
 *                     rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                     result[count] = left[i]
 *                     count += 1
 */
          __pyx_t_33 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

          /* "pandas/src/generated.pyx":3593
 *                     lindexer[count] = i
 *                     rindexer[count] = -1
 *                     result[count] = left[i]             # <<<<<<<<<<<<<<
 *                     count += 1
 *                     i += 1
 */
          __pyx_t_34 = __pyx_v_i;
          __pyx_t_35 = __pyx_v_count;
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_result.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_left.diminfo[0].strides));

          /* "pandas/src/generated.pyx":3594
 *                     rindexer[count] = -1
 *                     result[count] = left[i]
 *                     count += 1             # <<<<<<<<<<<<<<
 *                     i += 1
 *                 break
 */
          __pyx_v_count = (__pyx_v_count + 1);

          /* "pandas/src/generated.pyx":3595
 *                     result[count] = left[i]
 *                     count += 1
 *                     i += 1             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
          __pyx_v_i = (__pyx_v_i + 1);
        }

        /* "pandas/src/generated.pyx":3596
 *                     count += 1
 *                     i += 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L19_break;
        goto __pyx_L23;
      }
      __pyx_L23:;

      /* "pandas/src/generated.pyx":3598
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 * 
 */
      __pyx_t_36 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3599
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 * 
 *             if lval == rval:
 */
      __pyx_t_37 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3601
 *             rval = right[j]
 * 
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_6 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_6) {

        /* "pandas/src/generated.pyx":3602
 * 
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = lval
 */
        __pyx_t_38 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3603
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_39 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3604
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_40 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3605
 *                 rindexer[count] = j
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3606
 *                 result[count] = lval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_6 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_6) {

          /* "pandas/src/generated.pyx":3607
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_6 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_6) {
            __pyx_t_41 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_5 = __pyx_t_2;
          } else {
            __pyx_t_5 = __pyx_t_6;
          }
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3608
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L28;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3610
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3611
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_42 = __pyx_v_i;
            __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_5) {

              /* "pandas/src/generated.pyx":3612
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L29;
            }
            __pyx_L29:;
          }
          __pyx_L28:;
          goto __pyx_L27;
        }

        /* "pandas/src/generated.pyx":3613
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_5 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_5) {

          /* "pandas/src/generated.pyx":3614
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3615
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_43 = __pyx_v_j;
          __pyx_t_5 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_5) {

            /* "pandas/src/generated.pyx":3616
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L30;
          }
          __pyx_L30:;
          goto __pyx_L27;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3619
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 lindexer[count] = i
 */
          goto __pyx_L19_break;
        }
        __pyx_L27:;
        goto __pyx_L26;
      }

      /* "pandas/src/generated.pyx":3620
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 */
      __pyx_t_5 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_5) {

        /* "pandas/src/generated.pyx":3621
 *                     break
 *             elif lval < rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = -1
 *                 result[count] = lval
 */
        __pyx_t_44 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3622
 *             elif lval < rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 result[count] = lval
 *                 count += 1
 */
        __pyx_t_45 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_rindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3623
 *                 lindexer[count] = i
 *                 rindexer[count] = -1
 *                 result[count] = lval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 i += 1
 */
        __pyx_t_46 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_lval;

        /* "pandas/src/generated.pyx":3624
 *                 rindexer[count] = -1
 *                 result[count] = lval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3625
 *                 result[count] = lval
 *                 count += 1
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 lindexer[count] = -1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L26;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3627
 *                 i += 1
 *             else:
 *                 lindexer[count] = -1             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_47 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_lindexer.diminfo[0].strides) = -1;

        /* "pandas/src/generated.pyx":3628
 *             else:
 *                 lindexer[count] = -1
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_48 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3629
 *                 lindexer[count] = -1
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 j += 1
 */
        __pyx_t_49 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3630
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 j += 1
 * 
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3631
 *                 result[count] = rval
 *                 count += 1
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L26:;
    }
    __pyx_L19_break:;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3633
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.outer_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_299inner_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_298inner_join_indexer_float64[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_299inner_join_indexer_float64 = {__Pyx_NAMESTR("inner_join_indexer_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_299inner_join_indexer_float64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_298inner_join_indexer_float64)};
static PyObject *__pyx_pw_6pandas_5algos_299inner_join_indexer_float64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inner_join_indexer_float64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join_indexer_float64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inner_join_indexer_float64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("inner_join_indexer_float64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_298inner_join_indexer_float64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3638
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_298inner_join_indexer_float64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_float64_t __pyx_v_lval;
  __pyx_t_5numpy_float64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inner_join_indexer_float64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3649
 *         ndarray[float64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3650
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3652
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3653
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3654
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3655
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_nright > 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "pandas/src/generated.pyx":3656
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3657
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_4 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3658
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3659
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_4 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3660
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3662
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3663
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_5 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3664
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_4 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3665
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3666
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_4 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3667
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_4) {
            __pyx_t_6 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_3 = __pyx_t_2;
          } else {
            __pyx_t_3 = __pyx_t_4;
          }
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3668
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3670
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3671
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_3) {

              /* "pandas/src/generated.pyx":3672
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3673
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_3 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_3) {

          /* "pandas/src/generated.pyx":3674
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3675
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_3 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3676
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3679
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3680
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_3 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_3) {

        /* "pandas/src/generated.pyx":3681
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3683
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3687
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3688
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.float64)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3689
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.float64)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__float64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3691
 *     result = np.empty(count, dtype=np.float64)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3692
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3693
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3694
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_3 = (__pyx_v_nleft > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_nright > 0);
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3695
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3696
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3697
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L15_break;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "pandas/src/generated.pyx":3698
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3699
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L15_break;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":3701
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3702
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 lindexer[count] = i
 */
      __pyx_t_21 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3703
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3704
 *             rval = right[j]
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_22 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3705
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_23 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3706
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_24 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3707
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3708
 *                 result[count] = rval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3709
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_25 = (__pyx_v_j + 1);
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_4 = __pyx_t_3;
          } else {
            __pyx_t_4 = __pyx_t_2;
          }
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3710
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3712
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3713
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_26 = __pyx_v_i;
            __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_4) {

              /* "pandas/src/generated.pyx":3714
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":3715
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3716
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3717
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_4 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3718
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3721
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L15_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":3722
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_4 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3723
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3725
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L15_break:;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3727
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_float64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_301inner_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_300inner_join_indexer_object[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_301inner_join_indexer_object = {__Pyx_NAMESTR("inner_join_indexer_object"), (PyCFunction)__pyx_pw_6pandas_5algos_301inner_join_indexer_object, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_300inner_join_indexer_object)};
static PyObject *__pyx_pw_6pandas_5algos_301inner_join_indexer_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inner_join_indexer_object (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join_indexer_object", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inner_join_indexer_object") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("inner_join_indexer_object", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3732; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_300inner_join_indexer_object(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_300inner_join_indexer_object(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  PyObject *__pyx_v_lval = 0;
  PyObject *__pyx_v_rval = 0;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  PyObject **__pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inner_join_indexer_object", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3742
 *         ndarray[object] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3743
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3745
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3746
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3747
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3748
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_nright > 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "pandas/src/generated.pyx":3749
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3750
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_4 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3751
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3752
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_4 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3753
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3755
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_5);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pandas/src/generated.pyx":3756
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_6 = __pyx_v_j;
      __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_5);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pandas/src/generated.pyx":3757
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3758
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3759
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_4 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3760
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_4) {
            __pyx_t_7 = (__pyx_v_j + 1);
            __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_5);
            __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_3 = __pyx_t_2;
          } else {
            __pyx_t_3 = __pyx_t_4;
          }
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3761
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3763
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3764
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_9 = __pyx_v_i;
            __pyx_t_8 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_8);
            __pyx_t_5 = PyObject_RichCompare(__pyx_t_8, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            if (__pyx_t_3) {

              /* "pandas/src/generated.pyx":3765
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3766
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_3 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_3) {

          /* "pandas/src/generated.pyx":3767
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3768
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_10 = __pyx_v_j;
          __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_5);
          __pyx_t_8 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3769
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3772
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3773
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_8 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {

        /* "pandas/src/generated.pyx":3774
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3776
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3780
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)
 */
  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3781
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=object)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3782
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=object)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "pandas/src/generated.pyx":3784
 *     result = np.empty(count, dtype=object)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3785
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3786
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3787
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_3 = (__pyx_v_nleft > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_nright > 0);
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3788
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3789
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3790
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L15_break;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "pandas/src/generated.pyx":3791
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3792
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L15_break;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":3794
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_t_8 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_left.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_8);
      __Pyx_XDECREF(__pyx_v_lval);
      __pyx_v_lval = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "pandas/src/generated.pyx":3795
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 lindexer[count] = i
 */
      __pyx_t_21 = __pyx_v_j;
      __pyx_t_8 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_right.diminfo[0].strides);
      __Pyx_INCREF((PyObject*)__pyx_t_8);
      __Pyx_XDECREF(__pyx_v_rval);
      __pyx_v_rval = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "pandas/src/generated.pyx":3796
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_8 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3797
 *             rval = right[j]
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_22 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3798
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_23 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3799
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_24 = __pyx_v_count;
        __pyx_t_25 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_result.diminfo[0].strides);
        __Pyx_GOTREF(*__pyx_t_25);
        __Pyx_INCREF(__pyx_v_rval); __Pyx_DECREF(*__pyx_t_25);
        *__pyx_t_25 = __pyx_v_rval;
        __Pyx_GIVEREF(*__pyx_t_25);

        /* "pandas/src/generated.pyx":3800
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3801
 *                 result[count] = rval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3802
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_26 = (__pyx_v_j + 1);
            __pyx_t_8 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_right.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_8);
            __pyx_t_12 = PyObject_RichCompare(__pyx_t_8, __pyx_v_rval, Py_EQ); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_4 = __pyx_t_3;
          } else {
            __pyx_t_4 = __pyx_t_2;
          }
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3803
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3805
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3806
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_27 = __pyx_v_i;
            __pyx_t_12 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_left.diminfo[0].strides);
            __Pyx_INCREF((PyObject*)__pyx_t_12);
            __pyx_t_8 = PyObject_RichCompare(__pyx_t_12, __pyx_v_rval, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (__pyx_t_4) {

              /* "pandas/src/generated.pyx":3807
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":3808
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3809
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3810
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_28 = __pyx_v_j;
          __pyx_t_8 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_right.diminfo[0].strides);
          __Pyx_INCREF((PyObject*)__pyx_t_8);
          __pyx_t_12 = PyObject_RichCompare(__pyx_v_lval, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3811
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3814
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L15_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":3815
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_12 = PyObject_RichCompare(__pyx_v_lval, __pyx_v_rval, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3816
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3818
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L15_break:;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3820
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_12, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_12);
  __pyx_t_12 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_lval);
  __Pyx_XDECREF(__pyx_v_rval);
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_303inner_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_302inner_join_indexer_int32[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_303inner_join_indexer_int32 = {__Pyx_NAMESTR("inner_join_indexer_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_303inner_join_indexer_int32, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_302inner_join_indexer_int32)};
static PyObject *__pyx_pw_6pandas_5algos_303inner_join_indexer_int32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inner_join_indexer_int32 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join_indexer_int32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inner_join_indexer_int32") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("inner_join_indexer_int32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_302inner_join_indexer_int32(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3824
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_302inner_join_indexer_int32(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int32_t __pyx_v_lval;
  __pyx_t_5numpy_int32_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inner_join_indexer_int32", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3835
 *         ndarray[int32_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3836
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3838
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3839
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3840
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3841
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_nright > 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "pandas/src/generated.pyx":3842
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3843
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_4 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3844
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3845
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_4 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3846
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3848
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3849
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_5 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3850
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_4 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3851
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3852
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_4 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3853
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_4) {
            __pyx_t_6 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_3 = __pyx_t_2;
          } else {
            __pyx_t_3 = __pyx_t_4;
          }
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3854
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3856
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3857
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_3) {

              /* "pandas/src/generated.pyx":3858
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3859
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_3 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_3) {

          /* "pandas/src/generated.pyx":3860
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3861
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_3 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3862
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3865
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3866
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_3 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_3) {

        /* "pandas/src/generated.pyx":3867
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3869
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3873
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3874
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int32)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3875
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int32)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int32); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3877
 *     result = np.empty(count, dtype=np.int32)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3878
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3879
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3880
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_3 = (__pyx_v_nleft > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_nright > 0);
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3881
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3882
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3883
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L15_break;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "pandas/src/generated.pyx":3884
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3885
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L15_break;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":3887
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3888
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 lindexer[count] = i
 */
      __pyx_t_21 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3889
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3890
 *             rval = right[j]
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_22 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3891
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_23 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3892
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_24 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3893
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3894
 *                 result[count] = rval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3895
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_25 = (__pyx_v_j + 1);
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_4 = __pyx_t_3;
          } else {
            __pyx_t_4 = __pyx_t_2;
          }
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3896
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3898
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3899
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_26 = __pyx_v_i;
            __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_4) {

              /* "pandas/src/generated.pyx":3900
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":3901
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3902
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3903
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_4 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3904
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3907
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L15_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":3908
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_4 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3909
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3911
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L15_break:;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":3913
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * @cython.wraparound(False)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3913; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_int32", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6pandas_5algos_305inner_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6pandas_5algos_304inner_join_indexer_int64[] = "\n    Two-pass algorithm for monotonic indexes. Handles many-to-one merges\n    ";
static PyMethodDef __pyx_mdef_6pandas_5algos_305inner_join_indexer_int64 = {__Pyx_NAMESTR("inner_join_indexer_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_305inner_join_indexer_int64, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_304inner_join_indexer_int64)};
static PyObject *__pyx_pw_6pandas_5algos_305inner_join_indexer_int64(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_left = 0;
  PyArrayObject *__pyx_v_right = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inner_join_indexer_int64 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__left,&__pyx_n_s__right,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__left)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__right)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("inner_join_indexer_int64", 1, 2, 2, 1); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inner_join_indexer_int64") < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_left = ((PyArrayObject *)values[0]);
    __pyx_v_right = ((PyArrayObject *)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("inner_join_indexer_int64", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_5numpy_ndarray, 1, "left", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_5numpy_ndarray, 1, "right", 0))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_6pandas_5algos_304inner_join_indexer_int64(__pyx_self, __pyx_v_left, __pyx_v_right);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pandas/src/generated.pyx":3917
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */

static PyObject *__pyx_pf_6pandas_5algos_304inner_join_indexer_int64(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left, PyArrayObject *__pyx_v_right) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nright;
  Py_ssize_t __pyx_v_nleft;
  Py_ssize_t __pyx_v_count;
  __pyx_t_5numpy_int64_t __pyx_v_lval;
  __pyx_t_5numpy_int64_t __pyx_v_rval;
  PyArrayObject *__pyx_v_lindexer = 0;
  PyArrayObject *__pyx_v_rindexer = 0;
  PyArrayObject *__pyx_v_result = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_left;
  __Pyx_Buffer __pyx_pybuffer_left;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_lindexer;
  __Pyx_Buffer __pyx_pybuffer_lindexer;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_result;
  __Pyx_Buffer __pyx_pybuffer_result;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_right;
  __Pyx_Buffer __pyx_pybuffer_right;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_rindexer;
  __Pyx_Buffer __pyx_pybuffer_rindexer;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inner_join_indexer_int64", 0);
  __pyx_pybuffer_lindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_lindexer.refcount = 0;
  __pyx_pybuffernd_lindexer.data = NULL;
  __pyx_pybuffernd_lindexer.rcbuffer = &__pyx_pybuffer_lindexer;
  __pyx_pybuffer_rindexer.pybuffer.buf = NULL;
  __pyx_pybuffer_rindexer.refcount = 0;
  __pyx_pybuffernd_rindexer.data = NULL;
  __pyx_pybuffernd_rindexer.rcbuffer = &__pyx_pybuffer_rindexer;
  __pyx_pybuffer_result.pybuffer.buf = NULL;
  __pyx_pybuffer_result.refcount = 0;
  __pyx_pybuffernd_result.data = NULL;
  __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result;
  __pyx_pybuffer_left.pybuffer.buf = NULL;
  __pyx_pybuffer_left.refcount = 0;
  __pyx_pybuffernd_left.data = NULL;
  __pyx_pybuffernd_left.rcbuffer = &__pyx_pybuffer_left;
  __pyx_pybuffer_right.pybuffer.buf = NULL;
  __pyx_pybuffer_right.refcount = 0;
  __pyx_pybuffernd_right.data = NULL;
  __pyx_pybuffernd_right.rcbuffer = &__pyx_pybuffer_right;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left.rcbuffer->pybuffer, (PyObject*)__pyx_v_left, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_left.diminfo[0].strides = __pyx_pybuffernd_left.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left.diminfo[0].shape = __pyx_pybuffernd_left.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_right.rcbuffer->pybuffer, (PyObject*)__pyx_v_right, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_pybuffernd_right.diminfo[0].strides = __pyx_pybuffernd_right.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_right.diminfo[0].shape = __pyx_pybuffernd_right.rcbuffer->pybuffer.shape[0];

  /* "pandas/src/generated.pyx":3928
 *         ndarray[int64_t] result
 * 
 *     nleft = len(left)             # <<<<<<<<<<<<<<
 *     nright = len(right)
 * 
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_left)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nleft = __pyx_t_1;

  /* "pandas/src/generated.pyx":3929
 * 
 *     nleft = len(left)
 *     nright = len(right)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_right)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nright = __pyx_t_1;

  /* "pandas/src/generated.pyx":3931
 *     nright = len(right)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3932
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3933
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3934
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_2 = (__pyx_v_nleft > 0);
  if (__pyx_t_2) {
    __pyx_t_3 = (__pyx_v_nright > 0);
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  if (__pyx_t_4) {

    /* "pandas/src/generated.pyx":3935
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3936
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_4 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3937
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L5_break;
        goto __pyx_L6;
      }
      __pyx_L6:;

      /* "pandas/src/generated.pyx":3938
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_4 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3939
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L5_break;
        goto __pyx_L7;
      }
      __pyx_L7:;

      /* "pandas/src/generated.pyx":3941
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_1 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3942
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 count += 1
 */
      __pyx_t_5 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3943
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
      __pyx_t_4 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":3944
 *             rval = right[j]
 *             if lval == rval:
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3945
 *             if lval == rval:
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_4 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3946
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_4) {
            __pyx_t_6 = (__pyx_v_j + 1);
            __pyx_t_2 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_3 = __pyx_t_2;
          } else {
            __pyx_t_3 = __pyx_t_4;
          }
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3947
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L10;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3949
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3950
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_7 = __pyx_v_i;
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_3) {

              /* "pandas/src/generated.pyx":3951
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
          __pyx_L10:;
          goto __pyx_L9;
        }

        /* "pandas/src/generated.pyx":3952
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_3 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_3) {

          /* "pandas/src/generated.pyx":3953
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3954
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_8 = __pyx_v_j;
          __pyx_t_3 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_3) {

            /* "pandas/src/generated.pyx":3955
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L12;
          }
          __pyx_L12:;
          goto __pyx_L9;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":3958
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L5_break;
        }
        __pyx_L9:;
        goto __pyx_L8;
      }

      /* "pandas/src/generated.pyx":3959
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_3 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_3) {

        /* "pandas/src/generated.pyx":3960
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L8;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":3962
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     # do it again now that result size is known
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L8:;
    }
    __pyx_L5_break:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "pandas/src/generated.pyx":3966
 *     # do it again now that result size is known
 * 
 *     lindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__int64); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_lindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_lindexer.diminfo[0].strides = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lindexer.diminfo[0].shape = __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_lindexer = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;

  /* "pandas/src/generated.pyx":3967
 * 
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 *     result = np.empty(count, dtype=np.int64)
 * 
 */
  __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_13));
  __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__int64); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer, (PyObject*)__pyx_v_rindexer, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
    }
    __pyx_pybuffernd_rindexer.diminfo[0].strides = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rindexer.diminfo[0].shape = __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_14 = 0;
  __pyx_v_rindexer = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;

  /* "pandas/src/generated.pyx":3968
 *     lindexer = np.empty(count, dtype=np.int64)
 *     rindexer = np.empty(count, dtype=np.int64)
 *     result = np.empty(count, dtype=np.int64)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
  __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_count); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_12));
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__int64); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
  if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
    }
    __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_19 = 0;
  __pyx_v_result = ((PyArrayObject *)__pyx_t_10);
  __pyx_t_10 = 0;

  /* "pandas/src/generated.pyx":3970
 *     result = np.empty(count, dtype=np.int64)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 *     j = 0
 *     count = 0
 */
  __pyx_v_i = 0;

  /* "pandas/src/generated.pyx":3971
 * 
 *     i = 0
 *     j = 0             # <<<<<<<<<<<<<<
 *     count = 0
 *     if nleft > 0 and nright > 0:
 */
  __pyx_v_j = 0;

  /* "pandas/src/generated.pyx":3972
 *     i = 0
 *     j = 0
 *     count = 0             # <<<<<<<<<<<<<<
 *     if nleft > 0 and nright > 0:
 *         while True:
 */
  __pyx_v_count = 0;

  /* "pandas/src/generated.pyx":3973
 *     j = 0
 *     count = 0
 *     if nleft > 0 and nright > 0:             # <<<<<<<<<<<<<<
 *         while True:
 *             if i == nleft:
 */
  __pyx_t_3 = (__pyx_v_nleft > 0);
  if (__pyx_t_3) {
    __pyx_t_4 = (__pyx_v_nright > 0);
    __pyx_t_2 = __pyx_t_4;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "pandas/src/generated.pyx":3974
 *     count = 0
 *     if nleft > 0 and nright > 0:
 *         while True:             # <<<<<<<<<<<<<<
 *             if i == nleft:
 *                 break
 */
    while (1) {
      if (!1) break;

      /* "pandas/src/generated.pyx":3975
 *     if nleft > 0 and nright > 0:
 *         while True:
 *             if i == nleft:             # <<<<<<<<<<<<<<
 *                 break
 *             if j == nright:
 */
      __pyx_t_2 = (__pyx_v_i == __pyx_v_nleft);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3976
 *         while True:
 *             if i == nleft:
 *                 break             # <<<<<<<<<<<<<<
 *             if j == nright:
 *                 break
 */
        goto __pyx_L15_break;
        goto __pyx_L16;
      }
      __pyx_L16:;

      /* "pandas/src/generated.pyx":3977
 *             if i == nleft:
 *                 break
 *             if j == nright:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_2 = (__pyx_v_j == __pyx_v_nright);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3978
 *                 break
 *             if j == nright:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *             lval = left[i]
 */
        goto __pyx_L15_break;
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "pandas/src/generated.pyx":3980
 *                 break
 * 
 *             lval = left[i]             # <<<<<<<<<<<<<<
 *             rval = right[j]
 *             if lval == rval:
 */
      __pyx_t_20 = __pyx_v_i;
      __pyx_v_lval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_left.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3981
 * 
 *             lval = left[i]
 *             rval = right[j]             # <<<<<<<<<<<<<<
 *             if lval == rval:
 *                 lindexer[count] = i
 */
      __pyx_t_21 = __pyx_v_j;
      __pyx_v_rval = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_right.diminfo[0].strides));

      /* "pandas/src/generated.pyx":3982
 *             lval = left[i]
 *             rval = right[j]
 *             if lval == rval:             # <<<<<<<<<<<<<<
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 */
      __pyx_t_2 = (__pyx_v_lval == __pyx_v_rval);
      if (__pyx_t_2) {

        /* "pandas/src/generated.pyx":3983
 *             rval = right[j]
 *             if lval == rval:
 *                 lindexer[count] = i             # <<<<<<<<<<<<<<
 *                 rindexer[count] = j
 *                 result[count] = rval
 */
        __pyx_t_22 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_lindexer.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_lindexer.diminfo[0].strides) = __pyx_v_i;

        /* "pandas/src/generated.pyx":3984
 *             if lval == rval:
 *                 lindexer[count] = i
 *                 rindexer[count] = j             # <<<<<<<<<<<<<<
 *                 result[count] = rval
 *                 count += 1
 */
        __pyx_t_23 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_rindexer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_rindexer.diminfo[0].strides) = __pyx_v_j;

        /* "pandas/src/generated.pyx":3985
 *                 lindexer[count] = i
 *                 rindexer[count] = j
 *                 result[count] = rval             # <<<<<<<<<<<<<<
 *                 count += 1
 *                 if i < nleft - 1:
 */
        __pyx_t_24 = __pyx_v_count;
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_rval;

        /* "pandas/src/generated.pyx":3986
 *                 rindexer[count] = j
 *                 result[count] = rval
 *                 count += 1             # <<<<<<<<<<<<<<
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 */
        __pyx_v_count = (__pyx_v_count + 1);

        /* "pandas/src/generated.pyx":3987
 *                 result[count] = rval
 *                 count += 1
 *                 if i < nleft - 1:             # <<<<<<<<<<<<<<
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1
 */
        __pyx_t_2 = (__pyx_v_i < (__pyx_v_nleft - 1));
        if (__pyx_t_2) {

          /* "pandas/src/generated.pyx":3988
 *                 count += 1
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:             # <<<<<<<<<<<<<<
 *                         j += 1
 *                     else:
 */
          __pyx_t_2 = (__pyx_v_j < (__pyx_v_nright - 1));
          if (__pyx_t_2) {
            __pyx_t_25 = (__pyx_v_j + 1);
            __pyx_t_3 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_right.diminfo[0].strides)) == __pyx_v_rval);
            __pyx_t_4 = __pyx_t_3;
          } else {
            __pyx_t_4 = __pyx_t_2;
          }
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3989
 *                 if i < nleft - 1:
 *                     if j < nright - 1 and right[j + 1] == rval:
 *                         j += 1             # <<<<<<<<<<<<<<
 *                     else:
 *                         i += 1
 */
            __pyx_v_j = (__pyx_v_j + 1);
            goto __pyx_L20;
          }
          /*else*/ {

            /* "pandas/src/generated.pyx":3991
 *                         j += 1
 *                     else:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                         if left[i] != rval:
 *                             j += 1
 */
            __pyx_v_i = (__pyx_v_i + 1);

            /* "pandas/src/generated.pyx":3992
 *                     else:
 *                         i += 1
 *                         if left[i] != rval:             # <<<<<<<<<<<<<<
 *                             j += 1
 *                 elif j < nright - 1:
 */
            __pyx_t_26 = __pyx_v_i;
            __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_left.diminfo[0].strides)) != __pyx_v_rval);
            if (__pyx_t_4) {

              /* "pandas/src/generated.pyx":3993
 *                         i += 1
 *                         if left[i] != rval:
 *                             j += 1             # <<<<<<<<<<<<<<
 *                 elif j < nright - 1:
 *                     j += 1
 */
              __pyx_v_j = (__pyx_v_j + 1);
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
          __pyx_L20:;
          goto __pyx_L19;
        }

        /* "pandas/src/generated.pyx":3994
 *                         if left[i] != rval:
 *                             j += 1
 *                 elif j < nright - 1:             # <<<<<<<<<<<<<<
 *                     j += 1
 *                     if lval != right[j]:
 */
        __pyx_t_4 = (__pyx_v_j < (__pyx_v_nright - 1));
        if (__pyx_t_4) {

          /* "pandas/src/generated.pyx":3995
 *                             j += 1
 *                 elif j < nright - 1:
 *                     j += 1             # <<<<<<<<<<<<<<
 *                     if lval != right[j]:
 *                         i += 1
 */
          __pyx_v_j = (__pyx_v_j + 1);

          /* "pandas/src/generated.pyx":3996
 *                 elif j < nright - 1:
 *                     j += 1
 *                     if lval != right[j]:             # <<<<<<<<<<<<<<
 *                         i += 1
 *                 else:
 */
          __pyx_t_27 = __pyx_v_j;
          __pyx_t_4 = (__pyx_v_lval != (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_right.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_right.diminfo[0].strides)));
          if (__pyx_t_4) {

            /* "pandas/src/generated.pyx":3997
 *                     j += 1
 *                     if lval != right[j]:
 *                         i += 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     # end of the road
 */
            __pyx_v_i = (__pyx_v_i + 1);
            goto __pyx_L22;
          }
          __pyx_L22:;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "pandas/src/generated.pyx":4000
 *                 else:
 *                     # end of the road
 *                     break             # <<<<<<<<<<<<<<
 *             elif lval < rval:
 *                 i += 1
 */
          goto __pyx_L15_break;
        }
        __pyx_L19:;
        goto __pyx_L18;
      }

      /* "pandas/src/generated.pyx":4001
 *                     # end of the road
 *                     break
 *             elif lval < rval:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             else:
 */
      __pyx_t_4 = (__pyx_v_lval < __pyx_v_rval);
      if (__pyx_t_4) {

        /* "pandas/src/generated.pyx":4002
 *                     break
 *             elif lval < rval:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             else:
 *                 j += 1
 */
        __pyx_v_i = (__pyx_v_i + 1);
        goto __pyx_L18;
      }
      /*else*/ {

        /* "pandas/src/generated.pyx":4004
 *                 i += 1
 *             else:
 *                 j += 1             # <<<<<<<<<<<<<<
 * 
 *     return result, lindexer, rindexer
 */
        __pyx_v_j = (__pyx_v_j + 1);
      }
      __pyx_L18:;
    }
    __pyx_L15_break:;
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "pandas/src/generated.pyx":4006
 *                 j += 1
 * 
 *     return result, lindexer, rindexer             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_result));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_result));
  __Pyx_INCREF(((PyObject *)__pyx_v_lindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_v_rindexer));
  PyTuple_SET_ITEM(__pyx_t_10, 2, ((PyObject *)__pyx_v_rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_rindexer));
  __pyx_r = ((PyObject *)__pyx_t_10);
  __pyx_t_10 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pandas.algos.inner_join_indexer_int64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lindexer.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_right.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rindexer.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_lindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_rindexer);
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":122
 * 
 * 
 * cdef inline _string_to_dts(object val, pandas_datetimestruct* dts):             # <<<<<<<<<<<<<<
 *     cdef int result
 *     cdef char *tmp
 */

static CYTHON_INLINE PyObject *__pyx_f_8datetime__string_to_dts(PyObject *__pyx_v_val, pandas_datetimestruct *__pyx_v_dts) {
  int __pyx_v_result;
  char *__pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_string_to_dts", 0);
  __Pyx_INCREF(__pyx_v_val);

  /* "datetime.pxd":126
 *     cdef char *tmp
 * 
 *     if PyUnicode_Check(val):             # <<<<<<<<<<<<<<
 *         val = PyUnicode_AsASCIIString(val);
 * 
 */
  __pyx_t_1 = PyUnicode_Check(__pyx_v_val);
  if (__pyx_t_1) {

    /* "datetime.pxd":127
 * 
 *     if PyUnicode_Check(val):
 *         val = PyUnicode_AsASCIIString(val);             # <<<<<<<<<<<<<<
 * 
 *     tmp = val
 */
    __pyx_t_2 = PyUnicode_AsASCIIString(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_val);
    __pyx_v_val = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "datetime.pxd":129
 *         val = PyUnicode_AsASCIIString(val);
 * 
 *     tmp = val             # <<<<<<<<<<<<<<
 *     result = _cstring_to_dts(tmp, len(val), dts)
 * 
 */
  __pyx_t_3 = PyBytes_AsString(__pyx_v_val); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_tmp = __pyx_t_3;

  /* "datetime.pxd":130
 * 
 *     tmp = val
 *     result = _cstring_to_dts(tmp, len(val), dts)             # <<<<<<<<<<<<<<
 * 
 *     if result == -1:
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_val); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_result = __pyx_f_8datetime__cstring_to_dts(__pyx_v_tmp, __pyx_t_4, __pyx_v_dts);

  /* "datetime.pxd":132
 *     result = _cstring_to_dts(tmp, len(val), dts)
 * 
 *     if result == -1:             # <<<<<<<<<<<<<<
 *         raise ValueError('Unable to parse %s' % str(val))
 * 
 */
  __pyx_t_1 = (__pyx_v_result == -1);
  if (__pyx_t_1) {

    /* "datetime.pxd":133
 * 
 *     if result == -1:
 *         raise ValueError('Unable to parse %s' % str(val))             # <<<<<<<<<<<<<<
 * 
 * cdef inline int _cstring_to_dts(char *val, int length,
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_val);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_val);
    __Pyx_GIVEREF(__pyx_v_val);
    __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_139), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[4]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("datetime._string_to_dts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":135
 *         raise ValueError('Unable to parse %s' % str(val))
 * 
 * cdef inline int _cstring_to_dts(char *val, int length,             # <<<<<<<<<<<<<<
 *                                 pandas_datetimestruct* dts):
 *     cdef:
 */

static CYTHON_INLINE int __pyx_f_8datetime__cstring_to_dts(char *__pyx_v_val, int __pyx_v_length, pandas_datetimestruct *__pyx_v_dts) {
  npy_bool __pyx_v_islocal;
  npy_bool __pyx_v_special;
  PANDAS_DATETIMEUNIT __pyx_v_out_bestunit;
  int __pyx_v_result;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_cstring_to_dts", 0);

  /* "datetime.pxd":144
 *     result = parse_iso_8601_datetime(val, length, PANDAS_FR_ns,
 *                                      NPY_UNSAFE_CASTING,
 *                                      dts, &islocal, &out_bestunit, &special)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result = parse_iso_8601_datetime(__pyx_v_val, __pyx_v_length, PANDAS_FR_ns, NPY_UNSAFE_CASTING, __pyx_v_dts, (&__pyx_v_islocal), (&__pyx_v_out_bestunit), (&__pyx_v_special));

  /* "datetime.pxd":145
 *                                      NPY_UNSAFE_CASTING,
 *                                      dts, &islocal, &out_bestunit, &special)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

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

/* "datetime.pxd":148
 * 
 * 
 * cdef inline object _datetime64_to_datetime(int64_t val):             # <<<<<<<<<<<<<<
 *     cdef pandas_datetimestruct dts
 *     pandas_datetime_to_datetimestruct(val, PANDAS_FR_ns, &dts)
 */

static CYTHON_INLINE PyObject *__pyx_f_8datetime__datetime64_to_datetime(__pyx_t_5numpy_int64_t __pyx_v_val) {
  pandas_datetimestruct __pyx_v_dts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_datetime64_to_datetime", 0);

  /* "datetime.pxd":150
 * cdef inline object _datetime64_to_datetime(int64_t val):
 *     cdef pandas_datetimestruct dts
 *     pandas_datetime_to_datetimestruct(val, PANDAS_FR_ns, &dts)             # <<<<<<<<<<<<<<
 *     return _dts_to_pydatetime(&dts)
 * 
 */
  pandas_datetime_to_datetimestruct(__pyx_v_val, PANDAS_FR_ns, (&__pyx_v_dts));

  /* "datetime.pxd":151
 *     cdef pandas_datetimestruct dts
 *     pandas_datetime_to_datetimestruct(val, PANDAS_FR_ns, &dts)
 *     return _dts_to_pydatetime(&dts)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object _dts_to_pydatetime(pandas_datetimestruct *dts):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8datetime__dts_to_pydatetime((&__pyx_v_dts)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("datetime._datetime64_to_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":153
 *     return _dts_to_pydatetime(&dts)
 * 
 * cdef inline object _dts_to_pydatetime(pandas_datetimestruct *dts):             # <<<<<<<<<<<<<<
 *     return <object> PyDateTime_FromDateAndTime(dts.year, dts.month,
 *                                                dts.day, dts.hour,
 */

static CYTHON_INLINE PyObject *__pyx_f_8datetime__dts_to_pydatetime(pandas_datetimestruct *__pyx_v_dts) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_dts_to_pydatetime", 0);

  /* "datetime.pxd":154
 * 
 * cdef inline object _dts_to_pydatetime(pandas_datetimestruct *dts):
 *     return <object> PyDateTime_FromDateAndTime(dts.year, dts.month,             # <<<<<<<<<<<<<<
 *                                                dts.day, dts.hour,
 *                                                dts.min, dts.sec, dts.us)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "datetime.pxd":156
 *     return <object> PyDateTime_FromDateAndTime(dts.year, dts.month,
 *                                                dts.day, dts.hour,
 *                                                dts.min, dts.sec, dts.us)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int64_t _pydatetime_to_dts(object val, pandas_datetimestruct *dts):
 */
  __pyx_t_1 = PyDateTime_FromDateAndTime(__pyx_v_dts->year, __pyx_v_dts->month, __pyx_v_dts->day, __pyx_v_dts->hour, __pyx_v_dts->min, __pyx_v_dts->sec, __pyx_v_dts->us); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_t_1));
  __pyx_r = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("datetime._dts_to_pydatetime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":158
 *                                                dts.min, dts.sec, dts.us)
 * 
 * cdef inline int64_t _pydatetime_to_dts(object val, pandas_datetimestruct *dts):             # <<<<<<<<<<<<<<
 *     dts.year = PyDateTime_GET_YEAR(val)
 *     dts.month = PyDateTime_GET_MONTH(val)
 */

static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_8datetime__pydatetime_to_dts(PyObject *__pyx_v_val, pandas_datetimestruct *__pyx_v_dts) {
  __pyx_t_5numpy_int64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_pydatetime_to_dts", 0);

  /* "datetime.pxd":159
 * 
 * cdef inline int64_t _pydatetime_to_dts(object val, pandas_datetimestruct *dts):
 *     dts.year = PyDateTime_GET_YEAR(val)             # <<<<<<<<<<<<<<
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->year = PyDateTime_GET_YEAR(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":160
 * cdef inline int64_t _pydatetime_to_dts(object val, pandas_datetimestruct *dts):
 *     dts.year = PyDateTime_GET_YEAR(val)
 *     dts.month = PyDateTime_GET_MONTH(val)             # <<<<<<<<<<<<<<
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = PyDateTime_DATE_GET_HOUR(val)
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->month = PyDateTime_GET_MONTH(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":161
 *     dts.year = PyDateTime_GET_YEAR(val)
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)             # <<<<<<<<<<<<<<
 *     dts.hour = PyDateTime_DATE_GET_HOUR(val)
 *     dts.min = PyDateTime_DATE_GET_MINUTE(val)
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->day = PyDateTime_GET_DAY(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":162
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = PyDateTime_DATE_GET_HOUR(val)             # <<<<<<<<<<<<<<
 *     dts.min = PyDateTime_DATE_GET_MINUTE(val)
 *     dts.sec = PyDateTime_DATE_GET_SECOND(val)
 */
  __pyx_v_dts->hour = PyDateTime_DATE_GET_HOUR(__pyx_v_val);

  /* "datetime.pxd":163
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = PyDateTime_DATE_GET_HOUR(val)
 *     dts.min = PyDateTime_DATE_GET_MINUTE(val)             # <<<<<<<<<<<<<<
 *     dts.sec = PyDateTime_DATE_GET_SECOND(val)
 *     dts.us = PyDateTime_DATE_GET_MICROSECOND(val)
 */
  __pyx_v_dts->min = PyDateTime_DATE_GET_MINUTE(__pyx_v_val);

  /* "datetime.pxd":164
 *     dts.hour = PyDateTime_DATE_GET_HOUR(val)
 *     dts.min = PyDateTime_DATE_GET_MINUTE(val)
 *     dts.sec = PyDateTime_DATE_GET_SECOND(val)             # <<<<<<<<<<<<<<
 *     dts.us = PyDateTime_DATE_GET_MICROSECOND(val)
 *     dts.ps = dts.as = 0
 */
  __pyx_v_dts->sec = PyDateTime_DATE_GET_SECOND(__pyx_v_val);

  /* "datetime.pxd":165
 *     dts.min = PyDateTime_DATE_GET_MINUTE(val)
 *     dts.sec = PyDateTime_DATE_GET_SECOND(val)
 *     dts.us = PyDateTime_DATE_GET_MICROSECOND(val)             # <<<<<<<<<<<<<<
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 */
  __pyx_v_dts->us = PyDateTime_DATE_GET_MICROSECOND(__pyx_v_val);

  /* "datetime.pxd":166
 *     dts.sec = PyDateTime_DATE_GET_SECOND(val)
 *     dts.us = PyDateTime_DATE_GET_MICROSECOND(val)
 *     dts.ps = dts.as = 0             # <<<<<<<<<<<<<<
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 * 
 */
  __pyx_v_dts->ps = 0;
  __pyx_v_dts->as = 0;

  /* "datetime.pxd":167
 *     dts.us = PyDateTime_DATE_GET_MICROSECOND(val)
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int64_t _dtlike_to_datetime64(object val,
 */
  __pyx_r = pandas_datetimestruct_to_datetime(PANDAS_FR_ns, __pyx_v_dts);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("datetime._pydatetime_to_dts", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":169
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 * 
 * cdef inline int64_t _dtlike_to_datetime64(object val,             # <<<<<<<<<<<<<<
 *                                           pandas_datetimestruct *dts):
 *     dts.year = val.year
 */

static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_8datetime__dtlike_to_datetime64(PyObject *__pyx_v_val, pandas_datetimestruct *__pyx_v_dts) {
  __pyx_t_5numpy_int64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  npy_int64 __pyx_t_2;
  npy_int32 __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_dtlike_to_datetime64", 0);

  /* "datetime.pxd":171
 * cdef inline int64_t _dtlike_to_datetime64(object val,
 *                                           pandas_datetimestruct *dts):
 *     dts.year = val.year             # <<<<<<<<<<<<<<
 *     dts.month = val.month
 *     dts.day = val.day
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__year); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->year = __pyx_t_2;

  /* "datetime.pxd":172
 *                                           pandas_datetimestruct *dts):
 *     dts.year = val.year
 *     dts.month = val.month             # <<<<<<<<<<<<<<
 *     dts.day = val.day
 *     dts.hour = val.hour
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__month); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->month = __pyx_t_3;

  /* "datetime.pxd":173
 *     dts.year = val.year
 *     dts.month = val.month
 *     dts.day = val.day             # <<<<<<<<<<<<<<
 *     dts.hour = val.hour
 *     dts.min = val.minute
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__day); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->day = __pyx_t_3;

  /* "datetime.pxd":174
 *     dts.month = val.month
 *     dts.day = val.day
 *     dts.hour = val.hour             # <<<<<<<<<<<<<<
 *     dts.min = val.minute
 *     dts.sec = val.second
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__hour); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->hour = __pyx_t_3;

  /* "datetime.pxd":175
 *     dts.day = val.day
 *     dts.hour = val.hour
 *     dts.min = val.minute             # <<<<<<<<<<<<<<
 *     dts.sec = val.second
 *     dts.us = val.microsecond
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__minute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->min = __pyx_t_3;

  /* "datetime.pxd":176
 *     dts.hour = val.hour
 *     dts.min = val.minute
 *     dts.sec = val.second             # <<<<<<<<<<<<<<
 *     dts.us = val.microsecond
 *     dts.ps = dts.as = 0
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__second); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->sec = __pyx_t_3;

  /* "datetime.pxd":177
 *     dts.min = val.minute
 *     dts.sec = val.second
 *     dts.us = val.microsecond             # <<<<<<<<<<<<<<
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_val, __pyx_n_s__microsecond); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_dts->us = __pyx_t_3;

  /* "datetime.pxd":178
 *     dts.sec = val.second
 *     dts.us = val.microsecond
 *     dts.ps = dts.as = 0             # <<<<<<<<<<<<<<
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 * 
 */
  __pyx_v_dts->ps = 0;
  __pyx_v_dts->as = 0;

  /* "datetime.pxd":179
 *     dts.us = val.microsecond
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int64_t _date_to_datetime64(object val,
 */
  __pyx_r = pandas_datetimestruct_to_datetime(PANDAS_FR_ns, __pyx_v_dts);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("datetime._dtlike_to_datetime64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "datetime.pxd":181
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 * 
 * cdef inline int64_t _date_to_datetime64(object val,             # <<<<<<<<<<<<<<
 *                                         pandas_datetimestruct *dts):
 *     dts.year = PyDateTime_GET_YEAR(val)
 */

static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_8datetime__date_to_datetime64(PyObject *__pyx_v_val, pandas_datetimestruct *__pyx_v_dts) {
  __pyx_t_5numpy_int64_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_date_to_datetime64", 0);

  /* "datetime.pxd":183
 * cdef inline int64_t _date_to_datetime64(object val,
 *                                         pandas_datetimestruct *dts):
 *     dts.year = PyDateTime_GET_YEAR(val)             # <<<<<<<<<<<<<<
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->year = PyDateTime_GET_YEAR(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":184
 *                                         pandas_datetimestruct *dts):
 *     dts.year = PyDateTime_GET_YEAR(val)
 *     dts.month = PyDateTime_GET_MONTH(val)             # <<<<<<<<<<<<<<
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = dts.min = dts.sec = dts.us = 0
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->month = PyDateTime_GET_MONTH(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":185
 *     dts.year = PyDateTime_GET_YEAR(val)
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)             # <<<<<<<<<<<<<<
 *     dts.hour = dts.min = dts.sec = dts.us = 0
 *     dts.ps = dts.as = 0
 */
  if (!(likely(((__pyx_v_val) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_val, __pyx_ptype_8datetime_date))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __pyx_v_val;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_dts->day = PyDateTime_GET_DAY(((PyDateTime_Date *)__pyx_t_1));
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "datetime.pxd":186
 *     dts.month = PyDateTime_GET_MONTH(val)
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = dts.min = dts.sec = dts.us = 0             # <<<<<<<<<<<<<<
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 */
  __pyx_v_dts->hour = 0;
  __pyx_v_dts->min = 0;
  __pyx_v_dts->sec = 0;
  __pyx_v_dts->us = 0;

  /* "datetime.pxd":187
 *     dts.day = PyDateTime_GET_DAY(val)
 *     dts.hour = dts.min = dts.sec = dts.us = 0
 *     dts.ps = dts.as = 0             # <<<<<<<<<<<<<<
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)
 * 
 */
  __pyx_v_dts->ps = 0;
  __pyx_v_dts->as = 0;

  /* "datetime.pxd":188
 *     dts.hour = dts.min = dts.sec = dts.us = 0
 *     dts.ps = dts.as = 0
 *     return pandas_datetimestruct_to_datetime(PANDAS_FR_ns, dts)             # <<<<<<<<<<<<<<
 * 
 */
  __pyx_r = pandas_datetimestruct_to_datetime(PANDAS_FR_ns, __pyx_v_dts);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_WriteUnraisable("datetime._date_to_datetime64", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":195
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "numpy.pxd":201
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = (__pyx_v_info == NULL);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":204
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":205
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":207
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "numpy.pxd":209
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":210
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "numpy.pxd":212
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "numpy.pxd":214
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
  if (__pyx_t_1) {

    /* "numpy.pxd":215
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
    __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS));
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "numpy.pxd":216
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_141), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "numpy.pxd":218
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
  if (__pyx_t_3) {

    /* "numpy.pxd":219
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
    __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS));
    __pyx_t_2 = __pyx_t_1;
  } else {
    __pyx_t_2 = __pyx_t_3;
  }
  if (__pyx_t_2) {

    /* "numpy.pxd":220
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_143), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "numpy.pxd":222
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "numpy.pxd":223
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "numpy.pxd":224
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  if (__pyx_v_copy_shape) {

    /* "numpy.pxd":227
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));

    /* "numpy.pxd":228
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "numpy.pxd":229
 *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_5 = __pyx_v_ndim;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "numpy.pxd":230
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "numpy.pxd":231
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }
    goto __pyx_L7;
  }
  /*else*/ {

    /* "numpy.pxd":233
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "numpy.pxd":234
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L7:;

  /* "numpy.pxd":235
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "numpy.pxd":236
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "numpy.pxd":237
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self));

  /* "numpy.pxd":240
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef list stack
 */
  __pyx_v_f = NULL;

  /* "numpy.pxd":241
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef list stack
 *             cdef int offset
 */
  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "numpy.pxd":245
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "numpy.pxd":247
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = (!__pyx_v_hasfields);
  if (__pyx_t_2) {
    __pyx_t_3 = (!__pyx_v_copy_shape);
    __pyx_t_1 = __pyx_t_3;
  } else {
    __pyx_t_1 = __pyx_t_2;
  }
  if (__pyx_t_1) {

    /* "numpy.pxd":249
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "numpy.pxd":252
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L10:;

  /* "numpy.pxd":254
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 */
  __pyx_t_1 = (!__pyx_v_hasfields);
  if (__pyx_t_1) {

    /* "numpy.pxd":255
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 */
    __pyx_t_5 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_5;

    /* "numpy.pxd":256
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
    if (__pyx_t_1) {
      __pyx_t_2 = __pyx_v_little_endian;
    } else {
      __pyx_t_2 = __pyx_t_1;
    }
    if (!__pyx_t_2) {

      /* "numpy.pxd":257
 *                 t = descr.type_num
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
      if (__pyx_t_1) {
        __pyx_t_3 = (!__pyx_v_little_endian);
        __pyx_t_7 = __pyx_t_3;
      } else {
        __pyx_t_7 = __pyx_t_1;
      }
      __pyx_t_1 = __pyx_t_7;
    } else {
      __pyx_t_1 = __pyx_t_2;
    }
    if (__pyx_t_1) {

      /* "numpy.pxd":258
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_145), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "numpy.pxd":259
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__b;
      goto __pyx_L13;
    }

    /* "numpy.pxd":260
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__B;
      goto __pyx_L13;
    }

    /* "numpy.pxd":261
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__h;
      goto __pyx_L13;
    }

    /* "numpy.pxd":262
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__H;
      goto __pyx_L13;
    }

    /* "numpy.pxd":263
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_INT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__i;
      goto __pyx_L13;
    }

    /* "numpy.pxd":264
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__I;
      goto __pyx_L13;
    }

    /* "numpy.pxd":265
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__l;
      goto __pyx_L13;
    }

    /* "numpy.pxd":266
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__L;
      goto __pyx_L13;
    }

    /* "numpy.pxd":267
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__q;
      goto __pyx_L13;
    }

    /* "numpy.pxd":268
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Q;
      goto __pyx_L13;
    }

    /* "numpy.pxd":269
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__f;
      goto __pyx_L13;
    }

    /* "numpy.pxd":270
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__d;
      goto __pyx_L13;
    }

    /* "numpy.pxd":271
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__g;
      goto __pyx_L13;
    }

    /* "numpy.pxd":272
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zf;
      goto __pyx_L13;
    }

    /* "numpy.pxd":273
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zd;
      goto __pyx_L13;
    }

    /* "numpy.pxd":274
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__Zg;
      goto __pyx_L13;
    }

    /* "numpy.pxd":275
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
    if (__pyx_t_1) {
      __pyx_v_f = __pyx_k__O;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "numpy.pxd":277
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_146), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L13:;

    /* "numpy.pxd":278
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "numpy.pxd":279
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "numpy.pxd":281
 *                 return
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0
 */
    __pyx_v_info->format = ((char *)malloc(255));

    /* "numpy.pxd":282
 *             else:
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "numpy.pxd":283
 *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
 *                 info.format[0] = '^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "numpy.pxd":286
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)             # <<<<<<<<<<<<<<
 *                 f[0] = 0 # Terminate format string
 * 
 */
    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_f = __pyx_t_9;

    /* "numpy.pxd":287
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = 0;
  }
  __pyx_L11:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":289
 *                 f[0] = 0 # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 */

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "numpy.pxd":290
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self);
  if (__pyx_t_1) {

    /* "numpy.pxd":291
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)
 */
    free(__pyx_v_info->format);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "numpy.pxd":292
 *             if PyArray_HASFIELDS(self):
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 stdlib.free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
  if (__pyx_t_1) {

    /* "numpy.pxd":293
 *                 stdlib.free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    free(__pyx_v_info->strides);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":769
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "numpy.pxd":770
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":772
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "numpy.pxd":773
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":775
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "numpy.pxd":776
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":778
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "numpy.pxd":779
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":781
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "numpy.pxd":782
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":784
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  long __pyx_t_11;
  char *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "numpy.pxd":791
 *     cdef int delta_offset
 *     cdef tuple i
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "numpy.pxd":792
 *     cdef tuple i
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "numpy.pxd":795
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[5]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF(__pyx_v_childname);
    __pyx_v_childname = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "numpy.pxd":796
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
    __pyx_v_fields = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "numpy.pxd":797
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_fields);
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_new_offset);
    __pyx_v_new_offset = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "numpy.pxd":799
 *         child, new_offset = fields
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_7) {

      /* "numpy.pxd":800
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_148), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "numpy.pxd":802
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = (__pyx_v_child->byteorder == '>');
    if (__pyx_t_7) {
      __pyx_t_8 = __pyx_v_little_endian;
    } else {
      __pyx_t_8 = __pyx_t_7;
    }
    if (!__pyx_t_8) {

      /* "numpy.pxd":803
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
      __pyx_t_7 = (__pyx_v_child->byteorder == '<');
      if (__pyx_t_7) {
        __pyx_t_9 = (!__pyx_v_little_endian);
        __pyx_t_10 = __pyx_t_9;
      } else {
        __pyx_t_10 = __pyx_t_7;
      }
      __pyx_t_7 = __pyx_t_10;
    } else {
      __pyx_t_7 = __pyx_t_8;
    }
    if (__pyx_t_7) {

      /* "numpy.pxd":804
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_149), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[5]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "numpy.pxd":814
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_7) break;

      /* "numpy.pxd":815
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 120;

      /* "numpy.pxd":816
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "numpy.pxd":817
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_11 = 0;
      (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1);
    }

    /* "numpy.pxd":819
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_11 = 0;
    (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize);

    /* "numpy.pxd":821
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child));
    if (__pyx_t_7) {

      /* "numpy.pxd":822
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "numpy.pxd":823
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5);
      if (__pyx_t_7) {

        /* "numpy.pxd":824
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_151), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[5]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L12;
      }
      __pyx_L12:;

      /* "numpy.pxd":827
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L13;
      }

      /* "numpy.pxd":828
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L13;
      }

      /* "numpy.pxd":829
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 104;
        goto __pyx_L13;
      }

      /* "numpy.pxd":830
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L13;
      }

      /* "numpy.pxd":831
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 105;
        goto __pyx_L13;
      }

      /* "numpy.pxd":832
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L13;
      }

      /* "numpy.pxd":833
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 108;
        goto __pyx_L13;
      }

      /* "numpy.pxd":834
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L13;
      }

      /* "numpy.pxd":835
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 113;
        goto __pyx_L13;
      }

      /* "numpy.pxd":836
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L13;
      }

      /* "numpy.pxd":837
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 102;
        goto __pyx_L13;
      }

      /* "numpy.pxd":838
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 100;
        goto __pyx_L13;
      }

      /* "numpy.pxd":839
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 103;
        goto __pyx_L13;
      }

      /* "numpy.pxd":840
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 102;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":841
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 100;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":842
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 103;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L13;
      }

      /* "numpy.pxd":843
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_7) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L13;
      }
      /*else*/ {

        /* "numpy.pxd":845
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_146), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        {__pyx_filename = __pyx_f[5]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_L13:;

      /* "numpy.pxd":846
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);
      goto __pyx_L11;
    }
    /*else*/ {

      /* "numpy.pxd":850
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
      __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_f = __pyx_t_12;
    }
    __pyx_L11:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "numpy.pxd":851
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "numpy.pxd":966
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "numpy.pxd":968
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  if (__pyx_t_1) {

    /* "numpy.pxd":969
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":971
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
    Py_INCREF(__pyx_v_base);

    /* "numpy.pxd":972
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "numpy.pxd":973
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "numpy.pxd":974
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  __Pyx_RefNannyFinishContext();
}

/* "numpy.pxd":976
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "numpy.pxd":977
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = (__pyx_v_arr->base == NULL);
  if (__pyx_t_1) {

    /* "numpy.pxd":978
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "numpy.pxd":980
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":25
 *     object sarr_from_data(cnp.dtype, int length, void* data)
 * 
 * cdef inline object get_value_at(ndarray arr, object loc):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, sz
 */

static CYTHON_INLINE PyObject *__pyx_f_4util_get_value_at(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_loc) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_sz;
  PyObject *__pyx_v_casted = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_at", 0);
  __Pyx_INCREF(__pyx_v_loc);

  /* "util.pxd":29
 *         Py_ssize_t i, sz
 *         void* data_ptr
 *     if is_float_object(loc):             # <<<<<<<<<<<<<<
 *         casted = int(loc)
 *         if casted == loc:
 */
  __pyx_t_1 = is_float_object(__pyx_v_loc);
  if (__pyx_t_1) {

    /* "util.pxd":30
 *         void* data_ptr
 *     if is_float_object(loc):
 *         casted = int(loc)             # <<<<<<<<<<<<<<
 *         if casted == loc:
 *             loc = casted
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_loc);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_loc);
    __Pyx_GIVEREF(__pyx_v_loc);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_casted = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "util.pxd":31
 *     if is_float_object(loc):
 *         casted = int(loc)
 *         if casted == loc:             # <<<<<<<<<<<<<<
 *             loc = casted
 *     i = <Py_ssize_t> loc
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_casted, __pyx_v_loc, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "util.pxd":32
 *         casted = int(loc)
 *         if casted == loc:
 *             loc = casted             # <<<<<<<<<<<<<<
 *     i = <Py_ssize_t> loc
 *     sz = cnp.PyArray_SIZE(arr)
 */
      __Pyx_INCREF(__pyx_v_casted);
      __Pyx_DECREF(__pyx_v_loc);
      __pyx_v_loc = __pyx_v_casted;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "util.pxd":33
 *         if casted == loc:
 *             loc = casted
 *     i = <Py_ssize_t> loc             # <<<<<<<<<<<<<<
 *     sz = cnp.PyArray_SIZE(arr)
 * 
 */
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loc); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = ((Py_ssize_t)__pyx_t_5);

  /* "util.pxd":34
 *             loc = casted
 *     i = <Py_ssize_t> loc
 *     sz = cnp.PyArray_SIZE(arr)             # <<<<<<<<<<<<<<
 * 
 *     if i < 0 and sz > 0:
 */
  __pyx_v_sz = PyArray_SIZE(__pyx_v_arr);

  /* "util.pxd":36
 *     sz = cnp.PyArray_SIZE(arr)
 * 
 *     if i < 0 and sz > 0:             # <<<<<<<<<<<<<<
 *         i += sz
 *     elif i >= sz or sz == 0:
 */
  __pyx_t_4 = (__pyx_v_i < 0);
  if (__pyx_t_4) {
    __pyx_t_6 = (__pyx_v_sz > 0);
    __pyx_t_7 = __pyx_t_6;
  } else {
    __pyx_t_7 = __pyx_t_4;
  }
  if (__pyx_t_7) {

    /* "util.pxd":37
 * 
 *     if i < 0 and sz > 0:
 *         i += sz             # <<<<<<<<<<<<<<
 *     elif i >= sz or sz == 0:
 *         raise IndexError('index out of bounds')
 */
    __pyx_v_i = (__pyx_v_i + __pyx_v_sz);
    goto __pyx_L5;
  }

  /* "util.pxd":38
 *     if i < 0 and sz > 0:
 *         i += sz
 *     elif i >= sz or sz == 0:             # <<<<<<<<<<<<<<
 *         raise IndexError('index out of bounds')
 * 
 */
  __pyx_t_7 = (__pyx_v_i >= __pyx_v_sz);
  if (!__pyx_t_7) {
    __pyx_t_4 = (__pyx_v_sz == 0);
    __pyx_t_6 = __pyx_t_4;
  } else {
    __pyx_t_6 = __pyx_t_7;
  }
  if (__pyx_t_6) {

    /* "util.pxd":39
 *         i += sz
 *     elif i >= sz or sz == 0:
 *         raise IndexError('index out of bounds')             # <<<<<<<<<<<<<<
 * 
 *     return get_value_1d(arr, i)
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_153), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "util.pxd":41
 *         raise IndexError('index out of bounds')
 * 
 *     return get_value_1d(arr, i)             # <<<<<<<<<<<<<<
 * 
 * cdef inline set_value_at(ndarray arr, object loc, object value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = get_value_1d(__pyx_v_arr, __pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("util.get_value_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_casted);
  __Pyx_XDECREF(__pyx_v_loc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":43
 *     return get_value_1d(arr, i)
 * 
 * cdef inline set_value_at(ndarray arr, object loc, object value):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, sz
 */

static CYTHON_INLINE PyObject *__pyx_f_4util_set_value_at(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_loc, PyObject *__pyx_v_value) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_sz;
  PyObject *__pyx_v_casted = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_value_at", 0);
  __Pyx_INCREF(__pyx_v_loc);

  /* "util.pxd":46
 *     cdef:
 *         Py_ssize_t i, sz
 *     if is_float_object(loc):             # <<<<<<<<<<<<<<
 *         casted = int(loc)
 *         if casted == loc:
 */
  __pyx_t_1 = is_float_object(__pyx_v_loc);
  if (__pyx_t_1) {

    /* "util.pxd":47
 *         Py_ssize_t i, sz
 *     if is_float_object(loc):
 *         casted = int(loc)             # <<<<<<<<<<<<<<
 *         if casted == loc:
 *             loc = casted
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_loc);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_loc);
    __Pyx_GIVEREF(__pyx_v_loc);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_v_casted = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "util.pxd":48
 *     if is_float_object(loc):
 *         casted = int(loc)
 *         if casted == loc:             # <<<<<<<<<<<<<<
 *             loc = casted
 *     i = <Py_ssize_t> loc
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_casted, __pyx_v_loc, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "util.pxd":49
 *         casted = int(loc)
 *         if casted == loc:
 *             loc = casted             # <<<<<<<<<<<<<<
 *     i = <Py_ssize_t> loc
 *     sz = cnp.PyArray_SIZE(arr)
 */
      __Pyx_INCREF(__pyx_v_casted);
      __Pyx_DECREF(__pyx_v_loc);
      __pyx_v_loc = __pyx_v_casted;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "util.pxd":50
 *         if casted == loc:
 *             loc = casted
 *     i = <Py_ssize_t> loc             # <<<<<<<<<<<<<<
 *     sz = cnp.PyArray_SIZE(arr)
 * 
 */
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_loc); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_i = ((Py_ssize_t)__pyx_t_5);

  /* "util.pxd":51
 *             loc = casted
 *     i = <Py_ssize_t> loc
 *     sz = cnp.PyArray_SIZE(arr)             # <<<<<<<<<<<<<<
 * 
 *     if i < 0:
 */
  __pyx_v_sz = PyArray_SIZE(__pyx_v_arr);

  /* "util.pxd":53
 *     sz = cnp.PyArray_SIZE(arr)
 * 
 *     if i < 0:             # <<<<<<<<<<<<<<
 *         i += sz
 *     elif i >= sz:
 */
  __pyx_t_4 = (__pyx_v_i < 0);
  if (__pyx_t_4) {

    /* "util.pxd":54
 * 
 *     if i < 0:
 *         i += sz             # <<<<<<<<<<<<<<
 *     elif i >= sz:
 *         raise IndexError('index out of bounds')
 */
    __pyx_v_i = (__pyx_v_i + __pyx_v_sz);
    goto __pyx_L5;
  }

  /* "util.pxd":55
 *     if i < 0:
 *         i += sz
 *     elif i >= sz:             # <<<<<<<<<<<<<<
 *         raise IndexError('index out of bounds')
 * 
 */
  __pyx_t_4 = (__pyx_v_i >= __pyx_v_sz);
  if (__pyx_t_4) {

    /* "util.pxd":56
 *         i += sz
 *     elif i >= sz:
 *         raise IndexError('index out of bounds')             # <<<<<<<<<<<<<<
 * 
 *     assign_value_1d(arr, i, value)
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_154), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[6]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "util.pxd":58
 *         raise IndexError('index out of bounds')
 * 
 *     assign_value_1d(arr, i, value)             # <<<<<<<<<<<<<<
 * 
 * cdef inline int is_contiguous(ndarray arr):
 */
  __pyx_t_1 = assign_value_1d(__pyx_v_arr, __pyx_v_i, __pyx_v_value); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("util.set_value_at", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_casted);
  __Pyx_XDECREF(__pyx_v_loc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":60
 *     assign_value_1d(arr, i, value)
 * 
 * cdef inline int is_contiguous(ndarray arr):             # <<<<<<<<<<<<<<
 *     return cnp.PyArray_CHKFLAGS(arr, cnp.NPY_C_CONTIGUOUS)
 * 
 */

static CYTHON_INLINE int __pyx_f_4util_is_contiguous(PyArrayObject *__pyx_v_arr) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_contiguous", 0);

  /* "util.pxd":61
 * 
 * cdef inline int is_contiguous(ndarray arr):
 *     return cnp.PyArray_CHKFLAGS(arr, cnp.NPY_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 * 
 * cdef inline is_array(object o):
 */
  __pyx_r = PyArray_CHKFLAGS(__pyx_v_arr, NPY_C_CONTIGUOUS);
  goto __pyx_L0;

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

/* "util.pxd":63
 *     return cnp.PyArray_CHKFLAGS(arr, cnp.NPY_C_CONTIGUOUS)
 * 
 * cdef inline is_array(object o):             # <<<<<<<<<<<<<<
 *     return cnp.PyArray_Check(o)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_4util_is_array(PyObject *__pyx_v_o) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_array", 0);

  /* "util.pxd":64
 * 
 * cdef inline is_array(object o):
 *     return cnp.PyArray_Check(o)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(PyArray_Check(__pyx_v_o)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("util.is_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":67
 * 
 * 
 * cdef inline bint _checknull(object val):             # <<<<<<<<<<<<<<
 *     try:
 *         return val is None or (cpython.PyFloat_Check(val) and val != val)
 */

static CYTHON_INLINE int __pyx_f_4util__checknull(PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_checknull", 0);

  /* "util.pxd":68
 * 
 * cdef inline bint _checknull(object val):
 *     try:             # <<<<<<<<<<<<<<
 *         return val is None or (cpython.PyFloat_Check(val) and val != val)
 *     except ValueError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "util.pxd":69
 * cdef inline bint _checknull(object val):
 *     try:
 *         return val is None or (cpython.PyFloat_Check(val) and val != val)             # <<<<<<<<<<<<<<
 *     except ValueError:
 *         return False
 */
      __pyx_t_4 = (__pyx_v_val == Py_None);
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (!__pyx_t_4) {
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = __Pyx_PyBool_FromLong(PyFloat_Check(__pyx_v_val)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        if (__pyx_t_4) {
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_7 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __pyx_t_8 = __pyx_t_7;
          __pyx_t_7 = 0;
        } else {
          __pyx_t_8 = __pyx_t_6;
          __pyx_t_6 = 0;
        }
        __pyx_t_6 = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __pyx_t_6 = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_4;
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "util.pxd":70
 *     try:
 *         return val is None or (cpython.PyFloat_Check(val) and val != val)
 *     except ValueError:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __pyx_t_9 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_9) {
      __Pyx_AddTraceback("util._checknull", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_8);

      /* "util.pxd":71
 *         return val is None or (cpython.PyFloat_Check(val) and val != val)
 *     except ValueError:
 *         return False             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _checknull_old(object val):
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    __pyx_L10_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("util._checknull", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":73
 *         return False
 * 
 * cdef inline bint _checknull_old(object val):             # <<<<<<<<<<<<<<
 *     import numpy as np
 *     cdef double INF = <double> np.inf
 */

static CYTHON_INLINE int __pyx_f_4util__checknull_old(PyObject *__pyx_v_val) {
  PyObject *__pyx_v_np = NULL;
  double __pyx_v_INF;
  double __pyx_v_NEGINF;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_checknull_old", 0);

  /* "util.pxd":74
 * 
 * cdef inline bint _checknull_old(object val):
 *     import numpy as np             # <<<<<<<<<<<<<<
 *     cdef double INF = <double> np.inf
 *     cdef double NEGINF = -INF
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_np = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "util.pxd":75
 * cdef inline bint _checknull_old(object val):
 *     import numpy as np
 *     cdef double INF = <double> np.inf             # <<<<<<<<<<<<<<
 *     cdef double NEGINF = -INF
 *     try:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_np, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_INF = ((double)__pyx_t_2);

  /* "util.pxd":76
 *     import numpy as np
 *     cdef double INF = <double> np.inf
 *     cdef double NEGINF = -INF             # <<<<<<<<<<<<<<
 *     try:
 *         return bool(val is None or val != val and val != INF
 */
  __pyx_v_NEGINF = (-__pyx_v_INF);

  /* "util.pxd":77
 *     cdef double INF = <double> np.inf
 *     cdef double NEGINF = -INF
 *     try:             # <<<<<<<<<<<<<<
 *         return bool(val is None or val != val and val != INF
 *                     and val != NEGINF)
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "util.pxd":78
 *     cdef double NEGINF = -INF
 *     try:
 *         return bool(val is None or val != val and val != INF             # <<<<<<<<<<<<<<
 *                     and val != NEGINF)
 *     except ValueError:
 */
      __pyx_t_6 = (__pyx_v_val == Py_None);
      if (!__pyx_t_6) {
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_7) {

          /* "util.pxd":79
 *     try:
 *         return bool(val is None or val != val and val != INF
 *                     and val != NEGINF)             # <<<<<<<<<<<<<<
 *     except ValueError:
 *         return False
 */
          __pyx_t_1 = PyFloat_FromDouble(__pyx_v_INF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_8 = PyObject_RichCompare(__pyx_v_val, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_9) {
            __pyx_t_8 = PyFloat_FromDouble(__pyx_v_NEGINF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_1 = PyObject_RichCompare(__pyx_v_val, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_11 = __pyx_t_10;
          } else {
            __pyx_t_11 = __pyx_t_9;
          }
          __pyx_t_9 = __pyx_t_11;
        } else {
          __pyx_t_9 = __pyx_t_7;
        }
        __pyx_t_7 = __pyx_t_9;
      } else {
        __pyx_t_7 = __pyx_t_6;
      }
      __pyx_r = (!(!__pyx_t_7));
      goto __pyx_L7_try_return;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10_try_end;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "util.pxd":80
 *         return bool(val is None or val != val and val != INF
 *                     and val != NEGINF)
 *     except ValueError:             # <<<<<<<<<<<<<<
 *         return False
 * 
 */
    __pyx_t_12 = PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_12) {
      __Pyx_AddTraceback("util._checknull_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_13) < 0) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_13);

      /* "util.pxd":81
 *                     and val != NEGINF)
 *     except ValueError:
 *         return False             # <<<<<<<<<<<<<<
 * 
 * cdef inline bint _checknan(object val):
 */
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L6_except_return;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L10_try_end:;
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_WriteUnraisable("util._checknull_old", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_np);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "util.pxd":83
 *         return False
 * 
 * cdef inline bint _checknan(object val):             # <<<<<<<<<<<<<<
 *     return not cnp.PyArray_Check(val) and val != val
 */

static CYTHON_INLINE int __pyx_f_4util__checknan(PyObject *__pyx_v_val) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_checknan", 0);

  /* "util.pxd":84
 * 
 * cdef inline bint _checknan(object val):
 *     return not cnp.PyArray_Check(val) and val != val             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong((!PyArray_Check(__pyx_v_val))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("util._checknan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6pandas_5algos_Node(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6pandas_5algos_Node *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_5algos_Node *)o);
  p->next = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->width = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pandas_5algos_Node(PyObject *o) {
  struct __pyx_obj_6pandas_5algos_Node *p = (struct __pyx_obj_6pandas_5algos_Node *)o;
  Py_CLEAR(p->next);
  Py_CLEAR(p->width);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pandas_5algos_Node(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pandas_5algos_Node *p = (struct __pyx_obj_6pandas_5algos_Node *)o;
  if (p->next) {
    e = (*v)(p->next, a); if (e) return e;
  }
  if (p->width) {
    e = (*v)(p->width, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pandas_5algos_Node(PyObject *o) {
  struct __pyx_obj_6pandas_5algos_Node *p = (struct __pyx_obj_6pandas_5algos_Node *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->next);
  p->next = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->width);
  p->width = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6pandas_5algos_4Node_value(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pandas_5algos_4Node_5value_1__get__(o);
}

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

static PyObject *__pyx_getprop_6pandas_5algos_4Node_next(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pandas_5algos_4Node_4next_1__get__(o);
}

static int __pyx_setprop_6pandas_5algos_4Node_next(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pandas_5algos_4Node_4next_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pandas_5algos_4Node_4next_5__del__(o);
  }
}

static PyObject *__pyx_getprop_6pandas_5algos_4Node_width(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6pandas_5algos_4Node_5width_1__get__(o);
}

static int __pyx_setprop_6pandas_5algos_4Node_width(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6pandas_5algos_4Node_5width_3__set__(o, v);
  }
  else {
    return __pyx_pw_6pandas_5algos_4Node_5width_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_6pandas_5algos_Node[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6pandas_5algos_Node[] = {
  {(char *)"value", __pyx_getprop_6pandas_5algos_4Node_value, __pyx_setprop_6pandas_5algos_4Node_value, 0, 0},
  {(char *)"next", __pyx_getprop_6pandas_5algos_4Node_next, __pyx_setprop_6pandas_5algos_4Node_next, 0, 0},
  {(char *)"width", __pyx_getprop_6pandas_5algos_4Node_width, __pyx_setprop_6pandas_5algos_4Node_width, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Node = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Node = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Node = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Node = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_5algos_Node = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas.algos.Node"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_5algos_Node), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_5algos_Node, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_Node, /*tp_as_number*/
  &__pyx_tp_as_sequence_Node, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Node, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Node, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6pandas_5algos_Node, /*tp_traverse*/
  __pyx_tp_clear_6pandas_5algos_Node, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_5algos_Node, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6pandas_5algos_Node, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pandas_5algos_4Node_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_5algos_Node, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_6pandas_5algos_IndexableSkiplist __pyx_vtable_6pandas_5algos_IndexableSkiplist;

static PyObject *__pyx_tp_new_6pandas_5algos_IndexableSkiplist(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)o);
  p->__pyx_vtab = __pyx_vtabptr_6pandas_5algos_IndexableSkiplist;
  p->head = ((struct __pyx_obj_6pandas_5algos_Node *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6pandas_5algos_IndexableSkiplist(PyObject *o) {
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *p = (struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)o;
  Py_CLEAR(p->head);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_6pandas_5algos_IndexableSkiplist(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *p = (struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)o;
  if (p->head) {
    e = (*v)(((PyObject*)p->head), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6pandas_5algos_IndexableSkiplist(PyObject *o) {
  struct __pyx_obj_6pandas_5algos_IndexableSkiplist *p = (struct __pyx_obj_6pandas_5algos_IndexableSkiplist *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->head);
  p->head = ((struct __pyx_obj_6pandas_5algos_Node *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
static PyObject *__pyx_sq_item_6pandas_5algos_IndexableSkiplist(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyMethodDef __pyx_methods_6pandas_5algos_IndexableSkiplist[] = {
  {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_7get, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("insert"), (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_9insert, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("remove"), (PyCFunction)__pyx_pw_6pandas_5algos_17IndexableSkiplist_11remove, METH_O, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_IndexableSkiplist = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_IndexableSkiplist = {
  __pyx_pw_6pandas_5algos_17IndexableSkiplist_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6pandas_5algos_IndexableSkiplist, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_IndexableSkiplist = {
  __pyx_pw_6pandas_5algos_17IndexableSkiplist_3__len__, /*mp_length*/
  __pyx_pw_6pandas_5algos_17IndexableSkiplist_5__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_IndexableSkiplist = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6pandas_5algos_IndexableSkiplist = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("pandas.algos.IndexableSkiplist"), /*tp_name*/
  sizeof(struct __pyx_obj_6pandas_5algos_IndexableSkiplist), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6pandas_5algos_IndexableSkiplist, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_IndexableSkiplist, /*tp_as_number*/
  &__pyx_tp_as_sequence_IndexableSkiplist, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_IndexableSkiplist, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_IndexableSkiplist, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("\n    Sorted collection supporting O(lg n) insertion, removal, and\n    lookup by rank.\n    "), /*tp_doc*/
  __pyx_tp_traverse_6pandas_5algos_IndexableSkiplist, /*tp_traverse*/
  __pyx_tp_clear_6pandas_5algos_IndexableSkiplist, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6pandas_5algos_IndexableSkiplist, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6pandas_5algos_17IndexableSkiplist_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6pandas_5algos_IndexableSkiplist, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("ensure_platform_int"), (PyCFunction)__pyx_pw_6pandas_5algos_125ensure_platform_int, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ensure_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_127ensure_float64, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ensure_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_129ensure_int32, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ensure_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_131ensure_int64, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("ensure_object"), (PyCFunction)__pyx_pw_6pandas_5algos_133ensure_object, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("map_indices_float64"), (PyCFunction)__pyx_pw_6pandas_5algos_135map_indices_float64, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_134map_indices_float64)},
  {__Pyx_NAMESTR("map_indices_object"), (PyCFunction)__pyx_pw_6pandas_5algos_137map_indices_object, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_136map_indices_object)},
  {__Pyx_NAMESTR("map_indices_int32"), (PyCFunction)__pyx_pw_6pandas_5algos_139map_indices_int32, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_138map_indices_int32)},
  {__Pyx_NAMESTR("map_indices_int64"), (PyCFunction)__pyx_pw_6pandas_5algos_141map_indices_int64, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_140map_indices_int64)},
  {__Pyx_NAMESTR("map_indices_bool"), (PyCFunction)__pyx_pw_6pandas_5algos_143map_indices_bool, METH_O, __Pyx_DOCSTR(__pyx_doc_6pandas_5algos_142map_indices_bool)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("algos"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_n_s_102, __pyx_k_102, sizeof(__pyx_k_102), 0, 0, 1, 1},
  {&__pyx_n_s_103, __pyx_k_103, sizeof(__pyx_k_103), 0, 0, 1, 1},
  {&__pyx_kp_s_139, __pyx_k_139, sizeof(__pyx_k_139), 0, 0, 1, 0},
  {&__pyx_kp_u_140, __pyx_k_140, sizeof(__pyx_k_140), 0, 1, 0, 0},
  {&__pyx_kp_u_142, __pyx_k_142, sizeof(__pyx_k_142), 0, 1, 0, 0},
  {&__pyx_kp_u_144, __pyx_k_144, sizeof(__pyx_k_144), 0, 1, 0, 0},
  {&__pyx_kp_u_146, __pyx_k_146, sizeof(__pyx_k_146), 0, 1, 0, 0},
  {&__pyx_kp_u_147, __pyx_k_147, sizeof(__pyx_k_147), 0, 1, 0, 0},
  {&__pyx_kp_u_150, __pyx_k_150, sizeof(__pyx_k_150), 0, 1, 0, 0},
  {&__pyx_kp_s_152, __pyx_k_152, sizeof(__pyx_k_152), 0, 0, 1, 0},
  {&__pyx_n_s_155, __pyx_k_155, sizeof(__pyx_k_155), 0, 0, 1, 1},
  {&__pyx_kp_s_158, __pyx_k_158, sizeof(__pyx_k_158), 0, 0, 1, 0},
  {&__pyx_n_s_159, __pyx_k_159, sizeof(__pyx_k_159), 0, 0, 1, 1},
  {&__pyx_n_s_238, __pyx_k_238, sizeof(__pyx_k_238), 0, 0, 1, 1},
  {&__pyx_n_s_247, __pyx_k_247, sizeof(__pyx_k_247), 0, 0, 1, 1},
  {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_274, __pyx_k_274, sizeof(__pyx_k_274), 0, 0, 1, 0},
  {&__pyx_kp_s_288, __pyx_k_288, sizeof(__pyx_k_288), 0, 0, 1, 0},
  {&__pyx_n_s_319, __pyx_k_319, sizeof(__pyx_k_319), 0, 0, 1, 1},
  {&__pyx_n_s_322, __pyx_k_322, sizeof(__pyx_k_322), 0, 0, 1, 1},
  {&__pyx_n_s_325, __pyx_k_325, sizeof(__pyx_k_325), 0, 0, 1, 1},
  {&__pyx_n_s_328, __pyx_k_328, sizeof(__pyx_k_328), 0, 0, 1, 1},
  {&__pyx_n_s_331, __pyx_k_331, sizeof(__pyx_k_331), 0, 0, 1, 1},
  {&__pyx_n_s_334, __pyx_k_334, sizeof(__pyx_k_334), 0, 0, 1, 1},
  {&__pyx_n_s_337, __pyx_k_337, sizeof(__pyx_k_337), 0, 0, 1, 1},
  {&__pyx_n_s_340, __pyx_k_340, sizeof(__pyx_k_340), 0, 0, 1, 1},
  {&__pyx_n_s_343, __pyx_k_343, sizeof(__pyx_k_343), 0, 0, 1, 1},
  {&__pyx_n_s_348, __pyx_k_348, sizeof(__pyx_k_348), 0, 0, 1, 1},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_n_s_351, __pyx_k_351, sizeof(__pyx_k_351), 0, 0, 1, 1},
  {&__pyx_n_s_354, __pyx_k_354, sizeof(__pyx_k_354), 0, 0, 1, 1},
  {&__pyx_n_s_357, __pyx_k_357, sizeof(__pyx_k_357), 0, 0, 1, 1},
  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  {&__pyx_n_s_360, __pyx_k_360, sizeof(__pyx_k_360), 0, 0, 1, 1},
  {&__pyx_n_s_373, __pyx_k_373, sizeof(__pyx_k_373), 0, 0, 1, 1},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_n_s_404, __pyx_k_404, sizeof(__pyx_k_404), 0, 0, 1, 1},
  {&__pyx_n_s_407, __pyx_k_407, sizeof(__pyx_k_407), 0, 0, 1, 1},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_n_s_418, __pyx_k_418, sizeof(__pyx_k_418), 0, 0, 1, 1},
  {&__pyx_n_s_427, __pyx_k_427, sizeof(__pyx_k_427), 0, 0, 1, 1},
  {&__pyx_n_s_430, __pyx_k_430, sizeof(__pyx_k_430), 0, 0, 1, 1},
  {&__pyx_n_s_439, __pyx_k_439, sizeof(__pyx_k_439), 0, 0, 1, 1},
  {&__pyx_n_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 1},
  {&__pyx_n_s_442, __pyx_k_442, sizeof(__pyx_k_442), 0, 0, 1, 1},
  {&__pyx_n_s_445, __pyx_k_445, sizeof(__pyx_k_445), 0, 0, 1, 1},
  {&__pyx_n_s_448, __pyx_k_448, sizeof(__pyx_k_448), 0, 0, 1, 1},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_n_s_451, __pyx_k_451, sizeof(__pyx_k_451), 0, 0, 1, 1},
  {&__pyx_n_s_454, __pyx_k_454, sizeof(__pyx_k_454), 0, 0, 1, 1},
  {&__pyx_n_s_457, __pyx_k_457, sizeof(__pyx_k_457), 0, 0, 1, 1},
  {&__pyx_n_s_460, __pyx_k_460, sizeof(__pyx_k_460), 0, 0, 1, 1},
  {&__pyx_n_s_463, __pyx_k_463, sizeof(__pyx_k_463), 0, 0, 1, 1},
  {&__pyx_n_s_466, __pyx_k_466, sizeof(__pyx_k_466), 0, 0, 1, 1},
  {&__pyx_n_s_469, __pyx_k_469, sizeof(__pyx_k_469), 0, 0, 1, 1},
  {&__pyx_n_s_472, __pyx_k_472, sizeof(__pyx_k_472), 0, 0, 1, 1},
  {&__pyx_n_s_475, __pyx_k_475, sizeof(__pyx_k_475), 0, 0, 1, 1},
  {&__pyx_n_s_478, __pyx_k_478, sizeof(__pyx_k_478), 0, 0, 1, 1},
  {&__pyx_n_s_481, __pyx_k_481, sizeof(__pyx_k_481), 0, 0, 1, 1},
  {&__pyx_n_s_484, __pyx_k_484, sizeof(__pyx_k_484), 0, 0, 1, 1},
  {&__pyx_kp_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 0},
  {&__pyx_kp_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 0},
  {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1},
  {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
  {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
  {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1},
  {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
  {&__pyx_n_s__Infinity, __pyx_k__Infinity, sizeof(__pyx_k__Infinity), 0, 0, 1, 1},
  {&__pyx_n_s__K, __pyx_k__K, sizeof(__pyx_k__K), 0, 0, 1, 1},
  {&__pyx_n_s__KeyError, __pyx_k__KeyError, sizeof(__pyx_k__KeyError), 0, 0, 1, 1},
  {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1},
  {&__pyx_n_s__NA, __pyx_k__NA, sizeof(__pyx_k__NA), 0, 0, 1, 1},
  {&__pyx_n_s__NIL, __pyx_k__NIL, sizeof(__pyx_k__NIL), 0, 0, 1, 1},
  {&__pyx_n_s__NINF, __pyx_k__NINF, sizeof(__pyx_k__NINF), 0, 0, 1, 1},
  {&__pyx_n_s__NaN, __pyx_k__NaN, sizeof(__pyx_k__NaN), 0, 0, 1, 1},
  {&__pyx_n_s__NegInfinity, __pyx_k__NegInfinity, sizeof(__pyx_k__NegInfinity), 0, 0, 1, 1},
  {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 1, 1},
  {&__pyx_n_s__R, __pyx_k__R, sizeof(__pyx_k__R), 0, 0, 1, 1},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__S, __pyx_k__S, sizeof(__pyx_k__S), 0, 0, 1, 1},
  {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s____cmp__, __pyx_k____cmp__, sizeof(__pyx_k____cmp__), 0, 0, 1, 1},
  {&__pyx_n_s____eq__, __pyx_k____eq__, sizeof(__pyx_k____eq__), 0, 0, 1, 1},
  {&__pyx_n_s____ge__, __pyx_k____ge__, sizeof(__pyx_k____ge__), 0, 0, 1, 1},
  {&__pyx_n_s____gt__, __pyx_k____gt__, sizeof(__pyx_k____gt__), 0, 0, 1, 1},
  {&__pyx_n_s____le__, __pyx_k____le__, sizeof(__pyx_k____le__), 0, 0, 1, 1},
  {&__pyx_n_s____lt__, __pyx_k____lt__, sizeof(__pyx_k____lt__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____ne__, __pyx_k____ne__, sizeof(__pyx_k____ne__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___as, __pyx_k___as, sizeof(__pyx_k___as), 0, 0, 1, 1},
  {&__pyx_n_s___check_minp, __pyx_k___check_minp, sizeof(__pyx_k___check_minp), 0, 0, 1, 1},
  {&__pyx_n_s___counts, __pyx_k___counts, sizeof(__pyx_k___counts), 0, 0, 1, 1},
  {&__pyx_n_s___get_result_indexer, __pyx_k___get_result_indexer, sizeof(__pyx_k___get_result_indexer), 0, 0, 1, 1},
  {&__pyx_n_s___return_false, __pyx_k___return_false, sizeof(__pyx_k___return_false), 0, 0, 1, 1},
  {&__pyx_n_s___return_true, __pyx_k___return_true, sizeof(__pyx_k___return_true), 0, 0, 1, 1},
  {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
  {&__pyx_n_s__adj, __pyx_k__adj, sizeof(__pyx_k__adj), 0, 0, 1, 1},
  {&__pyx_n_s__adjust, __pyx_k__adjust, sizeof(__pyx_k__adjust), 0, 0, 1, 1},
  {&__pyx_n_s__ai, __pyx_k__ai, sizeof(__pyx_k__ai), 0, 0, 1, 1},
  {&__pyx_n_s__aold, __pyx_k__aold, sizeof(__pyx_k__aold), 0, 0, 1, 1},
  {&__pyx_n_s__arange, __pyx_k__arange, sizeof(__pyx_k__arange), 0, 0, 1, 1},
  {&__pyx_n_s__arg, __pyx_k__arg, sizeof(__pyx_k__arg), 0, 0, 1, 1},
  {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1},
  {&__pyx_n_s__argsorted, __pyx_k__argsorted, sizeof(__pyx_k__argsorted), 0, 0, 1, 1},
  {&__pyx_n_s__arr, __pyx_k__arr, sizeof(__pyx_k__arr), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap_bool, __pyx_k__arrmap_bool, sizeof(__pyx_k__arrmap_bool), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap_float64, __pyx_k__arrmap_float64, sizeof(__pyx_k__arrmap_float64), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap_int32, __pyx_k__arrmap_int32, sizeof(__pyx_k__arrmap_int32), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap_int64, __pyx_k__arrmap_int64, sizeof(__pyx_k__arrmap_int64), 0, 0, 1, 1},
  {&__pyx_n_s__arrmap_object, __pyx_k__arrmap_object, sizeof(__pyx_k__arrmap_object), 0, 0, 1, 1},
  {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1},
  {&__pyx_n_s__ascending, __pyx_k__ascending, sizeof(__pyx_k__ascending), 0, 0, 1, 1},
  {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1},
  {&__pyx_n_s__average, __pyx_k__average, sizeof(__pyx_k__average), 0, 0, 1, 1},
  {&__pyx_n_s__avg, __pyx_k__avg, sizeof(__pyx_k__avg), 0, 0, 1, 1},
  {&__pyx_n_s__avg_wgt, __pyx_k__avg_wgt, sizeof(__pyx_k__avg_wgt), 0, 0, 1, 1},
  {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1},
  {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
  {&__pyx_n_s__backfill_bool, __pyx_k__backfill_bool, sizeof(__pyx_k__backfill_bool), 0, 0, 1, 1},
  {&__pyx_n_s__backfill_float64, __pyx_k__backfill_float64, sizeof(__pyx_k__backfill_float64), 0, 0, 1, 1},
  {&__pyx_n_s__backfill_int32, __pyx_k__backfill_int32, sizeof(__pyx_k__backfill_int32), 0, 0, 1, 1},
  {&__pyx_n_s__backfill_int64, __pyx_k__backfill_int64, sizeof(__pyx_k__backfill_int64), 0, 0, 1, 1},
  {&__pyx_n_s__backfill_object, __pyx_k__backfill_object, sizeof(__pyx_k__backfill_object), 0, 0, 1, 1},
  {&__pyx_n_s__bins, __pyx_k__bins, sizeof(__pyx_k__bins), 0, 0, 1, 1},
  {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
  {&__pyx_n_s__bufarr, __pyx_k__bufarr, sizeof(__pyx_k__bufarr), 0, 0, 1, 1},
  {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
  {&__pyx_n_s__c_contiguous, __pyx_k__c_contiguous, sizeof(__pyx_k__c_contiguous), 0, 0, 1, 1},
  {&__pyx_n_s__com, __pyx_k__com, sizeof(__pyx_k__com), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1},
  {&__pyx_n_s__counts, __pyx_k__counts, sizeof(__pyx_k__counts), 0, 0, 1, 1},
  {&__pyx_n_s__cov, __pyx_k__cov, sizeof(__pyx_k__cov), 0, 0, 1, 1},
  {&__pyx_n_s__ct, __pyx_k__ct, sizeof(__pyx_k__ct), 0, 0, 1, 1},
  {&__pyx_n_s__cur, __pyx_k__cur, sizeof(__pyx_k__cur), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__datetime, __pyx_k__datetime, sizeof(__pyx_k__datetime), 0, 0, 1, 1},
  {&__pyx_n_s__day, __pyx_k__day, sizeof(__pyx_k__day), 0, 0, 1, 1},
  {&__pyx_n_s__ddof, __pyx_k__ddof, sizeof(__pyx_k__ddof), 0, 0, 1, 1},
  {&__pyx_n_s__diff_2d_float64, __pyx_k__diff_2d_float64, sizeof(__pyx_k__diff_2d_float64), 0, 0, 1, 1},
  {&__pyx_n_s__diff_2d_int32, __pyx_k__diff_2d_int32, sizeof(__pyx_k__diff_2d_int32), 0, 0, 1, 1},
  {&__pyx_n_s__diff_2d_int64, __pyx_k__diff_2d_int64, sizeof(__pyx_k__diff_2d_int64), 0, 0, 1, 1},
  {&__pyx_n_s__dim, __pyx_k__dim, sizeof(__pyx_k__dim), 0, 0, 1, 1},
  {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1},
  {&__pyx_n_s__divisor, __pyx_k__divisor, sizeof(__pyx_k__divisor), 0, 0, 1, 1},
  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  {&__pyx_n_s__dups, __pyx_k__dups, sizeof(__pyx_k__dups), 0, 0, 1, 1},
  {&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
  {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1},
  {&__pyx_n_s__empty_like, __pyx_k__empty_like, sizeof(__pyx_k__empty_like), 0, 0, 1, 1},
  {&__pyx_n_s__end, __pyx_k__end, sizeof(__pyx_k__end), 0, 0, 1, 1},
  {&__pyx_n_s__ewma, __pyx_k__ewma, sizeof(__pyx_k__ewma), 0, 0, 1, 1},
  {&__pyx_n_s__expected_size, __pyx_k__expected_size, sizeof(__pyx_k__expected_size), 0, 0, 1, 1},
  {&__pyx_n_s__f8, __pyx_k__f8, sizeof(__pyx_k__f8), 0, 0, 1, 1},
  {&__pyx_n_s__f_contiguous, __pyx_k__f_contiguous, sizeof(__pyx_k__f_contiguous), 0, 0, 1, 1},
  {&__pyx_n_s__ffill_by_group, __pyx_k__ffill_by_group, sizeof(__pyx_k__ffill_by_group), 0, 0, 1, 1},
  {&__pyx_n_s__ffill_indexer, __pyx_k__ffill_indexer, sizeof(__pyx_k__ffill_indexer), 0, 0, 1, 1},
  {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1},
  {&__pyx_n_s__fill_count, __pyx_k__fill_count, sizeof(__pyx_k__fill_count), 0, 0, 1, 1},
  {&__pyx_n_s__fill_value, __pyx_k__fill_value, sizeof(__pyx_k__fill_value), 0, 0, 1, 1},
  {&__pyx_n_s__first, __pyx_k__first, sizeof(__pyx_k__first), 0, 0, 1, 1},
  {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
  {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
  {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1},
  {&__pyx_n_s__full_outer_join, __pyx_k__full_outer_join, sizeof(__pyx_k__full_outer_join), 0, 0, 1, 1},
  {&__pyx_n_s__func, __pyx_k__func, sizeof(__pyx_k__func), 0, 0, 1, 1},
  {&__pyx_n_s__fv, __pyx_k__fv, sizeof(__pyx_k__fv), 0, 0, 1, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__gid, __pyx_k__gid, sizeof(__pyx_k__gid), 0, 0, 1, 1},
  {&__pyx_n_s__got_first, __pyx_k__got_first, sizeof(__pyx_k__got_first), 0, 0, 1, 1},
  {&__pyx_n_s__group_add, __pyx_k__group_add, sizeof(__pyx_k__group_add), 0, 0, 1, 1},
  {&__pyx_n_s__group_add_bin, __pyx_k__group_add_bin, sizeof(__pyx_k__group_add_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_ids, __pyx_k__group_ids, sizeof(__pyx_k__group_ids), 0, 0, 1, 1},
  {&__pyx_n_s__group_labels, __pyx_k__group_labels, sizeof(__pyx_k__group_labels), 0, 0, 1, 1},
  {&__pyx_n_s__group_last, __pyx_k__group_last, sizeof(__pyx_k__group_last), 0, 0, 1, 1},
  {&__pyx_n_s__group_last_bin, __pyx_k__group_last_bin, sizeof(__pyx_k__group_last_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_last_object, __pyx_k__group_last_object, sizeof(__pyx_k__group_last_object), 0, 0, 1, 1},
  {&__pyx_n_s__group_max, __pyx_k__group_max, sizeof(__pyx_k__group_max), 0, 0, 1, 1},
  {&__pyx_n_s__group_max_bin, __pyx_k__group_max_bin, sizeof(__pyx_k__group_max_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_mean, __pyx_k__group_mean, sizeof(__pyx_k__group_mean), 0, 0, 1, 1},
  {&__pyx_n_s__group_mean_bin, __pyx_k__group_mean_bin, sizeof(__pyx_k__group_mean_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_median, __pyx_k__group_median, sizeof(__pyx_k__group_median), 0, 0, 1, 1},
  {&__pyx_n_s__group_min, __pyx_k__group_min, sizeof(__pyx_k__group_min), 0, 0, 1, 1},
  {&__pyx_n_s__group_min_bin, __pyx_k__group_min_bin, sizeof(__pyx_k__group_min_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_nth, __pyx_k__group_nth, sizeof(__pyx_k__group_nth), 0, 0, 1, 1},
  {&__pyx_n_s__group_nth_bin, __pyx_k__group_nth_bin, sizeof(__pyx_k__group_nth_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_nth_object, __pyx_k__group_nth_object, sizeof(__pyx_k__group_nth_object), 0, 0, 1, 1},
  {&__pyx_n_s__group_ohlc, __pyx_k__group_ohlc, sizeof(__pyx_k__group_ohlc), 0, 0, 1, 1},
  {&__pyx_n_s__group_prod, __pyx_k__group_prod, sizeof(__pyx_k__group_prod), 0, 0, 1, 1},
  {&__pyx_n_s__group_prod_bin, __pyx_k__group_prod_bin, sizeof(__pyx_k__group_prod_bin), 0, 0, 1, 1},
  {&__pyx_n_s__group_var, __pyx_k__group_var, sizeof(__pyx_k__group_var), 0, 0, 1, 1},
  {&__pyx_n_s__group_var_bin, __pyx_k__group_var_bin, sizeof(__pyx_k__group_var_bin), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_bool, __pyx_k__groupby_bool, sizeof(__pyx_k__groupby_bool), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_float64, __pyx_k__groupby_float64, sizeof(__pyx_k__groupby_float64), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_indices, __pyx_k__groupby_indices, sizeof(__pyx_k__groupby_indices), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_int32, __pyx_k__groupby_int32, sizeof(__pyx_k__groupby_int32), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_int64, __pyx_k__groupby_int64, sizeof(__pyx_k__groupby_int64), 0, 0, 1, 1},
  {&__pyx_n_s__groupby_object, __pyx_k__groupby_object, sizeof(__pyx_k__groupby_object), 0, 0, 1, 1},
  {&__pyx_n_s__groupsort_indexer, __pyx_k__groupsort_indexer, sizeof(__pyx_k__groupsort_indexer), 0, 0, 1, 1},
  {&__pyx_n_s__hour, __pyx_k__hour, sizeof(__pyx_k__hour), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__i0, __pyx_k__i0, sizeof(__pyx_k__i0), 0, 0, 1, 1},
  {&__pyx_n_s__i8, __pyx_k__i8, sizeof(__pyx_k__i8), 0, 0, 1, 1},
  {&__pyx_n_s__ids, __pyx_k__ids, sizeof(__pyx_k__ids), 0, 0, 1, 1},
  {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1},
  {&__pyx_n_s__idx0, __pyx_k__idx0, sizeof(__pyx_k__idx0), 0, 0, 1, 1},
  {&__pyx_n_s__idx1, __pyx_k__idx1, sizeof(__pyx_k__idx1), 0, 0, 1, 1},
  {&__pyx_n_s__iinfo, __pyx_k__iinfo, sizeof(__pyx_k__iinfo), 0, 0, 1, 1},
  {&__pyx_n_s__in_arr, __pyx_k__in_arr, sizeof(__pyx_k__in_arr), 0, 0, 1, 1},
  {&__pyx_n_s__in_i, __pyx_k__in_i, sizeof(__pyx_k__in_i), 0, 0, 1, 1},
  {&__pyx_n_s__in_k, __pyx_k__in_k, sizeof(__pyx_k__in_k), 0, 0, 1, 1},
  {&__pyx_n_s__in_n, __pyx_k__in_n, sizeof(__pyx_k__in_n), 0, 0, 1, 1},
  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1},
  {&__pyx_n_s__indexer, __pyx_k__indexer, sizeof(__pyx_k__indexer), 0, 0, 1, 1},
  {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1},
  {&__pyx_n_s__infs, __pyx_k__infs, sizeof(__pyx_k__infs), 0, 0, 1, 1},
  {&__pyx_n_s__inner_join, __pyx_k__inner_join, sizeof(__pyx_k__inner_join), 0, 0, 1, 1},
  {&__pyx_n_s__input, __pyx_k__input, sizeof(__pyx_k__input), 0, 0, 1, 1},
  {&__pyx_n_s__insert, __pyx_k__insert, sizeof(__pyx_k__insert), 0, 0, 1, 1},
  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
  {&__pyx_n_s__int_, __pyx_k__int_, sizeof(__pyx_k__int_), 0, 0, 1, 1},
  {&__pyx_n_s__is_lexsorted, __pyx_k__is_lexsorted, sizeof(__pyx_k__is_lexsorted), 0, 0, 1, 1},
  {&__pyx_n_s__is_monotonic_bool, __pyx_k__is_monotonic_bool, sizeof(__pyx_k__is_monotonic_bool), 0, 0, 1, 1},
  {&__pyx_n_s__is_monotonic_int32, __pyx_k__is_monotonic_int32, sizeof(__pyx_k__is_monotonic_int32), 0, 0, 1, 1},
  {&__pyx_n_s__is_monotonic_int64, __pyx_k__is_monotonic_int64, sizeof(__pyx_k__is_monotonic_int64), 0, 0, 1, 1},
  {&__pyx_n_s__is_monotonic_object, __pyx_k__is_monotonic_object, sizeof(__pyx_k__is_monotonic_object), 0, 0, 1, 1},
  {&__pyx_n_s__is_unique, __pyx_k__is_unique, sizeof(__pyx_k__is_unique), 0, 0, 1, 1},
  {&__pyx_n_s__isfinite, __pyx_k__isfinite, sizeof(__pyx_k__isfinite), 0, 0, 1, 1},
  {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1},
  {&__pyx_n_s__isnullobj, __pyx_k__isnullobj, sizeof(__pyx_k__isnullobj), 0, 0, 1, 1},
  {&__pyx_n_s__isnullobj2d, __pyx_k__isnullobj2d, sizeof(__pyx_k__isnullobj2d), 0, 0, 1, 1},
  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
  {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
  {&__pyx_n_s__keep, __pyx_k__keep, sizeof(__pyx_k__keep), 0, 0, 1, 1},
  {&__pyx_n_s__keep_na, __pyx_k__keep_na, sizeof(__pyx_k__keep_na), 0, 0, 1, 1},
  {&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
  {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1},
  {&__pyx_n_s__kth_smallest, __pyx_k__kth_smallest, sizeof(__pyx_k__kth_smallest), 0, 0, 1, 1},
  {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
  {&__pyx_n_s__lab, __pyx_k__lab, sizeof(__pyx_k__lab), 0, 0, 1, 1},
  {&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1},
  {&__pyx_n_s__labels, __pyx_k__labels, sizeof(__pyx_k__labels), 0, 0, 1, 1},
  {&__pyx_n_s__last, __pyx_k__last, sizeof(__pyx_k__last), 0, 0, 1, 1},
  {&__pyx_n_s__last_obs, __pyx_k__last_obs, sizeof(__pyx_k__last_obs), 0, 0, 1, 1},
  {&__pyx_n_s__lc, __pyx_k__lc, sizeof(__pyx_k__lc), 0, 0, 1, 1},
  {&__pyx_n_s__left, __pyx_k__left, sizeof(__pyx_k__left), 0, 0, 1, 1},
  {&__pyx_n_s__left_count, __pyx_k__left_count, sizeof(__pyx_k__left_count), 0, 0, 1, 1},
  {&__pyx_n_s__left_indexer, __pyx_k__left_indexer, sizeof(__pyx_k__left_indexer), 0, 0, 1, 1},
  {&__pyx_n_s__left_outer_join, __pyx_k__left_outer_join, sizeof(__pyx_k__left_outer_join), 0, 0, 1, 1},
  {&__pyx_n_s__left_pos, __pyx_k__left_pos, sizeof(__pyx_k__left_pos), 0, 0, 1, 1},
  {&__pyx_n_s__left_sorter, __pyx_k__left_sorter, sizeof(__pyx_k__left_sorter), 0, 0, 1, 1},
  {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1},
  {&__pyx_n_s__lib, __pyx_k__lib, sizeof(__pyx_k__lib), 0, 0, 1, 1},
  {&__pyx_n_s__lim, __pyx_k__lim, sizeof(__pyx_k__lim), 0, 0, 1, 1},
  {&__pyx_n_s__limit, __pyx_k__limit, sizeof(__pyx_k__limit), 0, 0, 1, 1},
  {&__pyx_n_s__lindexer, __pyx_k__lindexer, sizeof(__pyx_k__lindexer), 0, 0, 1, 1},
  {&__pyx_n_s__list_of_arrays, __pyx_k__list_of_arrays, sizeof(__pyx_k__list_of_arrays), 0, 0, 1, 1},
  {&__pyx_n_s__loc, __pyx_k__loc, sizeof(__pyx_k__loc), 0, 0, 1, 1},
  {&__pyx_n_s__lval, __pyx_k__lval, sizeof(__pyx_k__lval), 0, 0, 1, 1},
  {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1},
  {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1},
  {&__pyx_n_s__mat, __pyx_k__mat, sizeof(__pyx_k__mat), 0, 0, 1, 1},
  {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1},
  {&__pyx_n_s__max_group, __pyx_k__max_group, sizeof(__pyx_k__max_group), 0, 0, 1, 1},
  {&__pyx_n_s__max_groups, __pyx_k__max_groups, sizeof(__pyx_k__max_groups), 0, 0, 1, 1},
  {&__pyx_n_s__max_subseq, __pyx_k__max_subseq, sizeof(__pyx_k__max_subseq), 0, 0, 1, 1},
  {&__pyx_n_s__maxx, __pyx_k__maxx, sizeof(__pyx_k__maxx), 0, 0, 1, 1},
  {&__pyx_n_s__meanx, __pyx_k__meanx, sizeof(__pyx_k__meanx), 0, 0, 1, 1},
  {&__pyx_n_s__meany, __pyx_k__meany, sizeof(__pyx_k__meany), 0, 0, 1, 1},
  {&__pyx_n_s__median, __pyx_k__median, sizeof(__pyx_k__median), 0, 0, 1, 1},
  {&__pyx_n_s__members, __pyx_k__members, sizeof(__pyx_k__members), 0, 0, 1, 1},
  {&__pyx_n_s__mergesort, __pyx_k__mergesort, sizeof(__pyx_k__mergesort), 0, 0, 1, 1},
  {&__pyx_n_s__microsecond, __pyx_k__microsecond, sizeof(__pyx_k__microsecond), 0, 0, 1, 1},
  {&__pyx_n_s__midpoint, __pyx_k__midpoint, sizeof(__pyx_k__midpoint), 0, 0, 1, 1},
  {&__pyx_n_s__min, __pyx_k__min, sizeof(__pyx_k__min), 0, 0, 1, 1},
  {&__pyx_n_s__min_subseq, __pyx_k__min_subseq, sizeof(__pyx_k__min_subseq), 0, 0, 1, 1},
  {&__pyx_n_s__minp, __pyx_k__minp, sizeof(__pyx_k__minp), 0, 0, 1, 1},
  {&__pyx_n_s__minpair, __pyx_k__minpair, sizeof(__pyx_k__minpair), 0, 0, 1, 1},
  {&__pyx_n_s__minute, __pyx_k__minute, sizeof(__pyx_k__minute), 0, 0, 1, 1},
  {&__pyx_n_s__minx, __pyx_k__minx, sizeof(__pyx_k__minx), 0, 0, 1, 1},
  {&__pyx_n_s__month, __pyx_k__month, sizeof(__pyx_k__month), 0, 0, 1, 1},
  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
  {&__pyx_n_s__n0, __pyx_k__n0, sizeof(__pyx_k__n0), 0, 0, 1, 1},
  {&__pyx_n_s__na_option, __pyx_k__na_option, sizeof(__pyx_k__na_option), 0, 0, 1, 1},
  {&__pyx_n_s__nan, __pyx_k__nan, sizeof(__pyx_k__nan), 0, 0, 1, 1},
  {&__pyx_n_s__nan_value, __pyx_k__nan_value, sizeof(__pyx_k__nan_value), 0, 0, 1, 1},
  {&__pyx_n_s__nancorr, __pyx_k__nancorr, sizeof(__pyx_k__nancorr), 0, 0, 1, 1},
  {&__pyx_n_s__nbins, __pyx_k__nbins, sizeof(__pyx_k__nbins), 0, 0, 1, 1},
  {&__pyx_n_s__neg_ct, __pyx_k__neg_ct, sizeof(__pyx_k__neg_ct), 0, 0, 1, 1},
  {&__pyx_n_s__new, __pyx_k__new, sizeof(__pyx_k__new), 0, 0, 1, 1},
  {&__pyx_n_s__neww, __pyx_k__neww, sizeof(__pyx_k__neww), 0, 0, 1, 1},
  {&__pyx_n_s__next, __pyx_k__next, sizeof(__pyx_k__next), 0, 0, 1, 1},
  {&__pyx_n_s__ngroups, __pyx_k__ngroups, sizeof(__pyx_k__ngroups), 0, 0, 1, 1},
  {&__pyx_n_s__nleft, __pyx_k__nleft, sizeof(__pyx_k__nleft), 0, 0, 1, 1},
  {&__pyx_n_s__nlevels, __pyx_k__nlevels, sizeof(__pyx_k__nlevels), 0, 0, 1, 1},
  {&__pyx_n_s__nobs, __pyx_k__nobs, sizeof(__pyx_k__nobs), 0, 0, 1, 1},
  {&__pyx_n_s__nonzero, __pyx_k__nonzero, sizeof(__pyx_k__nonzero), 0, 0, 1, 1},
  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
  {&__pyx_n_s__nright, __pyx_k__nright, sizeof(__pyx_k__nright), 0, 0, 1, 1},
  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__object_, __pyx_k__object_, sizeof(__pyx_k__object_), 0, 0, 1, 1},
  {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1},
  {&__pyx_n_s__old, __pyx_k__old, sizeof(__pyx_k__old), 0, 0, 1, 1},
  {&__pyx_n_s__oldbuf, __pyx_k__oldbuf, sizeof(__pyx_k__oldbuf), 0, 0, 1, 1},
  {&__pyx_n_s__oldw, __pyx_k__oldw, sizeof(__pyx_k__oldw), 0, 0, 1, 1},
  {&__pyx_n_s__ones_like, __pyx_k__ones_like, sizeof(__pyx_k__ones_like), 0, 0, 1, 1},
  {&__pyx_n_s__other, __pyx_k__other, sizeof(__pyx_k__other), 0, 0, 1, 1},
  {&__pyx_n_s__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1},
  {&__pyx_n_s__outbuf, __pyx_k__outbuf, sizeof(__pyx_k__outbuf), 0, 0, 1, 1},
  {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1},
  {&__pyx_n_s__pad_2d_inplace_bool, __pyx_k__pad_2d_inplace_bool, sizeof(__pyx_k__pad_2d_inplace_bool), 0, 0, 1, 1},
  {&__pyx_n_s__pad_bool, __pyx_k__pad_bool, sizeof(__pyx_k__pad_bool), 0, 0, 1, 1},
  {&__pyx_n_s__pad_float64, __pyx_k__pad_float64, sizeof(__pyx_k__pad_float64), 0, 0, 1, 1},
  {&__pyx_n_s__pad_inplace_bool, __pyx_k__pad_inplace_bool, sizeof(__pyx_k__pad_inplace_bool), 0, 0, 1, 1},
  {&__pyx_n_s__pad_inplace_float64, __pyx_k__pad_inplace_float64, sizeof(__pyx_k__pad_inplace_float64), 0, 0, 1, 1},
  {&__pyx_n_s__pad_inplace_int32, __pyx_k__pad_inplace_int32, sizeof(__pyx_k__pad_inplace_int32), 0, 0, 1, 1},
  {&__pyx_n_s__pad_inplace_int64, __pyx_k__pad_inplace_int64, sizeof(__pyx_k__pad_inplace_int64), 0, 0, 1, 1},
  {&__pyx_n_s__pad_inplace_object, __pyx_k__pad_inplace_object, sizeof(__pyx_k__pad_inplace_object), 0, 0, 1, 1},
  {&__pyx_n_s__pad_int32, __pyx_k__pad_int32, sizeof(__pyx_k__pad_int32), 0, 0, 1, 1},
  {&__pyx_n_s__pad_int64, __pyx_k__pad_int64, sizeof(__pyx_k__pad_int64), 0, 0, 1, 1},
  {&__pyx_n_s__pad_object, __pyx_k__pad_object, sizeof(__pyx_k__pad_object), 0, 0, 1, 1},
  {&__pyx_n_s__periods, __pyx_k__periods, sizeof(__pyx_k__periods), 0, 0, 1, 1},
  {&__pyx_n_s__position, __pyx_k__position, sizeof(__pyx_k__position), 0, 0, 1, 1},
  {&__pyx_n_s__pre, __pyx_k__pre, sizeof(__pyx_k__pre), 0, 0, 1, 1},
  {&__pyx_n_s__prev, __pyx_k__prev, sizeof(__pyx_k__prev), 0, 0, 1, 1},
  {&__pyx_n_s__prodx, __pyx_k__prodx, sizeof(__pyx_k__prodx), 0, 0, 1, 1},
  {&__pyx_n_s__ptr, __pyx_k__ptr, sizeof(__pyx_k__ptr), 0, 0, 1, 1},
  {&__pyx_n_s__put, __pyx_k__put, sizeof(__pyx_k__put), 0, 0, 1, 1},
  {&__pyx_n_s__putmask, __pyx_k__putmask, sizeof(__pyx_k__putmask), 0, 0, 1, 1},
  {&__pyx_n_s__pydatetime, __pyx_k__pydatetime, sizeof(__pyx_k__pydatetime), 0, 0, 1, 1},
  {&__pyx_n_s__quantile, __pyx_k__quantile, sizeof(__pyx_k__quantile), 0, 0, 1, 1},
  {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__rank, __pyx_k__rank, sizeof(__pyx_k__rank), 0, 0, 1, 1},
  {&__pyx_n_s__rank_1d_float64, __pyx_k__rank_1d_float64, sizeof(__pyx_k__rank_1d_float64), 0, 0, 1, 1},
  {&__pyx_n_s__rank_1d_generic, __pyx_k__rank_1d_generic, sizeof(__pyx_k__rank_1d_generic), 0, 0, 1, 1},
  {&__pyx_n_s__rank_1d_int64, __pyx_k__rank_1d_int64, sizeof(__pyx_k__rank_1d_int64), 0, 0, 1, 1},
  {&__pyx_n_s__rank_2d_float64, __pyx_k__rank_2d_float64, sizeof(__pyx_k__rank_2d_float64), 0, 0, 1, 1},
  {&__pyx_n_s__rank_2d_generic, __pyx_k__rank_2d_generic, sizeof(__pyx_k__rank_2d_generic), 0, 0, 1, 1},
  {&__pyx_n_s__rank_2d_int64, __pyx_k__rank_2d_int64, sizeof(__pyx_k__rank_2d_int64), 0, 0, 1, 1},
  {&__pyx_n_s__ranks, __pyx_k__ranks, sizeof(__pyx_k__ranks), 0, 0, 1, 1},
  {&__pyx_n_s__rc, __pyx_k__rc, sizeof(__pyx_k__rc), 0, 0, 1, 1},
  {&__pyx_n_s__remove, __pyx_k__remove, sizeof(__pyx_k__remove), 0, 0, 1, 1},
  {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1},
  {&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1},
  {&__pyx_n_s__resx, __pyx_k__resx, sizeof(__pyx_k__resx), 0, 0, 1, 1},
  {&__pyx_n_s__ret, __pyx_k__ret, sizeof(__pyx_k__ret), 0, 0, 1, 1},
  {&__pyx_n_s__retry, __pyx_k__retry, sizeof(__pyx_k__retry), 0, 0, 1, 1},
  {&__pyx_n_s__rev, __pyx_k__rev, sizeof(__pyx_k__rev), 0, 0, 1, 1},
  {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
  {&__pyx_n_s__right, __pyx_k__right, sizeof(__pyx_k__right), 0, 0, 1, 1},
  {&__pyx_n_s__right_count, __pyx_k__right_count, sizeof(__pyx_k__right_count), 0, 0, 1, 1},
  {&__pyx_n_s__right_indexer, __pyx_k__right_indexer, sizeof(__pyx_k__right_indexer), 0, 0, 1, 1},
  {&__pyx_n_s__right_pos, __pyx_k__right_pos, sizeof(__pyx_k__right_pos), 0, 0, 1, 1},
  {&__pyx_n_s__right_sorter, __pyx_k__right_sorter, sizeof(__pyx_k__right_sorter), 0, 0, 1, 1},
  {&__pyx_n_s__rindexer, __pyx_k__rindexer, sizeof(__pyx_k__rindexer), 0, 0, 1, 1},
  {&__pyx_n_s__ring, __pyx_k__ring, sizeof(__pyx_k__ring), 0, 0, 1, 1},
  {&__pyx_n_s__roll_generic, __pyx_k__roll_generic, sizeof(__pyx_k__roll_generic), 0, 0, 1, 1},
  {&__pyx_n_s__roll_kurt, __pyx_k__roll_kurt, sizeof(__pyx_k__roll_kurt), 0, 0, 1, 1},
  {&__pyx_n_s__roll_max, __pyx_k__roll_max, sizeof(__pyx_k__roll_max), 0, 0, 1, 1},
  {&__pyx_n_s__roll_max2, __pyx_k__roll_max2, sizeof(__pyx_k__roll_max2), 0, 0, 1, 1},
  {&__pyx_n_s__roll_mean, __pyx_k__roll_mean, sizeof(__pyx_k__roll_mean), 0, 0, 1, 1},
  {&__pyx_n_s__roll_median_c, __pyx_k__roll_median_c, sizeof(__pyx_k__roll_median_c), 0, 0, 1, 1},
  {&__pyx_n_s__roll_median_cython, __pyx_k__roll_median_cython, sizeof(__pyx_k__roll_median_cython), 0, 0, 1, 1},
  {&__pyx_n_s__roll_min, __pyx_k__roll_min, sizeof(__pyx_k__roll_min), 0, 0, 1, 1},
  {&__pyx_n_s__roll_min2, __pyx_k__roll_min2, sizeof(__pyx_k__roll_min2), 0, 0, 1, 1},
  {&__pyx_n_s__roll_quantile, __pyx_k__roll_quantile, sizeof(__pyx_k__roll_quantile), 0, 0, 1, 1},
  {&__pyx_n_s__roll_skew, __pyx_k__roll_skew, sizeof(__pyx_k__roll_skew), 0, 0, 1, 1},
  {&__pyx_n_s__roll_sum, __pyx_k__roll_sum, sizeof(__pyx_k__roll_sum), 0, 0, 1, 1},
  {&__pyx_n_s__roll_var, __pyx_k__roll_var, sizeof(__pyx_k__roll_var), 0, 0, 1, 1},
  {&__pyx_n_s__roll_window, __pyx_k__roll_window, sizeof(__pyx_k__roll_window), 0, 0, 1, 1},
  {&__pyx_n_s__rval, __pyx_k__rval, sizeof(__pyx_k__rval), 0, 0, 1, 1},
  {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1},
  {&__pyx_n_s__second, __pyx_k__second, sizeof(__pyx_k__second), 0, 0, 1, 1},
  {&__pyx_n_s__seen, __pyx_k__seen, sizeof(__pyx_k__seen), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__skiplist, __pyx_k__skiplist, sizeof(__pyx_k__skiplist), 0, 0, 1, 1},
  {&__pyx_n_s__sl, __pyx_k__sl, sizeof(__pyx_k__sl), 0, 0, 1, 1},
  {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1},
  {&__pyx_n_s__sorted_data, __pyx_k__sorted_data, sizeof(__pyx_k__sorted_data), 0, 0, 1, 1},
  {&__pyx_n_s__sorter, __pyx_k__sorter, sizeof(__pyx_k__sorter), 0, 0, 1, 1},
  {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
  {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1},
  {&__pyx_n_s__sum_ranks, __pyx_k__sum_ranks, sizeof(__pyx_k__sum_ranks), 0, 0, 1, 1},
  {&__pyx_n_s__sum_x, __pyx_k__sum_x, sizeof(__pyx_k__sum_x), 0, 0, 1, 1},
  {&__pyx_n_s__sum_xx, __pyx_k__sum_xx, sizeof(__pyx_k__sum_xx), 0, 0, 1, 1},
  {&__pyx_n_s__sumx, __pyx_k__sumx, sizeof(__pyx_k__sumx), 0, 0, 1, 1},
  {&__pyx_n_s__sumxx, __pyx_k__sumxx, sizeof(__pyx_k__sumxx), 0, 0, 1, 1},
  {&__pyx_n_s__sumy, __pyx_k__sumy, sizeof(__pyx_k__sumy), 0, 0, 1, 1},
  {&__pyx_n_s__sumyy, __pyx_k__sumyy, sizeof(__pyx_k__sumyy), 0, 0, 1, 1},
  {&__pyx_n_s__sx, __pyx_k__sx, sizeof(__pyx_k__sx), 0, 0, 1, 1},
  {&__pyx_n_s__sy, __pyx_k__sy, sizeof(__pyx_k__sy), 0, 0, 1, 1},
  {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1},
  {&__pyx_n_s__take, __pyx_k__take, sizeof(__pyx_k__take), 0, 0, 1, 1},
  {&__pyx_n_s__take_1d_bool, __pyx_k__take_1d_bool, sizeof(__pyx_k__take_1d_bool), 0, 0, 1, 1},
  {&__pyx_n_s__take_1d_float64, __pyx_k__take_1d_float64, sizeof(__pyx_k__take_1d_float64), 0, 0, 1, 1},
  {&__pyx_n_s__take_1d_int32, __pyx_k__take_1d_int32, sizeof(__pyx_k__take_1d_int32), 0, 0, 1, 1},
  {&__pyx_n_s__take_1d_int64, __pyx_k__take_1d_int64, sizeof(__pyx_k__take_1d_int64), 0, 0, 1, 1},
  {&__pyx_n_s__take_1d_object, __pyx_k__take_1d_object, sizeof(__pyx_k__take_1d_object), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis0_bool, __pyx_k__take_2d_axis0_bool, sizeof(__pyx_k__take_2d_axis0_bool), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis0_int32, __pyx_k__take_2d_axis0_int32, sizeof(__pyx_k__take_2d_axis0_int32), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis0_int64, __pyx_k__take_2d_axis0_int64, sizeof(__pyx_k__take_2d_axis0_int64), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis1_bool, __pyx_k__take_2d_axis1_bool, sizeof(__pyx_k__take_2d_axis1_bool), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis1_int32, __pyx_k__take_2d_axis1_int32, sizeof(__pyx_k__take_2d_axis1_int32), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_axis1_int64, __pyx_k__take_2d_axis1_int64, sizeof(__pyx_k__take_2d_axis1_int64), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_multi_bool, __pyx_k__take_2d_multi_bool, sizeof(__pyx_k__take_2d_multi_bool), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_multi_int32, __pyx_k__take_2d_multi_int32, sizeof(__pyx_k__take_2d_multi_int32), 0, 0, 1, 1},
  {&__pyx_n_s__take_2d_multi_int64, __pyx_k__take_2d_multi_int64, sizeof(__pyx_k__take_2d_multi_int64), 0, 0, 1, 1},
  {&__pyx_n_s__tiebreak, __pyx_k__tiebreak, sizeof(__pyx_k__tiebreak), 0, 0, 1, 1},
  {&__pyx_n_s__tiebreakers, __pyx_k__tiebreakers, sizeof(__pyx_k__tiebreakers), 0, 0, 1, 1},
  {&__pyx_n_s__ties_method, __pyx_k__ties_method, sizeof(__pyx_k__ties_method), 0, 0, 1, 1},
  {&__pyx_n_s__top, __pyx_k__top, sizeof(__pyx_k__top), 0, 0, 1, 1},
  {&__pyx_n_s__tot_wgt, __pyx_k__tot_wgt, sizeof(__pyx_k__tot_wgt), 0, 0, 1, 1},
  {&__pyx_n_s__uint8, __pyx_k__uint8, sizeof(__pyx_k__uint8), 0, 0, 1, 1},
  {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1},
  {&__pyx_n_s__val_in, __pyx_k__val_in, sizeof(__pyx_k__val_in), 0, 0, 1, 1},
  {&__pyx_n_s__val_win, __pyx_k__val_win, sizeof(__pyx_k__val_win), 0, 0, 1, 1},
  {&__pyx_n_s__valid_locs, __pyx_k__valid_locs, sizeof(__pyx_k__valid_locs), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1},
  {&__pyx_n_s__vclose, __pyx_k__vclose, sizeof(__pyx_k__vclose), 0, 0, 1, 1},
  {&__pyx_n_s__vecs, __pyx_k__vecs, sizeof(__pyx_k__vecs), 0, 0, 1, 1},
  {&__pyx_n_s__vhigh, __pyx_k__vhigh, sizeof(__pyx_k__vhigh), 0, 0, 1, 1},
  {&__pyx_n_s__view, __pyx_k__view, sizeof(__pyx_k__view), 0, 0, 1, 1},
  {&__pyx_n_s__vlow, __pyx_k__vlow, sizeof(__pyx_k__vlow), 0, 0, 1, 1},
  {&__pyx_n_s__vopen, __pyx_k__vopen, sizeof(__pyx_k__vopen), 0, 0, 1, 1},
  {&__pyx_n_s__vx, __pyx_k__vx, sizeof(__pyx_k__vx), 0, 0, 1, 1},
  {&__pyx_n_s__vy, __pyx_k__vy, sizeof(__pyx_k__vy), 0, 0, 1, 1},
  {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
  {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1},
  {&__pyx_n_s__where, __pyx_k__where, sizeof(__pyx_k__where), 0, 0, 1, 1},
  {&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
  {&__pyx_n_s__win, __pyx_k__win, sizeof(__pyx_k__win), 0, 0, 1, 1},
  {&__pyx_n_s__win_i, __pyx_k__win_i, sizeof(__pyx_k__win_i), 0, 0, 1, 1},
  {&__pyx_n_s__win_k, __pyx_k__win_k, sizeof(__pyx_k__win_k), 0, 0, 1, 1},
  {&__pyx_n_s__win_n, __pyx_k__win_n, sizeof(__pyx_k__win_n), 0, 0, 1, 1},
  {&__pyx_n_s__window, __pyx_k__window, sizeof(__pyx_k__window), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xi, __pyx_k__xi, sizeof(__pyx_k__xi), 0, 0, 1, 1},
  {&__pyx_n_s__xx, __pyx_k__xx, sizeof(__pyx_k__xx), 0, 0, 1, 1},
  {&__pyx_n_s__xxx, __pyx_k__xxx, sizeof(__pyx_k__xxx), 0, 0, 1, 1},
  {&__pyx_n_s__xxxx, __pyx_k__xxxx, sizeof(__pyx_k__xxxx), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__year, __pyx_k__year, sizeof(__pyx_k__year), 0, 0, 1, 1},
  {&__pyx_n_s__yi, __pyx_k__yi, sizeof(__pyx_k__yi), 0, 0, 1, 1},
  {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1},
  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
  {&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_KeyError = __Pyx_GetName(__pyx_b, __pyx_n_s__KeyError); if (!__pyx_builtin_KeyError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "pandas/src/skiplist.pyx":138
 * 
 *         if value != (<Node> (<Node> (<Node> chain[0]).next)[0]).value:
 *             raise KeyError('Not Found')             # <<<<<<<<<<<<<<
 * 
 *         # remove one link at each level
 */
  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "pandas/algos.pyx":161
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
  __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_4);
  __Pyx_GIVEREF(__pyx_k_slice_4);

  /* "pandas/algos.pyx":164
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));

  /* "pandas/algos.pyx":224
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
  __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_7);
  __Pyx_GIVEREF(__pyx_k_slice_7);

  /* "pandas/algos.pyx":227
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_8);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));

  /* "pandas/algos.pyx":295
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_10);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "pandas/algos.pyx":298
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_float64(values, _as)
 */
  __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_11);
  __Pyx_GIVEREF(__pyx_k_slice_11);
  __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_12);
  __Pyx_GIVEREF(__pyx_k_slice_12);
  __pyx_k_tuple_13 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_13);
  __Pyx_INCREF(__pyx_k_slice_11);
  PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, __pyx_k_slice_11);
  __Pyx_GIVEREF(__pyx_k_slice_11);
  __Pyx_INCREF(__pyx_k_slice_12);
  PyTuple_SET_ITEM(__pyx_k_tuple_13, 1, __pyx_k_slice_12);
  __Pyx_GIVEREF(__pyx_k_slice_12);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));

  /* "pandas/algos.pyx":301
 * 
 *     values = _take_2d_float64(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_14);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));

  /* "pandas/algos.pyx":366
 *             tiebreak = TIEBREAK_FIRST_DESCENDING
 *     else:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 * 
 *     if not ascending:
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_16);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "pandas/algos.pyx":369
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_int64(values, _as)
 */
  __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_17);
  __Pyx_GIVEREF(__pyx_k_slice_17);
  __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_18);
  __Pyx_GIVEREF(__pyx_k_slice_18);
  __pyx_k_tuple_19 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_19);
  __Pyx_INCREF(__pyx_k_slice_17);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_k_slice_17);
  __Pyx_GIVEREF(__pyx_k_slice_17);
  __Pyx_INCREF(__pyx_k_slice_18);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, __pyx_k_slice_18);
  __Pyx_GIVEREF(__pyx_k_slice_18);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "pandas/algos.pyx":372
 * 
 *     values = _take_2d_int64(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_20);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "pandas/algos.pyx":427
 * 
 *     if values.dtype != np.object_:
 *         values = values.astype('O')             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_22);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__O));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__O));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__O));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "pandas/algos.pyx":456
 * 
 *     if not ascending:
 *         _as = _as[::-1]             # <<<<<<<<<<<<<<
 * 
 *     sorted_data = values.take(_as)
 */
  __pyx_k_slice_23 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_23);
  __Pyx_GIVEREF(__pyx_k_slice_23);

  /* "pandas/algos.pyx":459
 * 
 *     sorted_data = values.take(_as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_24);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));

  /* "pandas/algos.pyx":480
 *                     ranks[argsorted[j]] = i + 1
 *             elif tiebreak == TIEBREAK_FIRST:
 *                 raise ValueError('first not supported for non-numeric data')             # <<<<<<<<<<<<<<
 *             sum_ranks = dups = 0
 *     return ranks
 */
  __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_26);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));

  /* "pandas/algos.pyx":541
 * 
 *     if values.dtype != np.object_:
 *         values = values.astype('O')             # <<<<<<<<<<<<<<
 * 
 *     if ascending ^ (na_option == 'top'):
 */
  __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_28);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__O));
  PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__O));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__O));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));

  /* "pandas/algos.pyx":556
 * 
 *     try:
 *         _as = values.argsort(1)             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         values = in_arr
 */
  __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_29);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "pandas/algos.pyx":569
 * 
 *     if not ascending:
 *         _as = _as[:, ::-1]             # <<<<<<<<<<<<<<
 * 
 *     values = _take_2d_object(values, _as)
 */
  __pyx_k_slice_30 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_30);
  __Pyx_GIVEREF(__pyx_k_slice_30);
  __pyx_k_slice_31 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_slice_31);
  __Pyx_GIVEREF(__pyx_k_slice_31);
  __pyx_k_tuple_32 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_32);
  __Pyx_INCREF(__pyx_k_slice_30);
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, __pyx_k_slice_30);
  __Pyx_GIVEREF(__pyx_k_slice_30);
  __Pyx_INCREF(__pyx_k_slice_31);
  PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, __pyx_k_slice_31);
  __Pyx_GIVEREF(__pyx_k_slice_31);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));

  /* "pandas/algos.pyx":572
 * 
 *     values = _take_2d_object(values, _as)
 *     argsorted = _as.astype('i8')             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_33);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i8));
  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));

  /* "pandas/algos.pyx":595
 *                         ranks[i, argsorted[i, z]] = j + 1
 *                 elif tiebreak == TIEBREAK_FIRST:
 *                     raise ValueError('first not supported for '             # <<<<<<<<<<<<<<
 *                                      'non-numeric data')
 *                 sum_ranks = dups = 0
 */
  __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_34);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));

  /* "pandas/algos.pyx":773
 *         minp = 1
 *     elif minp < 0:
 *         raise ValueError('min_periods must be >= 0')             # <<<<<<<<<<<<<<
 *     return minp
 * 
 */
  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_37);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));

  /* "pandas/algos.pyx":876
 * 
 *     if len(arr) == 0:
 *         return (-1,-1,None)             # <<<<<<<<<<<<<<
 * 
 *     m = arr[0]
 */
  __pyx_k_tuple_38 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_38);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_38, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));

  /* "pandas/algos.pyx":1630
 * cdef double_t _get_min(object skiplist, int nobs, int minp):
 *     if nobs >= minp:
 *         return <IndexableSkiplist> skiplist.get(0)             # <<<<<<<<<<<<<<
 *     else:
 *         return NaN
 */
  __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_42);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));

  /* "pandas/algos.pyx":1688
 * 
 *     if not input.flags.c_contiguous:
 *         input = input.copy('C')             # <<<<<<<<<<<<<<
 * 
 *     buf = <float64_t*> input.data
 */
  __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_43);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__C));
  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_n_s__C));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "pandas/algos.pyx":2968
 * 
 *     if out.shape[1] != 4:
 *         raise ValueError('Output array must have 4 columns')             # <<<<<<<<<<<<<<
 * 
 *     NA = np.nan
 */
  __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_46);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
  PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));

  /* "pandas/src/join.pyx":193
 *         # length-0 case
 *         res = np.empty(len(indexer), dtype=np.int64)
 *         res.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     return res
 */
  __pyx_k_tuple_48 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_48);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48));

  /* "pandas/src/join.pyx":229
 * 
 *     last_obs = np.empty(max_group, dtype=np.int64)
 *     last_obs.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(n):
 */
  __pyx_k_tuple_49 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_49);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));

  /* "pandas/src/generated.pyx":213
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_50);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));

  /* "pandas/src/generated.pyx":219
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_52 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_52);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));

  /* "pandas/src/generated.pyx":274
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_53);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));

  /* "pandas/src/generated.pyx":280
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_54);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));

  /* "pandas/src/generated.pyx":335
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));

  /* "pandas/src/generated.pyx":341
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_56);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));

  /* "pandas/src/generated.pyx":396
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_57);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));

  /* "pandas/src/generated.pyx":402
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_58);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));

  /* "pandas/src/generated.pyx":457
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_59);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));

  /* "pandas/src/generated.pyx":463
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_60);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));

  /* "pandas/src/generated.pyx":519
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_61);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));

  /* "pandas/src/generated.pyx":525
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_62);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));

  /* "pandas/src/generated.pyx":581
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_63);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));

  /* "pandas/src/generated.pyx":587
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_64);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));

  /* "pandas/src/generated.pyx":643
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_65);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));

  /* "pandas/src/generated.pyx":649
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_66);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));

  /* "pandas/src/generated.pyx":705
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_67);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));

  /* "pandas/src/generated.pyx":711
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_68);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));

  /* "pandas/src/generated.pyx":767
 *     nright = len(new)
 *     indexer = np.empty(nright, dtype=np.int64)
 *     indexer.fill(-1)             # <<<<<<<<<<<<<<
 * 
 *     if limit is None:
 */
  __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_69);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));

  /* "pandas/src/generated.pyx":773
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_70);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));

  /* "pandas/src/generated.pyx":833
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_71);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71));

  /* "pandas/src/generated.pyx":862
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_72);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));

  /* "pandas/src/generated.pyx":891
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_73);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));

  /* "pandas/src/generated.pyx":920
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_74);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74));

  /* "pandas/src/generated.pyx":949
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_75);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));

  /* "pandas/src/generated.pyx":979
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_76);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));

  /* "pandas/src/generated.pyx":1007
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_77 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_77);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));

  /* "pandas/src/generated.pyx":1035
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_78);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));

  /* "pandas/src/generated.pyx":1063
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_79 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_79)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_79);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_79, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_79));

  /* "pandas/src/generated.pyx":1091
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_80);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));

  /* "pandas/src/generated.pyx":1120
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_81);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));

  /* "pandas/src/generated.pyx":1150
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_82);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));

  /* "pandas/src/generated.pyx":1180
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_83 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_83);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_83, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));

  /* "pandas/src/generated.pyx":1210
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_84);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84));

  /* "pandas/src/generated.pyx":1240
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_85 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_85)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_85);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_85, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_85));

  /* "pandas/src/generated.pyx":1271
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_86 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_86)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_86);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_86, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_86));

  /* "pandas/src/generated.pyx":1301
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_87 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_87);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_87, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));

  /* "pandas/src/generated.pyx":1331
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_88 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_88);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88));

  /* "pandas/src/generated.pyx":1361
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_89 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_89)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_89);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_89, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_89));

  /* "pandas/src/generated.pyx":1391
 *     else:
 *         if limit < 0:
 *             raise ValueError('Limit must be non-negative')             # <<<<<<<<<<<<<<
 *         lim = limit
 * 
 */
  __pyx_k_tuple_90 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_90);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_90, 0, ((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));

  /* "pandas/src/generated.pyx":1427
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
  __pyx_k_tuple_93 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_93);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_93, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93));

  /* "pandas/src/generated.pyx":1459
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
  __pyx_k_tuple_95 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_95)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_95);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_95, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_95));

  /* "pandas/src/generated.pyx":1491
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
  __pyx_k_tuple_97 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_97)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_97);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_97, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_97));

  /* "pandas/src/generated.pyx":1523
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
  __pyx_k_tuple_99 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_99)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_99);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_99, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_99));

  /* "pandas/src/generated.pyx":1555
 *             idx = indexer[i]
 *             if idx == -1:
 *                 raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 outbuf[i] = values[idx]
 */
  __pyx_k_tuple_101 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_101)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_101);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_101, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_101));

  /* "pandas/src/generated.pyx":1929
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
  __pyx_k_tuple_105 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_105)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_105);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_105, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_105));

  /* "pandas/src/generated.pyx":1967
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
  __pyx_k_tuple_107 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_107)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_107);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_107, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_107));

  /* "pandas/src/generated.pyx":2005
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
  __pyx_k_tuple_109 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_109)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2005; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_109);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_109, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_109));

  /* "pandas/src/generated.pyx":2043
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
  __pyx_k_tuple_111 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_111)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_111);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_111, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_111));

  /* "pandas/src/generated.pyx":2081
 *             if idx == -1:
 *                 for j from 0 <= j < k:
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j from 0 <= j < k:
 */
  __pyx_k_tuple_113 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_113)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_113);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_113, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_113));

  /* "pandas/src/generated.pyx":2121
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
  __pyx_k_tuple_115 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_115)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_115);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_115, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_115));

  /* "pandas/src/generated.pyx":2161
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
  __pyx_k_tuple_117 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_117)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_117);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_117, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_117));

  /* "pandas/src/generated.pyx":2201
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
  __pyx_k_tuple_119 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_119)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_119);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_119, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_119));

  /* "pandas/src/generated.pyx":2241
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
  __pyx_k_tuple_121 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_121)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_121);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_121, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_121));

  /* "pandas/src/generated.pyx":2281
 *             if idx == -1:
 *                 for i in range(n):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for i in range(n):
 */
  __pyx_k_tuple_123 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_123)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_123);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_123, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_123));

  /* "pandas/src/generated.pyx":2323
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
  __pyx_k_tuple_125 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_125)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_125);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_125, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_125));

  /* "pandas/src/generated.pyx":2327
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
  __pyx_k_tuple_126 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_126)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_126);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_126, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_126));

  /* "pandas/src/generated.pyx":2369
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
  __pyx_k_tuple_128 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_128)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_128);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_128, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_128));

  /* "pandas/src/generated.pyx":2373
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
  __pyx_k_tuple_129 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_129)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_129);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_129, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_129));

  /* "pandas/src/generated.pyx":2415
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
  __pyx_k_tuple_131 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_131)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_131);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_131, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_131));

  /* "pandas/src/generated.pyx":2419
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
  __pyx_k_tuple_132 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_132)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_132);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_132, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_132));

  /* "pandas/src/generated.pyx":2461
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
  __pyx_k_tuple_134 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_134)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_134);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_134, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_134));

  /* "pandas/src/generated.pyx":2465
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
  __pyx_k_tuple_135 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_135)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_135);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_135, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_135));

  /* "pandas/src/generated.pyx":2507
 *             if idx == -1:
 *                 for j in range(k):
 *                     raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *             else:
 *                 for j in range(k):
 */
  __pyx_k_tuple_137 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_137)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_137);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_137, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_137));

  /* "pandas/src/generated.pyx":2511
 *                 for j in range(k):
 *                     if idx1[j] == -1:
 *                         raise ValueError('No NA values allowed')             # <<<<<<<<<<<<<<
 *                     else:
 *                         outbuf[i, j] = values[idx, idx1[j]]
 */
  __pyx_k_tuple_138 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_138)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_138);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_92));
  PyTuple_SET_ITEM(__pyx_k_tuple_138, 0, ((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_92));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_138));

  /* "numpy.pxd":216
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_k_tuple_141 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_141)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_141);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_140));
  PyTuple_SET_ITEM(__pyx_k_tuple_141, 0, ((PyObject *)__pyx_kp_u_140));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_140));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_141));

  /* "numpy.pxd":220
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_k_tuple_143 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_143)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_143);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_142));
  PyTuple_SET_ITEM(__pyx_k_tuple_143, 0, ((PyObject *)__pyx_kp_u_142));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_142));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_143));

  /* "numpy.pxd":258
 *                 if ((descr.byteorder == '>' and little_endian) or
 *                     (descr.byteorder == '<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_k_tuple_145 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_145)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_145);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_144));
  PyTuple_SET_ITEM(__pyx_k_tuple_145, 0, ((PyObject *)__pyx_kp_u_144));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_144));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_145));

  /* "numpy.pxd":800
 * 
 *         if (end - f) - (new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == '>' and little_endian) or
 */
  __pyx_k_tuple_148 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_148)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_148);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_147));
  PyTuple_SET_ITEM(__pyx_k_tuple_148, 0, ((PyObject *)__pyx_kp_u_147));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_147));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_148));

  /* "numpy.pxd":804
 *         if ((child.byteorder == '>' and little_endian) or
 *             (child.byteorder == '<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_k_tuple_149 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_149)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_149);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_144));
  PyTuple_SET_ITEM(__pyx_k_tuple_149, 0, ((PyObject *)__pyx_kp_u_144));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_144));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_149));

  /* "numpy.pxd":824
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_k_tuple_151 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_151)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_151);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_150));
  PyTuple_SET_ITEM(__pyx_k_tuple_151, 0, ((PyObject *)__pyx_kp_u_150));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_150));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_151));

  /* "util.pxd":39
 *         i += sz
 *     elif i >= sz or sz == 0:
 *         raise IndexError('index out of bounds')             # <<<<<<<<<<<<<<
 * 
 *     return get_value_1d(arr, i)
 */
  __pyx_k_tuple_153 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_153)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_153);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_152));
  PyTuple_SET_ITEM(__pyx_k_tuple_153, 0, ((PyObject *)__pyx_kp_s_152));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_152));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_153));

  /* "util.pxd":56
 *         i += sz
 *     elif i >= sz:
 *         raise IndexError('index out of bounds')             # <<<<<<<<<<<<<<
 * 
 *     assign_value_1d(arr, i, value)
 */
  __pyx_k_tuple_154 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_154)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_154);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_152));
  PyTuple_SET_ITEM(__pyx_k_tuple_154, 0, ((PyObject *)__pyx_kp_s_152));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_152));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_154));

  /* "pandas/algos.pyx":121
 * 
 * 
 * def rank_1d_float64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                     na_option='keep'):
 *     """
 */
  __pyx_k_tuple_156 = PyTuple_New(19); if (unlikely(!__pyx_k_tuple_156)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_156);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 1, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 2, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 3, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 6, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 7, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sorted_data));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 8, ((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 9, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 10, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 11, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 12, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nan_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 13, ((PyObject *)__pyx_n_s__nan_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nan_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 14, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 15, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__keep_na));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 16, ((PyObject *)__pyx_n_s__keep_na));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__keep_na));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 17, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_156, 18, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_156));
  __pyx_k_codeobj_157 = (PyObject*)__Pyx_PyCode_New(4, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_156, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_1d_float64, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_157)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":193
 * 
 * 
 * def rank_1d_int64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                   na_option='keep'):
 *     """
 */
  __pyx_k_tuple_160 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_160)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_160);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 1, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 2, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 3, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 6, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 7, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sorted_data));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 8, ((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 9, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 10, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 11, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 12, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 13, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 14, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_160, 15, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_160));
  __pyx_k_codeobj_161 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_160, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_1d_int64, 193, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_161)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":253
 * 
 * 
 * def rank_2d_float64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_k_tuple_162 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_162)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_162);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 1, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 2, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 3, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 4, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 7, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 8, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 9, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 10, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 11, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 12, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 13, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 14, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nan_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 15, ((PyObject *)__pyx_n_s__nan_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nan_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 16, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 17, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__keep_na));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 18, ((PyObject *)__pyx_n_s__keep_na));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__keep_na));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_162, 19, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_162));
  __pyx_k_codeobj_163 = (PyObject*)__Pyx_PyCode_New(5, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_162, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_2d_float64, 253, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_163)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":336
 * 
 * 
 * def rank_2d_int64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_k_tuple_164 = PyTuple_New(18); if (unlikely(!__pyx_k_tuple_164)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_164);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 1, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 2, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 3, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 4, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 7, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 8, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 9, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 10, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 11, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 12, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 13, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 14, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 15, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 16, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_164, 17, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_164));
  __pyx_k_codeobj_165 = (PyObject*)__Pyx_PyCode_New(5, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_164, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_2d_int64, 336, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_165)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":404
 * 
 * 
 * def rank_1d_generic(object in_arr, bint retry=1, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_k_tuple_166 = PyTuple_New(21); if (unlikely(!__pyx_k_tuple_166)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_166);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__retry));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 1, ((PyObject *)__pyx_n_s__retry));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__retry));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 2, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 3, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 4, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 8, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 9, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sorted_data));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 10, ((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sorted_data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 11, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 12, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 13, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nan_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 14, ((PyObject *)__pyx_n_s__nan_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nan_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 15, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 16, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__keep_na));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 17, ((PyObject *)__pyx_n_s__keep_na));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__keep_na));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 18, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 19, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__valid_locs));
  PyTuple_SET_ITEM(__pyx_k_tuple_166, 20, ((PyObject *)__pyx_n_s__valid_locs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__valid_locs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_166));
  __pyx_k_codeobj_167 = (PyObject*)__Pyx_PyCode_New(5, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_166, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_1d_generic, 404, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_167)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":513
 *     __cmp__ = _return_true
 * 
 * def rank_2d_generic(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_k_tuple_168 = PyTuple_New(22); if (unlikely(!__pyx_k_tuple_168)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_168);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 0, ((PyObject *)__pyx_n_s__in_arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 1, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ties_method));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 2, ((PyObject *)__pyx_n_s__ties_method));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ties_method));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ascending));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 3, ((PyObject *)__pyx_n_s__ascending));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascending));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__na_option));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 4, ((PyObject *)__pyx_n_s__na_option));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__na_option));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__z));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 7, ((PyObject *)__pyx_n_s__z));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 8, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 9, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__infs));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 10, ((PyObject *)__pyx_n_s__infs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__infs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dups));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 11, ((PyObject *)__pyx_n_s__dups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 12, ((PyObject *)__pyx_n_s__ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 13, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__argsorted));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 14, ((PyObject *)__pyx_n_s__argsorted));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__argsorted));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 15, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nan_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 16, ((PyObject *)__pyx_n_s__nan_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nan_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_ranks));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 17, ((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_ranks));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tiebreak));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 18, ((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tiebreak));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__keep_na));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 19, ((PyObject *)__pyx_n_s__keep_na));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__keep_na));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 20, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___as));
  PyTuple_SET_ITEM(__pyx_k_tuple_168, 21, ((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___as));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_168));
  __pyx_k_codeobj_169 = (PyObject*)__Pyx_PyCode_New(5, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__rank_2d_generic, 513, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_169)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_float64(ndarray[float64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                     ndarray[float64_t, ndim=2] out,
 *                     Py_ssize_t periods, int axis):
 */
  __pyx_k_tuple_170 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_170)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_170);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 1, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__periods));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 2, ((PyObject *)__pyx_n_s__periods));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__periods));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 3, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sx));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 6, ((PyObject *)__pyx_n_s__sx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sy));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 7, ((PyObject *)__pyx_n_s__sy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 8, ((PyObject *)__pyx_n_s__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__stop));
  PyTuple_SET_ITEM(__pyx_k_tuple_170, 9, ((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_170));
  __pyx_k_codeobj_171 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_170, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__diff_2d_float64, 621, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_171)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":665
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int64(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */
  __pyx_k_tuple_172 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_172)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_172);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 1, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__periods));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 2, ((PyObject *)__pyx_n_s__periods));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__periods));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 3, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sx));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 6, ((PyObject *)__pyx_n_s__sx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sy));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 7, ((PyObject *)__pyx_n_s__sy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 8, ((PyObject *)__pyx_n_s__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__stop));
  PyTuple_SET_ITEM(__pyx_k_tuple_172, 9, ((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_172));
  __pyx_k_codeobj_173 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_172, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__diff_2d_int64, 665, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_173)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":710
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int32(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */
  __pyx_k_tuple_174 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_174)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_174);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 1, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__periods));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 2, ((PyObject *)__pyx_n_s__periods));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__periods));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__axis));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 3, ((PyObject *)__pyx_n_s__axis));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sx));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 6, ((PyObject *)__pyx_n_s__sx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sy));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 7, ((PyObject *)__pyx_n_s__sy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__start));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 8, ((PyObject *)__pyx_n_s__start));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__stop));
  PyTuple_SET_ITEM(__pyx_k_tuple_174, 9, ((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stop));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_174));
  __pyx_k_codeobj_175 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_174, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__diff_2d_int32, 710, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_175)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":764
 * # -
 * 
 * def _check_minp(win, minp, N):             # <<<<<<<<<<<<<<
 *     if minp > win:
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 */
  __pyx_k_tuple_176 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_176)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_176);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_176, 0, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_176, 1, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_176, 2, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_176));
  __pyx_k_codeobj_177 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_176, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s___check_minp, 764, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_177)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":791
 * #               Series: Prentice-Hall Series in Automatic Computation
 * 
 * def kth_smallest(ndarray[double_t] a, Py_ssize_t k):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i,j,l,m,n
 */
  __pyx_k_tuple_178 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_178)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_178);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 0, ((PyObject *)__pyx_n_s__a));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 1, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 4, ((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 5, ((PyObject *)__pyx_n_s__m));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 6, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 7, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__t));
  PyTuple_SET_ITEM(__pyx_k_tuple_178, 8, ((PyObject *)__pyx_n_s__t));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_178));
  __pyx_k_codeobj_179 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__kth_smallest, 791, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_179)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":848
 * 
 * 
 * def median(ndarray arr):             # <<<<<<<<<<<<<<
 *     '''
 *     A faster median
 */
  __pyx_k_tuple_180 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_180)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_180);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_180, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_180, 1, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_180));
  __pyx_k_codeobj_181 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__median, 848, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_181)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":868
 * # -------------- Min, Max subsequence
 * 
 * def max_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i=0,s=0,e=0,T,n
 */
  __pyx_k_tuple_182 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_182)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_182);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 2, ((PyObject *)__pyx_n_s__s));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__e));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 3, ((PyObject *)__pyx_n_s__e));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__e));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__T));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 4, ((PyObject *)__pyx_n_s__T));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 6, ((PyObject *)__pyx_n_s__m));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__S));
  PyTuple_SET_ITEM(__pyx_k_tuple_182, 7, ((PyObject *)__pyx_n_s__S));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_182));
  __pyx_k_codeobj_183 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__max_subseq, 868, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_183)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":896
 *     return (s, e, m)
 * 
 * def min_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t s, e
 */
  __pyx_k_tuple_184 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_184)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_184);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_184, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__s));
  PyTuple_SET_ITEM(__pyx_k_tuple_184, 1, ((PyObject *)__pyx_n_s__s));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__e));
  PyTuple_SET_ITEM(__pyx_k_tuple_184, 2, ((PyObject *)__pyx_n_s__e));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__e));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__m));
  PyTuple_SET_ITEM(__pyx_k_tuple_184, 3, ((PyObject *)__pyx_n_s__m));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_184));
  __pyx_k_codeobj_185 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__min_subseq, 896, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_185)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":908
 * # Rolling sum
 * 
 * def roll_sum(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 */
  __pyx_k_tuple_186 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_186)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_186);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 3, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 4, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_x));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 5, ((PyObject *)__pyx_n_s__sum_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 6, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 7, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 8, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_186, 9, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_186));
  __pyx_k_codeobj_187 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_186, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_sum, 908, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_187)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":950
 * # Rolling mean
 * 
 * def roll_mean(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef:
 */
  __pyx_k_tuple_188 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_188)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_188);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 3, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 4, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 5, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_x));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 6, ((PyObject *)__pyx_n_s__sum_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 7, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 8, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__neg_ct));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 9, ((PyObject *)__pyx_n_s__neg_ct));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__neg_ct));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 10, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_188, 11, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_188));
  __pyx_k_codeobj_189 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_188, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_mean, 950, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_189)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1007
 * # Exponentially weighted moving average
 * 
 * def ewma(ndarray[double_t] input, double_t com, int adjust):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute exponentially-weighted moving average using center-of-mass.
 */
  __pyx_k_tuple_190 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_190)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_190);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__com));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 1, ((PyObject *)__pyx_n_s__com));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__com));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__adjust));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 2, ((PyObject *)__pyx_n_s__adjust));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__adjust));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 3, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 4, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__neww));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 5, ((PyObject *)__pyx_n_s__neww));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__neww));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__oldw));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 6, ((PyObject *)__pyx_n_s__oldw));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__oldw));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__adj));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 7, ((PyObject *)__pyx_n_s__adj));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__adj));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 8, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 9, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_190, 10, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_190));
  __pyx_k_codeobj_191 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_190, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__ewma, 1007, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_191)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1069
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def nancorr(ndarray[float64_t, ndim=2] mat, cov=False, minp=None):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, xi, yi, N, K
 */
  __pyx_k_tuple_192 = PyTuple_New(21); if (unlikely(!__pyx_k_tuple_192)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_192);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mat));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 0, ((PyObject *)__pyx_n_s__mat));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mat));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cov));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 1, ((PyObject *)__pyx_n_s__cov));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cov));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xi));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 5, ((PyObject *)__pyx_n_s__xi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__yi));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 6, ((PyObject *)__pyx_n_s__yi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yi));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 7, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 8, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 9, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 10, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 11, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vx));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 12, ((PyObject *)__pyx_n_s__vx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vy));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 13, ((PyObject *)__pyx_n_s__vy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 14, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumy));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 15, ((PyObject *)__pyx_n_s__sumy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 16, ((PyObject *)__pyx_n_s__sumxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumyy));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 17, ((PyObject *)__pyx_n_s__sumyy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumyy));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__meanx));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 18, ((PyObject *)__pyx_n_s__meanx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__meanx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__meany));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 19, ((PyObject *)__pyx_n_s__meany));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__meany));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__divisor));
  PyTuple_SET_ITEM(__pyx_k_tuple_192, 20, ((PyObject *)__pyx_n_s__divisor));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__divisor));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_192));
  __pyx_k_codeobj_193 = (PyObject*)__Pyx_PyCode_New(3, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_192, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__nancorr, 1069, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_193)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1126
 * # Rolling variance
 * 
 * def roll_var(ndarray[double_t] input, int win, int minp, int ddof=1):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 *     cdef Py_ssize_t i
 */
  __pyx_k_tuple_194 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_194)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_194);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ddof));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 3, ((PyObject *)__pyx_n_s__ddof));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ddof));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 4, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 5, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_x));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 6, ((PyObject *)__pyx_n_s__sum_x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_xx));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 7, ((PyObject *)__pyx_n_s__sum_xx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_xx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 8, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 9, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 10, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_194, 11, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_194));
  __pyx_k_codeobj_195 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_194, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_var, 1126, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_195)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1180
 * # Rolling skewness
 * 
 * def roll_skew(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0
 */
  __pyx_k_tuple_196 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_196)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_196);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 3, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 4, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 5, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xx));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 6, ((PyObject *)__pyx_n_s__xx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 7, ((PyObject *)__pyx_n_s__xxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 8, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 9, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 10, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 11, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__A));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 12, ((PyObject *)__pyx_n_s__A));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 13, ((PyObject *)__pyx_n_s__B));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__C));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 14, ((PyObject *)__pyx_n_s__C));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__R));
  PyTuple_SET_ITEM(__pyx_k_tuple_196, 15, ((PyObject *)__pyx_n_s__R));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_196));
  __pyx_k_codeobj_197 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_196, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_skew, 1180, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_197)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1241
 * 
 * 
 * def roll_kurt(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev
 */
  __pyx_k_tuple_198 = PyTuple_New(19); if (unlikely(!__pyx_k_tuple_198)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_198);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 3, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 4, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 5, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xx));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 6, ((PyObject *)__pyx_n_s__xx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 7, ((PyObject *)__pyx_n_s__xxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__xxxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 8, ((PyObject *)__pyx_n_s__xxxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xxxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 9, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 10, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 11, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 12, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__A));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 13, ((PyObject *)__pyx_n_s__A));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 14, ((PyObject *)__pyx_n_s__B));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__C));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 15, ((PyObject *)__pyx_n_s__C));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__D));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 16, ((PyObject *)__pyx_n_s__D));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__R));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 17, ((PyObject *)__pyx_n_s__R));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_198, 18, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_198));
  __pyx_k_codeobj_199 = (PyObject*)__Pyx_PyCode_New(3, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_198, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_kurt, 1241, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_199)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1356
 * from skiplist cimport *
 * 
 * def roll_median_c(ndarray[float64_t] arg, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, res, prev
 *     cdef:
 */
  __pyx_k_tuple_200 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_200);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arg));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 0, ((PyObject *)__pyx_n_s__arg));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arg));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 3, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__res));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 4, ((PyObject *)__pyx_n_s__res));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 5, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ret));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 6, ((PyObject *)__pyx_n_s__ret));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ret));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sl));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 7, ((PyObject *)__pyx_n_s__sl));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sl));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__midpoint));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 8, ((PyObject *)__pyx_n_s__midpoint));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__midpoint));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 9, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 10, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 11, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_200, 12, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_200));
  __pyx_k_codeobj_201 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_200, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_median_c, 1356, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_201)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1411
 *     return output
 * 
 * def roll_median_cython(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_k_tuple_202 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_202)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_202);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_202, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_202, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_202, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_202));
  __pyx_k_codeobj_203 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_202, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_median_cython, 1411, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_203)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_max2(ndarray[float64_t] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving max of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */
  __pyx_k_tuple_204 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_204)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_204);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 0, ((PyObject *)__pyx_n_s__a));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__window));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 1, ((PyObject *)__pyx_n_s__window));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__window));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ai));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 3, ((PyObject *)__pyx_n_s__ai));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ai));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aold));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 4, ((PyObject *)__pyx_n_s__aold));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aold));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 5, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ring));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 6, ((PyObject *)__pyx_n_s__ring));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ring));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minpair));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 7, ((PyObject *)__pyx_n_s__minpair));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minpair));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 8, ((PyObject *)__pyx_n_s__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 9, ((PyObject *)__pyx_n_s__last));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i0));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 10, ((PyObject *)__pyx_n_s__i0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dim));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 11, ((PyObject *)__pyx_n_s__dim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n0));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 12, ((PyObject *)__pyx_n_s__n0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dims));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 13, ((PyObject *)__pyx_n_s__dims));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_204, 14, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_204));
  __pyx_k_codeobj_205 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_204, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_max2, 1447, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_205)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1527
 *     return y
 * 
 * def roll_max(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_k_tuple_206 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_206)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_206);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_206, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_206, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_206, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_206));
  __pyx_k_codeobj_207 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_206, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_max, 1527, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_207)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1540
 *         return NaN
 * 
 * def roll_min(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_k_tuple_208 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_208)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_208);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_208, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_208, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_208, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_208));
  __pyx_k_codeobj_209 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_min, 1540, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_209)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1548
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_min2(np.ndarray[np.float64_t, ndim=1] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving min of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */
  __pyx_k_tuple_210 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_210)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_210);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 0, ((PyObject *)__pyx_n_s__a));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__window));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 1, ((PyObject *)__pyx_n_s__window));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__window));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ai));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 3, ((PyObject *)__pyx_n_s__ai));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ai));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__aold));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 4, ((PyObject *)__pyx_n_s__aold));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aold));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 5, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ring));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 6, ((PyObject *)__pyx_n_s__ring));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ring));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minpair));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 7, ((PyObject *)__pyx_n_s__minpair));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minpair));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__end));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 8, ((PyObject *)__pyx_n_s__end));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__end));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 9, ((PyObject *)__pyx_n_s__last));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i0));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 10, ((PyObject *)__pyx_n_s__i0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dim));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 11, ((PyObject *)__pyx_n_s__dim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n0));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 12, ((PyObject *)__pyx_n_s__n0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__dims));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 13, ((PyObject *)__pyx_n_s__dims));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_210, 14, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_210));
  __pyx_k_codeobj_211 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_min2, 1548, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_211)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1634
 *         return NaN
 * 
 * def roll_quantile(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                   int minp, double quantile):
 *     '''
 */
  __pyx_k_tuple_212 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_212)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_212);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__quantile));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 3, ((PyObject *)__pyx_n_s__quantile));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__quantile));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 4, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 5, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__midpoint));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 6, ((PyObject *)__pyx_n_s__midpoint));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__midpoint));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__skiplist));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 7, ((PyObject *)__pyx_n_s__skiplist));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__skiplist));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 8, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 9, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 10, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 11, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_212, 12, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_212));
  __pyx_k_codeobj_213 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_quantile, 1634, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_213)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1681
 *     return output
 * 
 * def roll_generic(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                  int minp, object func):
 *     cdef ndarray[double_t] output, counts, bufarr
 */
  __pyx_k_tuple_214 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_214)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_214);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 1, ((PyObject *)__pyx_n_s__win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 3, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 4, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 5, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bufarr));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 6, ((PyObject *)__pyx_n_s__bufarr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bufarr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 7, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__buf));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 9, ((PyObject *)__pyx_n_s__buf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__oldbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_214, 10, ((PyObject *)__pyx_n_s__oldbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__oldbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_214));
  __pyx_k_codeobj_215 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_214, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_generic, 1681, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_215)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1723
 * 
 * 
 * def roll_window(ndarray[float64_t, ndim=1, cast=True] input,             # <<<<<<<<<<<<<<
 *                 ndarray[float64_t, ndim=1, cast=True] weights,
 *                 int minp, bint avg=True, bint avg_wgt=False):
 */
  __pyx_k_tuple_216 = PyTuple_New(18); if (unlikely(!__pyx_k_tuple_216)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_216);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__input));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 0, ((PyObject *)__pyx_n_s__input));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__input));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__weights));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 1, ((PyObject *)__pyx_n_s__weights));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minp));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 2, ((PyObject *)__pyx_n_s__minp));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minp));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__avg));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 3, ((PyObject *)__pyx_n_s__avg));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__avg));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__avg_wgt));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 4, ((PyObject *)__pyx_n_s__avg_wgt));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__avg_wgt));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__output));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 5, ((PyObject *)__pyx_n_s__output));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__output));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__tot_wgt));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 6, ((PyObject *)__pyx_n_s__tot_wgt));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tot_wgt));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 7, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_i));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 8, ((PyObject *)__pyx_n_s__in_i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win_i));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 9, ((PyObject *)__pyx_n_s__win_i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win_i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win_n));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 10, ((PyObject *)__pyx_n_s__win_n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win_n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__win_k));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 11, ((PyObject *)__pyx_n_s__win_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__win_k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_n));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 12, ((PyObject *)__pyx_n_s__in_n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__in_k));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 13, ((PyObject *)__pyx_n_s__in_k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__in_k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val_in));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 14, ((PyObject *)__pyx_n_s__val_in));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val_in));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val_win));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 15, ((PyObject *)__pyx_n_s__val_win));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val_win));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__c));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 16, ((PyObject *)__pyx_n_s__c));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__w));
  PyTuple_SET_ITEM(__pyx_k_tuple_216, 17, ((PyObject *)__pyx_n_s__w));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_216));
  __pyx_k_codeobj_217 = (PyObject*)__Pyx_PyCode_New(5, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_216, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__roll_window, 1723, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_217)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1796
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
 *     cdef:
 *         int i
 */
  __pyx_k_tuple_218 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_218)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_218);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__list_of_arrays));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 0, ((PyObject *)__pyx_n_s__list_of_arrays));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__list_of_arrays));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nlevels));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 3, ((PyObject *)__pyx_n_s__nlevels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nlevels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 5, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pre));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 6, ((PyObject *)__pyx_n_s__pre));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pre));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 7, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vecs));
  PyTuple_SET_ITEM(__pyx_k_tuple_218, 8, ((PyObject *)__pyx_n_s__vecs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vecs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_218));
  __pyx_k_codeobj_219 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__is_lexsorted, 1796, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_219)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1829
 * 
 * @cython.boundscheck(False)
 * def groupby_indices(ndarray values):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(values)
 */
  __pyx_k_tuple_220 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_220)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_220);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 4, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 5, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__seen));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 6, ((PyObject *)__pyx_n_s__seen));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seen));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__loc));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 7, ((PyObject *)__pyx_n_s__loc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ids));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 8, ((PyObject *)__pyx_n_s__ids));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ids));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 10, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vecs));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 11, ((PyObject *)__pyx_n_s__vecs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vecs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_220, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_220));
  __pyx_k_codeobj_221 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_220, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__groupby_indices, 1829, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_221)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1866
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def group_labels(ndarray[object] values):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute label vector from input values and associated useful data
 */
  __pyx_k_tuple_222 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_222)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_222);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 4, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ids));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 5, ((PyObject *)__pyx_n_s__ids));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ids));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__reverse));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 6, ((PyObject *)__pyx_n_s__reverse));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__reverse));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 7, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 8, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_222, 9, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_222));
  __pyx_k_codeobj_223 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_222, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_labels, 1866, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_223)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1908
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def groupsort_indexer(ndarray[int64_t] index, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, loc, label, n
 */
  __pyx_k_tuple_224 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_224)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_224);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 1, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__loc));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 3, ((PyObject *)__pyx_n_s__loc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__label));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 4, ((PyObject *)__pyx_n_s__label));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__label));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 6, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__where));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 7, ((PyObject *)__pyx_n_s__where));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__where));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_224, 8, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_224));
  __pyx_k_codeobj_225 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__groupsort_indexer, 1908, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_225)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1937
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_226 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_226)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_226);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 11, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_226, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_226));
  __pyx_k_codeobj_227 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_226, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_add, 1937, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_227)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":1992
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_228 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_228)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_228);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prodx));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 11, ((PyObject *)__pyx_n_s__prodx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prodx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_228, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_228));
  __pyx_k_codeobj_229 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_228, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_prod, 1992, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_229)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2049
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_230 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_230)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_230);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rank));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 4, ((PyObject *)__pyx_n_s__rank));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rank));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 7, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 8, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 9, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 12, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_230, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_230));
  __pyx_k_codeobj_231 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_230, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_nth, 2049, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_231)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2091
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] counts,
 *                      ndarray[object, ndim=2] values,
 */
  __pyx_k_tuple_232 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_232)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_232);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rank));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 4, ((PyObject *)__pyx_n_s__rank));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rank));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 7, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 8, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 9, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_232, 13, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_232));
  __pyx_k_codeobj_233 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_232, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_nth_object, 2091, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_233)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2135
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_234 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_234)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_234);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rank));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 4, ((PyObject *)__pyx_n_s__rank));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rank));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 7, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 8, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 9, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 10, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 11, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 12, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 13, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_234, 14, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_234));
  __pyx_k_codeobj_235 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_234, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_nth_bin, 2135, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_235)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2181
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                          ndarray[int64_t] counts,
 *                          ndarray[object, ndim=2] values,
 */
  __pyx_k_tuple_236 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_236)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_236);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rank));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 4, ((PyObject *)__pyx_n_s__rank));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rank));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 7, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 8, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 9, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 10, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 11, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 12, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 13, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_236, 14, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_236));
  __pyx_k_codeobj_237 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_236, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s_238, 2181, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_237)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_239 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_239)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_239);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 11, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_239, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_239));
  __pyx_k_codeobj_240 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_239, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_last, 2229, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_240)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2270
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                       ndarray[int64_t] counts,
 *                       ndarray[object, ndim=2] values,
 */
  __pyx_k_tuple_241 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_241)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_241);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 11, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_241, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_241));
  __pyx_k_codeobj_242 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_last_object, 2270, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_242)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2313
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_243 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_243)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_243);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 12, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_243, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_243));
  __pyx_k_codeobj_244 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_last_bin, 2313, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_244)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2358
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                           ndarray[int64_t] counts,
 *                           ndarray[object, ndim=2] values,
 */
  __pyx_k_tuple_245 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_245)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_245);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__resx));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 12, ((PyObject *)__pyx_n_s__resx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__resx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_245, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_245));
  __pyx_k_codeobj_246 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_245, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s_247, 2358, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_246)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2409
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_248 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_248)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_248);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minx));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 11, ((PyObject *)__pyx_n_s__minx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_248, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_248));
  __pyx_k_codeobj_249 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_248, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_min, 2409, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_249)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2468
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_250 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_250)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_250);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 11, ((PyObject *)__pyx_n_s__maxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_250, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_250));
  __pyx_k_codeobj_251 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_250, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_max, 2468, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_251)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2527
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_mean(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_252 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_252)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_252);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 10, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 11, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_252, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_252));
  __pyx_k_codeobj_253 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_252, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_mean, 2527, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_253)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2576
 * 
 * 
 * def group_median(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                  ndarray[int64_t] counts,
 *                  ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_254 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_254);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 9, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 10, ((PyObject *)__pyx_n_s___counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 11, ((PyObject *)__pyx_n_s__data));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ptr));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 12, ((PyObject *)__pyx_n_s__ptr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ptr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_254, 13, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_254));
  __pyx_k_codeobj_255 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_254, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_median, 2576, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2648
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_256 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_256)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_256);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 3, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lab));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 8, ((PyObject *)__pyx_n_s__lab));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lab));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 9, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ct));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 10, ((PyObject *)__pyx_n_s__ct));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ct));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 11, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 12, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_256, 13, ((PyObject *)__pyx_n_s__sumxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_256));
  __pyx_k_codeobj_257 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_256, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_var, 2648, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_257)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2708
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_258 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_258)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_258);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nbins));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 10, ((PyObject *)__pyx_n_s__nbins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 11, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 12, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 13, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_258, 14, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_258));
  __pyx_k_codeobj_259 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_258, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_add_bin, 2708, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_259)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2765
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_260 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_260)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_260);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prodx));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 12, ((PyObject *)__pyx_n_s__prodx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prodx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_260, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_260));
  __pyx_k_codeobj_261 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_260, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_prod_bin, 2765, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_261)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2822
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_262 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_262)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_262);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__minx));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 12, ((PyObject *)__pyx_n_s__minx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_262, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_262));
  __pyx_k_codeobj_263 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_262, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_min_bin, 2822, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_263)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2885
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_264 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_264)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_264);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 12, ((PyObject *)__pyx_n_s__maxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_264, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_264));
  __pyx_k_codeobj_265 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_264, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_max_bin, 2885, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_265)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":2947
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_ohlc(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_266 = PyTuple_New(18); if (unlikely(!__pyx_k_tuple_266)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_266);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vopen));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 12, ((PyObject *)__pyx_n_s__vopen));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vopen));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vhigh));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 13, ((PyObject *)__pyx_n_s__vhigh));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vhigh));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vlow));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 14, ((PyObject *)__pyx_n_s__vlow));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vlow));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vclose));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 15, ((PyObject *)__pyx_n_s__vclose));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vclose));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__NA));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 16, ((PyObject *)__pyx_n_s__NA));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__NA));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__got_first));
  PyTuple_SET_ITEM(__pyx_k_tuple_266, 17, ((PyObject *)__pyx_n_s__got_first));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__got_first));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_266));
  __pyx_k_codeobj_267 = (PyObject*)__Pyx_PyCode_New(4, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_266, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_ohlc, 2947, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_267)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":3022
 * # @cython.boundscheck(False)
 * # @cython.wraparound(False)
 * def group_mean_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_268 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_268)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_268);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 11, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 12, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_268, 13, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_268));
  __pyx_k_codeobj_269 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_268, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_mean_bin, 3022, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_269)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/algos.pyx":3077
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_k_tuple_270 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_270)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_270);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 0, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__counts));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 1, ((PyObject *)__pyx_n_s__counts));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 2, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__bins));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 3, ((PyObject *)__pyx_n_s__bins));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bins));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 6, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 7, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngroups));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 8, ((PyObject *)__pyx_n_s__ngroups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngroups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__b));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 9, ((PyObject *)__pyx_n_s__b));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 10, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ct));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 11, ((PyObject *)__pyx_n_s__ct));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ct));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nobs));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 12, ((PyObject *)__pyx_n_s__nobs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nobs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumx));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 13, ((PyObject *)__pyx_n_s__sumx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sumxx));
  PyTuple_SET_ITEM(__pyx_k_tuple_270, 14, ((PyObject *)__pyx_n_s__sumxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumxx));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_270));
  __pyx_k_codeobj_271 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_270, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_158, __pyx_n_s__group_var_bin, 3077, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_271)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":1
 * def inner_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                Py_ssize_t max_groups):
 *     cdef:
 */
  __pyx_k_tuple_272 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_272)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_272);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max_groups));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 2, ((PyObject *)__pyx_n_s__max_groups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_groups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 5, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 7, ((PyObject *)__pyx_n_s__left_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 8, ((PyObject *)__pyx_n_s__right_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 9, ((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 10, ((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 11, ((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 12, ((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lc));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 13, ((PyObject *)__pyx_n_s__lc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rc));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 14, ((PyObject *)__pyx_n_s__rc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__loc));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 15, ((PyObject *)__pyx_n_s__loc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 16, ((PyObject *)__pyx_n_s__left_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 17, ((PyObject *)__pyx_n_s__right_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__position));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 18, ((PyObject *)__pyx_n_s__position));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__position));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__offset));
  PyTuple_SET_ITEM(__pyx_k_tuple_272, 19, ((PyObject *)__pyx_n_s__offset));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_272));
  __pyx_k_codeobj_273 = (PyObject*)__Pyx_PyCode_New(3, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_272, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s__inner_join, 1, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_273)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":51
 *             _get_result_indexer(right_sorter, right_indexer))
 * 
 * def left_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                     Py_ssize_t max_groups, sort=True):
 *     cdef:
 */
  __pyx_k_tuple_275 = PyTuple_New(22); if (unlikely(!__pyx_k_tuple_275)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_275);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max_groups));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 2, ((PyObject *)__pyx_n_s__max_groups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_groups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sort));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 3, ((PyObject *)__pyx_n_s__sort));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sort));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 8, ((PyObject *)__pyx_n_s__left_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 9, ((PyObject *)__pyx_n_s__right_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 10, ((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 11, ((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rev));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 12, ((PyObject *)__pyx_n_s__rev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 13, ((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 14, ((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lc));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 15, ((PyObject *)__pyx_n_s__lc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rc));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 16, ((PyObject *)__pyx_n_s__rc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__loc));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 17, ((PyObject *)__pyx_n_s__loc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 18, ((PyObject *)__pyx_n_s__left_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 19, ((PyObject *)__pyx_n_s__right_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__position));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 20, ((PyObject *)__pyx_n_s__position));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__position));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__offset));
  PyTuple_SET_ITEM(__pyx_k_tuple_275, 21, ((PyObject *)__pyx_n_s__offset));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_275));
  __pyx_k_codeobj_276 = (PyObject*)__Pyx_PyCode_New(4, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_275, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s__left_outer_join, 51, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_276)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":120
 * 
 * 
 * def full_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t max_groups):
 *     cdef:
 */
  __pyx_k_tuple_277 = PyTuple_New(19); if (unlikely(!__pyx_k_tuple_277)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_277);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max_groups));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 2, ((PyObject *)__pyx_n_s__max_groups));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_groups));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 5, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 7, ((PyObject *)__pyx_n_s__left_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 8, ((PyObject *)__pyx_n_s__right_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 9, ((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 10, ((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 11, ((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 12, ((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lc));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 13, ((PyObject *)__pyx_n_s__lc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rc));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 14, ((PyObject *)__pyx_n_s__rc));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rc));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 15, ((PyObject *)__pyx_n_s__left_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right_pos));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 16, ((PyObject *)__pyx_n_s__right_pos));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_pos));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__offset));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 17, ((PyObject *)__pyx_n_s__offset));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__offset));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__position));
  PyTuple_SET_ITEM(__pyx_k_tuple_277, 18, ((PyObject *)__pyx_n_s__position));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__position));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_277));
  __pyx_k_codeobj_278 = (PyObject*)__Pyx_PyCode_New(3, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_277, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s__full_outer_join, 120, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_278)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":184
 * 
 * 
 * def _get_result_indexer(sorter, indexer):             # <<<<<<<<<<<<<<
 *     if indexer.dtype != np.int_:
 *         indexer = indexer.astype(np.int_)
 */
  __pyx_k_tuple_279 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_279)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_279);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__sorter));
  PyTuple_SET_ITEM(__pyx_k_tuple_279, 0, ((PyObject *)__pyx_n_s__sorter));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sorter));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_279, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__res));
  PyTuple_SET_ITEM(__pyx_k_tuple_279, 2, ((PyObject *)__pyx_n_s__res));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_279));
  __pyx_k_codeobj_280 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_279, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s___get_result_indexer, 184, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_280)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":199
 * 
 * 
 * def ffill_indexer(ndarray[int64_t] indexer):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(indexer)
 */
  __pyx_k_tuple_281 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_281)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_281);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 0, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 3, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 4, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last_obs));
  PyTuple_SET_ITEM(__pyx_k_tuple_281, 5, ((PyObject *)__pyx_n_s__last_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_281));
  __pyx_k_codeobj_282 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_281, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s__ffill_indexer, 199, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_282)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/join.pyx":219
 * 
 * 
 * def ffill_by_group(ndarray[int64_t] indexer, ndarray[int64_t] group_ids,             # <<<<<<<<<<<<<<
 *                    int64_t max_group):
 *     cdef:
 */
  __pyx_k_tuple_283 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_283)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_283);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 0, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__group_ids));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 1, ((PyObject *)__pyx_n_s__group_ids));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__group_ids));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__max_group));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 2, ((PyObject *)__pyx_n_s__max_group));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_group));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 4, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 5, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__last_obs));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 6, ((PyObject *)__pyx_n_s__last_obs));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_obs));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__gid));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 7, ((PyObject *)__pyx_n_s__gid));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gid));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_283, 8, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_283));
  __pyx_k_codeobj_284 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_274, __pyx_n_s__ffill_by_group, 219, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_284)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":37
 * import_ufunc()
 * 
 * cdef int PLATFORM_INT = (<ndarray> np.arange(0, dtype=np.int_)).descr.type_num             # <<<<<<<<<<<<<<
 * 
 * cpdef ensure_platform_int(object arr):
 */
  __pyx_k_tuple_285 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_285)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_285);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_285, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_285));

  /* "pandas/src/generated.pyx":203
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_286 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_286)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_286);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__next));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 9, ((PyObject *)__pyx_n_s__next));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__next));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_286, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_286));
  __pyx_k_codeobj_287 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_286, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_float64, 203, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_287)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":264
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_289 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_289)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_289);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__next));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 9, ((PyObject *)__pyx_n_s__next));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__next));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_289, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_289));
  __pyx_k_codeobj_290 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_object, 264, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_290)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":325
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_291 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_291)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_291);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__next));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 9, ((PyObject *)__pyx_n_s__next));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__next));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_291, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_291));
  __pyx_k_codeobj_292 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_int32, 325, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_292)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":386
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_293 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_293)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_293);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__next));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 9, ((PyObject *)__pyx_n_s__next));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__next));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_293, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_293));
  __pyx_k_codeobj_294 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_293, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_int64, 386, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_294)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_295 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_295)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_295);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__next));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 9, ((PyObject *)__pyx_n_s__next));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__next));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_295, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_295));
  __pyx_k_codeobj_296 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_295, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_bool, 447, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_296)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":509
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_297 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_297)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_297);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 9, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_297, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_297));
  __pyx_k_codeobj_298 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_297, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__backfill_float64, 509, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_298)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":571
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_299 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_299)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_299);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 9, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_299, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_299));
  __pyx_k_codeobj_300 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_299, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__backfill_object, 571, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_300)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":633
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_301 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_301)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_301);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 9, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_301, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_301));
  __pyx_k_codeobj_302 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_301, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__backfill_int32, 633, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_302)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":695
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_303 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_303)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_303);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 9, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_303, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_303));
  __pyx_k_codeobj_304 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_303, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__backfill_int64, 695, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_304)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":757
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_k_tuple_305 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_305)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_305);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__old));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 0, ((PyObject *)__pyx_n_s__old));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__old));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__new));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 1, ((PyObject *)__pyx_n_s__new));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 6, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 7, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 8, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 9, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 10, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_305, 11, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_305));
  __pyx_k_codeobj_306 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_305, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__backfill_bool, 757, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_306)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":820
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_k_tuple_307 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_307)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_307);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_307, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_307));
  __pyx_k_codeobj_308 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_307, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_inplace_float64, 820, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_308)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":849
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_k_tuple_309 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_309)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_309);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_309, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_309));
  __pyx_k_codeobj_310 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_309, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_inplace_object, 849, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_310)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":878
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_k_tuple_311 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_311)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_311);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_311, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_311));
  __pyx_k_codeobj_312 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_311, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_inplace_int32, 878, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_312)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":907
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_k_tuple_313 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_313)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_313);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_313, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_313));
  __pyx_k_codeobj_314 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_313, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_inplace_int64, 907, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_314)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":936
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_k_tuple_315 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_315)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_315);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_315, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_315));
  __pyx_k_codeobj_316 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_315, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_inplace_bool, 936, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_316)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":966
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_k_tuple_317 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_317)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_317);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_317, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_317));
  __pyx_k_codeobj_318 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_317, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_319, 966, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_318)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":994
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_k_tuple_320 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_320)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_320);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_320, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_320));
  __pyx_k_codeobj_321 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_320, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_322, 994, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_321)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1022
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_k_tuple_323 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_323)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_323);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_323, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_323));
  __pyx_k_codeobj_324 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_323, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_325, 1022, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_324)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1050
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_k_tuple_326 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_326)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_326);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_326, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_326));
  __pyx_k_codeobj_327 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_326, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_328, 1050, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_327)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1078
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_k_tuple_329 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_329)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_329);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 4, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 5, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 6, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_329, 7, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_329));
  __pyx_k_codeobj_330 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_329, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_331, 1078, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_330)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1107
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_k_tuple_332 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_332)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_332);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_332, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_332));
  __pyx_k_codeobj_333 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_332, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_334, 1107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_333)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1137
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_k_tuple_335 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_335)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_335);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_335, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_335));
  __pyx_k_codeobj_336 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_335, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_337, 1137, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_336)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1167
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_k_tuple_338 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_338)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_338);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_338, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_338));
  __pyx_k_codeobj_339 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_340, 1167, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_339)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1197
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_k_tuple_341 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_341)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_341);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_341, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_341));
  __pyx_k_codeobj_342 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_341, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_343, 1197, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_342)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1227
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_k_tuple_344 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_344)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_344);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_344, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_344));
  __pyx_k_codeobj_345 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_344, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__pad_2d_inplace_bool, 1227, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_345)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1258
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_k_tuple_346 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_346)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_346);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_346, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_346));
  __pyx_k_codeobj_347 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_346, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_348, 1258, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_347)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1288
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_k_tuple_349 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_349)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_349);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_349, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_349));
  __pyx_k_codeobj_350 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_349, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_351, 1288, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_350)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1318
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_k_tuple_352 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_352)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_352);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_352, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_352));
  __pyx_k_codeobj_353 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_352, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_354, 1318, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_353)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1348
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_k_tuple_355 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_355)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_355);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_355, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_355));
  __pyx_k_codeobj_356 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_355, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_357, 1348, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_356)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1378
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_k_tuple_358 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_358)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_358);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__mask));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 1, ((PyObject *)__pyx_n_s__mask));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__limit));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 2, ((PyObject *)__pyx_n_s__limit));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limit));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 4, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__N));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 5, ((PyObject *)__pyx_n_s__N));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__K));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 6, ((PyObject *)__pyx_n_s__K));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__K));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__val));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 7, ((PyObject *)__pyx_n_s__val));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__val));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lim));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 8, ((PyObject *)__pyx_n_s__lim));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lim));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_count));
  PyTuple_SET_ITEM(__pyx_k_tuple_358, 9, ((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_count));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_358));
  __pyx_k_codeobj_359 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_358, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_360, 1378, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_359)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1408
 * 
 * @cython.wraparound(False)
 * def take_1d_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_361 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_361)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_361);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 7, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_361, 8, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_361));
  __pyx_k_codeobj_362 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_361, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_1d_float64, 1408, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_362)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1440
 * 
 * @cython.wraparound(False)
 * def take_1d_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_363 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_363)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_363);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 7, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_363, 8, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_363));
  __pyx_k_codeobj_364 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_1d_object, 1440, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_364)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1472
 * 
 * @cython.wraparound(False)
 * def take_1d_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_365 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_365)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_365);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 7, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_365, 8, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_365));
  __pyx_k_codeobj_366 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_365, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_1d_int32, 1472, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_366)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1504
 * 
 * @cython.wraparound(False)
 * def take_1d_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_367 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_367)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_367);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 7, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_367, 8, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_367));
  __pyx_k_codeobj_368 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_367, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_1d_int64, 1504, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_368)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1536
 * 
 * @cython.wraparound(False)
 * def take_1d_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_369 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_369)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_369);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 5, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 7, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_369, 8, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_369));
  __pyx_k_codeobj_370 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_369, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_1d_bool, 1536, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_370)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1570
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_float64(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_k_tuple_371 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_371)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_371);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 3, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 4, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__is_unique));
  PyTuple_SET_ITEM(__pyx_k_tuple_371, 5, ((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_371));
  __pyx_k_codeobj_372 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_371, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_373, 1570, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_372)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1597
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_object(ndarray[object] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_k_tuple_374 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_374)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_374);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 3, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 4, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__is_unique));
  PyTuple_SET_ITEM(__pyx_k_tuple_374, 5, ((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_374));
  __pyx_k_codeobj_375 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_374, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__is_monotonic_object, 1597, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_375)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1624
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int32(ndarray[int32_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_k_tuple_376 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_376)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_376);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 3, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 4, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__is_unique));
  PyTuple_SET_ITEM(__pyx_k_tuple_376, 5, ((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_376));
  __pyx_k_codeobj_377 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_376, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__is_monotonic_int32, 1624, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_377)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1651
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int64(ndarray[int64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_k_tuple_378 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_378)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_378);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 3, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 4, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__is_unique));
  PyTuple_SET_ITEM(__pyx_k_tuple_378, 5, ((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_378));
  __pyx_k_codeobj_379 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_378, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__is_monotonic_int64, 1651, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_379)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1678
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_bool(ndarray[uint8_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_k_tuple_380 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_380)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_380);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__arr));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 0, ((PyObject *)__pyx_n_s__arr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__arr));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 1, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 2, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prev));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 3, ((PyObject *)__pyx_n_s__prev));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__cur));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 4, ((PyObject *)__pyx_n_s__cur));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cur));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__is_unique));
  PyTuple_SET_ITEM(__pyx_k_tuple_380, 5, ((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_unique));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_380));
  __pyx_k_codeobj_381 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__is_monotonic_bool, 1678, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_381)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1706
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_float64(ndarray[float64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_k_tuple_382 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_382)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_382);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 1, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 2, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 4, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__members));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 5, ((PyObject *)__pyx_n_s__members));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__members));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
  PyTuple_SET_ITEM(__pyx_k_tuple_382, 7, ((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_382));
  __pyx_k_codeobj_383 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_382, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__groupby_float64, 1706, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_383)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_object(ndarray[object] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_k_tuple_384 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_384)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_384);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 1, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 2, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 4, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__members));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 5, ((PyObject *)__pyx_n_s__members));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__members));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
  PyTuple_SET_ITEM(__pyx_k_tuple_384, 7, ((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_384));
  __pyx_k_codeobj_385 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_384, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__groupby_object, 1731, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_385)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1756
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int32(ndarray[int32_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_k_tuple_386 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_386)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_386);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 1, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 2, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 4, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__members));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 5, ((PyObject *)__pyx_n_s__members));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__members));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
  PyTuple_SET_ITEM(__pyx_k_tuple_386, 7, ((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_386));
  __pyx_k_codeobj_387 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_386, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__groupby_int32, 1756, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_387)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1781
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int64(ndarray[int64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_k_tuple_388 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_388)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_388);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 1, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 2, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 4, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__members));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 5, ((PyObject *)__pyx_n_s__members));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__members));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
  PyTuple_SET_ITEM(__pyx_k_tuple_388, 7, ((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_388));
  __pyx_k_codeobj_389 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_388, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__groupby_int64, 1781, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_389)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1806
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_bool(ndarray[uint8_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_k_tuple_390 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_390)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_390);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__labels));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 1, ((PyObject *)__pyx_n_s__labels));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 2, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 4, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__members));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 5, ((PyObject *)__pyx_n_s__members));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__members));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 6, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__key));
  PyTuple_SET_ITEM(__pyx_k_tuple_390, 7, ((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_390));
  __pyx_k_codeobj_391 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_390, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__groupby_bool, 1806, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_391)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1832
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_float64(ndarray[float64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_k_tuple_392 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_392)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_392);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 1, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 2, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 4, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyTuple_SET_ITEM(__pyx_k_tuple_392, 5, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_392));
  __pyx_k_codeobj_393 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_392, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__arrmap_float64, 1832, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_393)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1847
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_object(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_k_tuple_394 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_394)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_394);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 1, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 2, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 4, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyTuple_SET_ITEM(__pyx_k_tuple_394, 5, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_394));
  __pyx_k_codeobj_395 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_394, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__arrmap_object, 1847, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_395)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1862
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int32(ndarray[int32_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_k_tuple_396 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_396)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_396);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 1, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 2, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 4, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyTuple_SET_ITEM(__pyx_k_tuple_396, 5, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_396));
  __pyx_k_codeobj_397 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_396, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__arrmap_int32, 1862, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_397)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1877
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int64(ndarray[int64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_k_tuple_398 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_398)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_398);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 1, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 2, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 4, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyTuple_SET_ITEM(__pyx_k_tuple_398, 5, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_398));
  __pyx_k_codeobj_399 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_398, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__arrmap_int64, 1877, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_399)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1892
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_bool(ndarray[uint8_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_k_tuple_400 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_400)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_400);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__index));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 0, ((PyObject *)__pyx_n_s__index));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__func));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 1, ((PyObject *)__pyx_n_s__func));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__func));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__length));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 2, ((PyObject *)__pyx_n_s__length));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__length));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 4, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_103));
  PyTuple_SET_ITEM(__pyx_k_tuple_400, 5, ((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_103));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_400));
  __pyx_k_codeobj_401 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_400, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__arrmap_bool, 1892, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_401)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1908
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_402 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_402)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_402);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_402, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_402));
  __pyx_k_codeobj_403 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_402, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_404, 1908, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_403)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1946
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_405 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_405)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_405);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_405, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_405));
  __pyx_k_codeobj_406 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_405, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_407, 1946, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_406)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":1984
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_408 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_408)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_408);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_408, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_408));
  __pyx_k_codeobj_409 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_408, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis0_int32, 1984, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_409)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2022
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_410 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_410)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_410);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_410, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_410));
  __pyx_k_codeobj_411 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_410, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis0_int64, 2022, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_411)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2060
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_412 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_412)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_412);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_412, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_412));
  __pyx_k_codeobj_413 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_412, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis0_bool, 2060, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_413)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2099
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_414 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_414)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_414);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_414, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_414));
  __pyx_k_codeobj_415 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_414, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_44, 2099, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_415)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2139
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_416 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_416)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_416);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_416, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_416));
  __pyx_k_codeobj_417 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_416, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_418, 2139, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_417)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2179
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_419 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_419)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_419);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_419, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_419));
  __pyx_k_codeobj_420 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_419, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis1_int32, 2179, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_420)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2219
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_421 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_421)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_421);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_421, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_421));
  __pyx_k_codeobj_422 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_421, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis1_int64, 2219, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_422)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2259
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_k_tuple_423 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_423)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_423);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 1, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 2, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 3, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 4, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 5, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 6, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 7, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 8, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 9, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_423, 10, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_423));
  __pyx_k_codeobj_424 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_423, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_axis1_bool, 2259, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_424)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2300
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_k_tuple_425 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_425)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_425);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx0));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 1, ((PyObject *)__pyx_n_s__idx0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 2, ((PyObject *)__pyx_n_s__idx1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 3, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 4, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 9, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 10, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_425, 11, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_425));
  __pyx_k_codeobj_426 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_425, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_427, 2300, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_426)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_k_tuple_428 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_428)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_428);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx0));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 1, ((PyObject *)__pyx_n_s__idx0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 2, ((PyObject *)__pyx_n_s__idx1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 3, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 4, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 9, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 10, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_428, 11, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_428));
  __pyx_k_codeobj_429 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_428, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_430, 2346, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_429)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2392
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_k_tuple_431 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_431)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_431);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx0));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 1, ((PyObject *)__pyx_n_s__idx0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 2, ((PyObject *)__pyx_n_s__idx1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 3, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 4, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 9, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 10, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_431, 11, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_431));
  __pyx_k_codeobj_432 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_431, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_multi_int32, 2392, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_432)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2438
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_k_tuple_433 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_433)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_433);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx0));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 1, ((PyObject *)__pyx_n_s__idx0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 2, ((PyObject *)__pyx_n_s__idx1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 3, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 4, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 9, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 10, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_433, 11, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_433));
  __pyx_k_codeobj_434 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_433, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_multi_int64, 2438, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_434)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2484
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_k_tuple_435 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_435)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_435);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__values));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 0, ((PyObject *)__pyx_n_s__values));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__values));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx0));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 1, ((PyObject *)__pyx_n_s__idx0));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx0));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 2, ((PyObject *)__pyx_n_s__idx1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__out));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 3, ((PyObject *)__pyx_n_s__out));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__out));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fill_value));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 4, ((PyObject *)__pyx_n_s__fill_value));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fill_value));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 5, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 6, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 7, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 8, ((PyObject *)__pyx_n_s__n));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__idx));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 9, ((PyObject *)__pyx_n_s__idx));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__outbuf));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 10, ((PyObject *)__pyx_n_s__outbuf));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__outbuf));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fv));
  PyTuple_SET_ITEM(__pyx_k_tuple_435, 11, ((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fv));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_435));
  __pyx_k_codeobj_436 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_435, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s__take_2d_multi_bool, 2484, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_436)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2531
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[float64_t] right):
 *     cdef:
 */
  __pyx_k_tuple_437 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_437)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_437);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 4, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 6, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_437, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_437));
  __pyx_k_codeobj_438 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_437, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_439, 2531, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_438)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2576
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[object] right):
 *     cdef:
 */
  __pyx_k_tuple_440 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_440)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_440);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 4, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 6, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_440, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_440));
  __pyx_k_codeobj_441 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_440, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_442, 2576, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_441)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int32_t] right):
 *     cdef:
 */
  __pyx_k_tuple_443 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_443)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_443);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 4, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 6, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_443, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_443));
  __pyx_k_codeobj_444 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_443, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_445, 2621, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_444)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2666
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int64_t] right):
 *     cdef:
 */
  __pyx_k_tuple_446 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_446)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_446);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 4, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__indexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 6, ((PyObject *)__pyx_n_s__indexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_446, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_446));
  __pyx_k_codeobj_447 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_446, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_448, 2666, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_447)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2711
 * 
 * 
 * def left_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */
  __pyx_k_tuple_449 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_449)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_449);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_449, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_449));
  __pyx_k_codeobj_450 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_449, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_451, 2711, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_450)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2813
 * 
 * 
 * def left_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */
  __pyx_k_tuple_452 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_452)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_452);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_452, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_452));
  __pyx_k_codeobj_453 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_452, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_454, 2813, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_453)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":2915
 * 
 * 
 * def left_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */
  __pyx_k_tuple_455 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_455)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_455);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_455, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_455));
  __pyx_k_codeobj_456 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_455, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_457, 2915, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_456)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3017
 * 
 * 
 * def left_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */
  __pyx_k_tuple_458 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_458)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_458);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_458, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_458));
  __pyx_k_codeobj_459 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_458, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_460, 3017, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_459)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3121
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[float64_t] right):
 *     cdef:
 */
  __pyx_k_tuple_461 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_461)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_461);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 4, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 9, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 10, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_461, 11, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_461));
  __pyx_k_codeobj_462 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_461, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_463, 3121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_462)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3250
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[object] right):
 *     cdef:
 */
  __pyx_k_tuple_464 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_464)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_464);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 4, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 9, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 10, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_464, 11, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_464));
  __pyx_k_codeobj_465 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_464, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_466, 3250, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_465)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3379
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int32_t] right):
 *     cdef:
 */
  __pyx_k_tuple_467 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_467)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_467);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 4, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 9, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 10, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_467, 11, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_467));
  __pyx_k_codeobj_468 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_467, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_469, 3379, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_468)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3508
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int64_t] right):
 *     cdef:
 */
  __pyx_k_tuple_470 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_470)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_470);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 4, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 5, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 6, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 7, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 8, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 9, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 10, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_470, 11, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_470));
  __pyx_k_codeobj_471 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_470, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_472, 3508, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_471)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3638
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */
  __pyx_k_tuple_473 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_473)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_473);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_473, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_473));
  __pyx_k_codeobj_474 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_473, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_475, 3638, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_474)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */
  __pyx_k_tuple_476 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_476)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_476);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_476, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_476));
  __pyx_k_codeobj_477 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_476, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_478, 3731, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_477)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3824
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */
  __pyx_k_tuple_479 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_479)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_479);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_479, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_479));
  __pyx_k_codeobj_480 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_479, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_481, 3824, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_480)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "pandas/src/generated.pyx":3917
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */
  __pyx_k_tuple_482 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_482)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_482);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__left));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 0, ((PyObject *)__pyx_n_s__left));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__right));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 1, ((PyObject *)__pyx_n_s__right));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 2, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__j));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 3, ((PyObject *)__pyx_n_s__j));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__k));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 4, ((PyObject *)__pyx_n_s__k));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nright));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 5, ((PyObject *)__pyx_n_s__nright));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nright));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__nleft));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 6, ((PyObject *)__pyx_n_s__nleft));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nleft));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__count));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 7, ((PyObject *)__pyx_n_s__count));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lval));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 8, ((PyObject *)__pyx_n_s__lval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rval));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 9, ((PyObject *)__pyx_n_s__rval));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rval));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 10, ((PyObject *)__pyx_n_s__lindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__rindexer));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 11, ((PyObject *)__pyx_n_s__rindexer));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rindexer));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__result));
  PyTuple_SET_ITEM(__pyx_k_tuple_482, 12, ((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_482));
  __pyx_k_codeobj_483 = (PyObject*)__Pyx_PyCode_New(2, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_482, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_288, __pyx_n_s_484, 3917, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_483)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initalgos(void); /*proto*/
PyMODINIT_FUNC initalgos(void)
#else
PyMODINIT_FUNC PyInit_algos(void); /*proto*/
PyMODINIT_FUNC PyInit_algos(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __pyx_t_5numpy_int32_t __pyx_t_4;
  __pyx_t_5numpy_int64_t __pyx_t_5;
  __pyx_t_5numpy_float32_t __pyx_t_6;
  __pyx_t_5numpy_float64_t __pyx_t_7;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_algos(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("algos"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "pandas.algos")) {
      if (unlikely(PyDict_SetItemString(modules, "pandas.algos", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_pandas__algos) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_6pandas_5algos_Node) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Node", (PyObject *)&__pyx_type_6pandas_5algos_Node) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_5algos_Node = &__pyx_type_6pandas_5algos_Node;
  __pyx_vtabptr_6pandas_5algos_IndexableSkiplist = &__pyx_vtable_6pandas_5algos_IndexableSkiplist;
  __pyx_vtable_6pandas_5algos_IndexableSkiplist.get = (PyObject *(*)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, Py_ssize_t, int __pyx_skip_dispatch))__pyx_f_6pandas_5algos_17IndexableSkiplist_get;
  __pyx_vtable_6pandas_5algos_IndexableSkiplist.insert = (PyObject *(*)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, double, int __pyx_skip_dispatch))__pyx_f_6pandas_5algos_17IndexableSkiplist_insert;
  __pyx_vtable_6pandas_5algos_IndexableSkiplist.remove = (PyObject *(*)(struct __pyx_obj_6pandas_5algos_IndexableSkiplist *, double, int __pyx_skip_dispatch))__pyx_f_6pandas_5algos_17IndexableSkiplist_remove;
  if (PyType_Ready(&__pyx_type_6pandas_5algos_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6pandas_5algos_IndexableSkiplist.tp_dict, __pyx_vtabptr_6pandas_5algos_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "IndexableSkiplist", (PyObject *)&__pyx_type_6pandas_5algos_IndexableSkiplist) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6pandas_5algos_IndexableSkiplist = &__pyx_type_6pandas_5algos_IndexableSkiplist;
  /*--- Type import code ---*/
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[7]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[8]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[9]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8datetime_date = __Pyx_ImportType("datetime", "date", sizeof(PyDateTime_Date), 0); if (unlikely(!__pyx_ptype_8datetime_date)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8datetime_datetime = __Pyx_ImportType("datetime", "datetime", sizeof(PyDateTime_DateTime), 0); if (unlikely(!__pyx_ptype_8datetime_datetime)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8datetime_timedelta = __Pyx_ImportType("datetime", "timedelta", sizeof(PyDateTime_Delta), 0); if (unlikely(!__pyx_ptype_8datetime_timedelta)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "pandas/algos.pyx":3
 * from numpy cimport *
 * cimport numpy as np
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * cimport cython
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":7
 * cimport cython
 * 
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * cdef float64_t FP_ERR = 1e-13
 */
  import_array();

  /* "pandas/algos.pyx":9
 * import_array()
 * 
 * cdef float64_t FP_ERR = 1e-13             # <<<<<<<<<<<<<<
 * 
 * cimport util
 */
  __pyx_v_6pandas_5algos_FP_ERR = 1e-13;

  /* "pandas/algos.pyx":20
 * from numpy cimport NPY_FLOAT64 as NPY_float64
 * 
 * int32 = np.dtype(np.int32)             # <<<<<<<<<<<<<<
 * int64 = np.dtype(np.int64)
 * float32 = np.dtype(np.float32)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__int32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":21
 * 
 * int32 = np.dtype(np.int32)
 * int64 = np.dtype(np.int64)             # <<<<<<<<<<<<<<
 * float32 = np.dtype(np.float32)
 * float64 = np.dtype(np.float64)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":22
 * int32 = np.dtype(np.int32)
 * int64 = np.dtype(np.int64)
 * float32 = np.dtype(np.float32)             # <<<<<<<<<<<<<<
 * float64 = np.dtype(np.float64)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__float32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":23
 * int64 = np.dtype(np.int64)
 * float32 = np.dtype(np.float32)
 * float64 = np.dtype(np.float64)             # <<<<<<<<<<<<<<
 * 
 * cdef np.int32_t MINint32 = np.iinfo(np.int32).min
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":25
 * float64 = np.dtype(np.float64)
 * 
 * cdef np.int32_t MINint32 = np.iinfo(np.int32).min             # <<<<<<<<<<<<<<
 * cdef np.int64_t MINint64 = np.iinfo(np.int64).min
 * cdef np.float32_t MINfloat32 = np.NINF
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_4 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MINint32 = __pyx_t_4;

  /* "pandas/algos.pyx":26
 * 
 * cdef np.int32_t MINint32 = np.iinfo(np.int32).min
 * cdef np.int64_t MINint64 = np.iinfo(np.int64).min             # <<<<<<<<<<<<<<
 * cdef np.float32_t MINfloat32 = np.NINF
 * cdef np.float64_t MINfloat64 = np.NINF
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__min); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MINint64 = __pyx_t_5;

  /* "pandas/algos.pyx":27
 * cdef np.int32_t MINint32 = np.iinfo(np.int32).min
 * cdef np.int64_t MINint64 = np.iinfo(np.int64).min
 * cdef np.float32_t MINfloat32 = np.NINF             # <<<<<<<<<<<<<<
 * cdef np.float64_t MINfloat64 = np.NINF
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NINF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_float32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_6pandas_5algos_MINfloat32 = __pyx_t_6;

  /* "pandas/algos.pyx":28
 * cdef np.int64_t MINint64 = np.iinfo(np.int64).min
 * cdef np.float32_t MINfloat32 = np.NINF
 * cdef np.float64_t MINfloat64 = np.NINF             # <<<<<<<<<<<<<<
 * 
 * cdef np.int32_t MAXint32 = np.iinfo(np.int32).max
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__NINF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MINfloat64 = __pyx_t_7;

  /* "pandas/algos.pyx":30
 * cdef np.float64_t MINfloat64 = np.NINF
 * 
 * cdef np.int32_t MAXint32 = np.iinfo(np.int32).max             # <<<<<<<<<<<<<<
 * cdef np.int64_t MAXint64 = np.iinfo(np.int64).max
 * cdef np.float32_t MAXfloat32 = np.inf
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_4 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MAXint32 = __pyx_t_4;

  /* "pandas/algos.pyx":31
 * 
 * cdef np.int32_t MAXint32 = np.iinfo(np.int32).max
 * cdef np.int64_t MAXint64 = np.iinfo(np.int64).max             # <<<<<<<<<<<<<<
 * cdef np.float32_t MAXfloat32 = np.inf
 * cdef np.float64_t MAXfloat64 = np.inf
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__iinfo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_from_py_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MAXint64 = __pyx_t_5;

  /* "pandas/algos.pyx":32
 * cdef np.int32_t MAXint32 = np.iinfo(np.int32).max
 * cdef np.int64_t MAXint64 = np.iinfo(np.int64).max
 * cdef np.float32_t MAXfloat32 = np.inf             # <<<<<<<<<<<<<<
 * cdef np.float64_t MAXfloat64 = np.inf
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_float32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_6pandas_5algos_MAXfloat32 = __pyx_t_6;

  /* "pandas/algos.pyx":33
 * cdef np.int64_t MAXint64 = np.iinfo(np.int64).max
 * cdef np.float32_t MAXfloat32 = np.inf
 * cdef np.float64_t MAXfloat64 = np.inf             # <<<<<<<<<<<<<<
 * 
 * cdef double NaN = <double> np.NaN
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_MAXfloat64 = __pyx_t_7;

  /* "pandas/algos.pyx":35
 * cdef np.float64_t MAXfloat64 = np.inf
 * 
 * cdef double NaN = <double> np.NaN             # <<<<<<<<<<<<<<
 * cdef double nan = NaN
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__NaN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_6pandas_5algos_NaN = ((double)__pyx_t_8);

  /* "pandas/algos.pyx":36
 * 
 * cdef double NaN = <double> np.NaN
 * cdef double nan = NaN             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_6pandas_5algos_nan = __pyx_v_6pandas_5algos_NaN;

  /* "pandas/algos.pyx":48
 *     int signbit(double)
 * 
 * from . import lib             # <<<<<<<<<<<<<<
 * 
 * include "skiplist.pyx"
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__lib));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__lib));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lib));
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_155), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__lib);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__lib);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__lib, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":23
 * cimport numpy as np
 * from numpy cimport *
 * import numpy as np             # <<<<<<<<<<<<<<
 * 
 * from random import random
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/skiplist.pyx":25
 * import numpy as np
 * 
 * from random import random             # <<<<<<<<<<<<<<
 * 
 * # initialize numpy
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__random));
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__random));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__random));
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__random), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__random);
  if (__pyx_t_1 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__random);
    if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/src/skiplist.pyx":28
 * 
 * # initialize numpy
 * import_array()             # <<<<<<<<<<<<<<
 * 
 * # TODO: optimize this, make less messy
 */
  import_array();

  /* "pandas/src/skiplist.pyx":44
 * 
 * # Singleton terminator node
 * NIL = Node(np.inf, [], [])             # <<<<<<<<<<<<<<
 * 
 * cdef class IndexableSkiplist:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6pandas_5algos_Node)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NIL, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":54
 * 
 * cdef:
 *     int TIEBREAK_AVERAGE = 0             # <<<<<<<<<<<<<<
 *     int TIEBREAK_MIN = 1
 *     int TIEBREAK_MAX = 2
 */
  __pyx_v_6pandas_5algos_TIEBREAK_AVERAGE = 0;

  /* "pandas/algos.pyx":55
 * cdef:
 *     int TIEBREAK_AVERAGE = 0
 *     int TIEBREAK_MIN = 1             # <<<<<<<<<<<<<<
 *     int TIEBREAK_MAX = 2
 *     int TIEBREAK_FIRST = 3
 */
  __pyx_v_6pandas_5algos_TIEBREAK_MIN = 1;

  /* "pandas/algos.pyx":56
 *     int TIEBREAK_AVERAGE = 0
 *     int TIEBREAK_MIN = 1
 *     int TIEBREAK_MAX = 2             # <<<<<<<<<<<<<<
 *     int TIEBREAK_FIRST = 3
 *     int TIEBREAK_FIRST_DESCENDING = 4
 */
  __pyx_v_6pandas_5algos_TIEBREAK_MAX = 2;

  /* "pandas/algos.pyx":57
 *     int TIEBREAK_MIN = 1
 *     int TIEBREAK_MAX = 2
 *     int TIEBREAK_FIRST = 3             # <<<<<<<<<<<<<<
 *     int TIEBREAK_FIRST_DESCENDING = 4
 * 
 */
  __pyx_v_6pandas_5algos_TIEBREAK_FIRST = 3;

  /* "pandas/algos.pyx":58
 *     int TIEBREAK_MAX = 2
 *     int TIEBREAK_FIRST = 3
 *     int TIEBREAK_FIRST_DESCENDING = 4             # <<<<<<<<<<<<<<
 * 
 * tiebreakers = {
 */
  __pyx_v_6pandas_5algos_TIEBREAK_FIRST_DESCENDING = 4;

  /* "pandas/algos.pyx":60
 *     int TIEBREAK_FIRST_DESCENDING = 4
 * 
 * tiebreakers = {             # <<<<<<<<<<<<<<
 *     'average' : TIEBREAK_AVERAGE,
 *     'min' : TIEBREAK_MIN,
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "pandas/algos.pyx":61
 * 
 * tiebreakers = {
 *     'average' : TIEBREAK_AVERAGE,             # <<<<<<<<<<<<<<
 *     'min' : TIEBREAK_MIN,
 *     'max' : TIEBREAK_MAX,
 */
  __pyx_t_9 = PyInt_FromLong(__pyx_v_6pandas_5algos_TIEBREAK_AVERAGE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__average), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":62
 * tiebreakers = {
 *     'average' : TIEBREAK_AVERAGE,
 *     'min' : TIEBREAK_MIN,             # <<<<<<<<<<<<<<
 *     'max' : TIEBREAK_MAX,
 *     'first' : TIEBREAK_FIRST
 */
  __pyx_t_9 = PyInt_FromLong(__pyx_v_6pandas_5algos_TIEBREAK_MIN); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__min), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":63
 *     'average' : TIEBREAK_AVERAGE,
 *     'min' : TIEBREAK_MIN,
 *     'max' : TIEBREAK_MAX,             # <<<<<<<<<<<<<<
 *     'first' : TIEBREAK_FIRST
 * }
 */
  __pyx_t_9 = PyInt_FromLong(__pyx_v_6pandas_5algos_TIEBREAK_MAX); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__max), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":65
 *     'max' : TIEBREAK_MAX,
 *     'first' : TIEBREAK_FIRST
 * }             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_9 = PyInt_FromLong(__pyx_v_6pandas_5algos_TIEBREAK_FIRST); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__first), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__tiebreakers, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":121
 * 
 * 
 * def rank_1d_float64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                     na_option='keep'):
 *     """
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_3 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_1rank_1d_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_1d_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":193
 * 
 * 
 * def rank_1d_int64(object in_arr, ties_method='average', ascending=True,             # <<<<<<<<<<<<<<
 *                   na_option='keep'):
 *     """
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_6 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_3rank_1d_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_1d_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":254
 * 
 * def rank_2d_float64(object in_arr, axis=0, ties_method='average',
 *                     ascending=True, na_option='keep'):             # <<<<<<<<<<<<<<
 *     """
 *     Fast NaN-friendly version of scipy.stats.rankdata
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_9 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":253
 * 
 * 
 * def rank_2d_float64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_5rank_2d_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_2d_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":337
 * 
 * def rank_2d_int64(object in_arr, axis=0, ties_method='average',
 *                     ascending=True, na_option='keep'):             # <<<<<<<<<<<<<<
 *     """
 *     Fast NaN-friendly version of scipy.stats.rankdata
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_15 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":336
 * 
 * 
 * def rank_2d_int64(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_7rank_2d_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_2d_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":405
 * 
 * def rank_1d_generic(object in_arr, bint retry=1, ties_method='average',
 *                     ascending=True, na_option='keep'):             # <<<<<<<<<<<<<<
 *     """
 *     Fast NaN-friendly version of scipy.stats.rankdata
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_21 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":404
 * 
 * 
 * def rank_1d_generic(object in_arr, bint retry=1, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_9rank_1d_generic, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_1d_generic, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":490
 *         return left != right
 * 
 * _return_false = lambda self, other: False             # <<<<<<<<<<<<<<
 * _return_true = lambda self, other: True
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pandas_5algos_306lambda1, 0, NULL, __pyx_n_s_159, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___return_false, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":491
 * 
 * _return_false = lambda self, other: False
 * _return_true = lambda self, other: True             # <<<<<<<<<<<<<<
 * 
 * class Infinity(object):
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6pandas_5algos_307lambda2, 0, NULL, __pyx_n_s_159, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___return_true, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":493
 * _return_true = lambda self, other: True
 * 
 * class Infinity(object):             # <<<<<<<<<<<<<<
 * 
 *     __lt__ = _return_false
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "pandas/algos.pyx":495
 * class Infinity(object):
 * 
 *     __lt__ = _return_false             # <<<<<<<<<<<<<<
 *     __le__ = _return_false
 *     __eq__ = _return_false
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____lt__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":496
 * 
 *     __lt__ = _return_false
 *     __le__ = _return_false             # <<<<<<<<<<<<<<
 *     __eq__ = _return_false
 *     __ne__ = _return_true
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____le__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":497
 *     __lt__ = _return_false
 *     __le__ = _return_false
 *     __eq__ = _return_false             # <<<<<<<<<<<<<<
 *     __ne__ = _return_true
 *     __gt__ = _return_true
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____eq__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":498
 *     __le__ = _return_false
 *     __eq__ = _return_false
 *     __ne__ = _return_true             # <<<<<<<<<<<<<<
 *     __gt__ = _return_true
 *     __ge__ = _return_true
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____ne__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":499
 *     __eq__ = _return_false
 *     __ne__ = _return_true
 *     __gt__ = _return_true             # <<<<<<<<<<<<<<
 *     __ge__ = _return_true
 *     __cmp__ = _return_false
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____gt__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":500
 *     __ne__ = _return_true
 *     __gt__ = _return_true
 *     __ge__ = _return_true             # <<<<<<<<<<<<<<
 *     __cmp__ = _return_false
 * 
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____ge__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":501
 *     __gt__ = _return_true
 *     __ge__ = _return_true
 *     __cmp__ = _return_false             # <<<<<<<<<<<<<<
 * 
 * class NegInfinity(object):
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____cmp__, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/algos.pyx":493
 * _return_true = lambda self, other: True
 * 
 * class Infinity(object):             # <<<<<<<<<<<<<<
 * 
 *     __lt__ = _return_false
 */
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_9), ((PyObject *)__pyx_t_3), __pyx_n_s__Infinity, __pyx_n_s_159); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Infinity, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":503
 *     __cmp__ = _return_false
 * 
 * class NegInfinity(object):             # <<<<<<<<<<<<<<
 * 
 *     __lt__ = _return_true
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "pandas/algos.pyx":505
 * class NegInfinity(object):
 * 
 *     __lt__ = _return_true             # <<<<<<<<<<<<<<
 *     __le__ = _return_true
 *     __eq__ = _return_false
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____lt__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":506
 * 
 *     __lt__ = _return_true
 *     __le__ = _return_true             # <<<<<<<<<<<<<<
 *     __eq__ = _return_false
 *     __ne__ = _return_true
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____le__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":507
 *     __lt__ = _return_true
 *     __le__ = _return_true
 *     __eq__ = _return_false             # <<<<<<<<<<<<<<
 *     __ne__ = _return_true
 *     __gt__ = _return_false
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____eq__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":508
 *     __le__ = _return_true
 *     __eq__ = _return_false
 *     __ne__ = _return_true             # <<<<<<<<<<<<<<
 *     __gt__ = _return_false
 *     __ge__ = _return_false
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____ne__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":509
 *     __eq__ = _return_false
 *     __ne__ = _return_true
 *     __gt__ = _return_false             # <<<<<<<<<<<<<<
 *     __ge__ = _return_false
 *     __cmp__ = _return_true
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____gt__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":510
 *     __ne__ = _return_true
 *     __gt__ = _return_false
 *     __ge__ = _return_false             # <<<<<<<<<<<<<<
 *     __cmp__ = _return_true
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_false); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____ge__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":511
 *     __gt__ = _return_false
 *     __ge__ = _return_false
 *     __cmp__ = _return_true             # <<<<<<<<<<<<<<
 * 
 * def rank_2d_generic(object in_arr, axis=0, ties_method='average',
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___return_true); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____cmp__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pandas/algos.pyx":503
 *     __cmp__ = _return_false
 * 
 * class NegInfinity(object):             # <<<<<<<<<<<<<<
 * 
 *     __lt__ = _return_true
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_9 = __Pyx_CreateClass(((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3), __pyx_n_s__NegInfinity, __pyx_n_s_159); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NegInfinity, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":514
 * 
 * def rank_2d_generic(object in_arr, axis=0, ties_method='average',
 *                     ascending=True, na_option='keep'):             # <<<<<<<<<<<<<<
 *     """
 *     Fast NaN-friendly version of scipy.stats.rankdata
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_27 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/algos.pyx":513
 *     __cmp__ = _return_true
 * 
 * def rank_2d_generic(object in_arr, axis=0, ties_method='average',             # <<<<<<<<<<<<<<
 *                     ascending=True, na_option='keep'):
 *     """
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_11rank_2d_generic, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rank_2d_generic, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_float64(ndarray[float64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                     ndarray[float64_t, ndim=2] out,
 *                     Py_ssize_t periods, int axis):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_13diff_2d_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__diff_2d_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":665
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int64(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_15diff_2d_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__diff_2d_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":710
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def diff_2d_int32(ndarray[int64_t, ndim=2] arr,             # <<<<<<<<<<<<<<
 *                   ndarray[float64_t, ndim=2] out,
 *                   Py_ssize_t periods, int axis):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_17diff_2d_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__diff_2d_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":764
 * # -
 * 
 * def _check_minp(win, minp, N):             # <<<<<<<<<<<<<<
 *     if minp > win:
 *         raise ValueError('min_periods (%d) must be <= window (%d)'
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_19_check_minp, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___check_minp, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":791
 * #               Series: Prentice-Hall Series in Automatic Computation
 * 
 * def kth_smallest(ndarray[double_t] a, Py_ssize_t k):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i,j,l,m,n
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_21kth_smallest, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__kth_smallest, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":848
 * 
 * 
 * def median(ndarray arr):             # <<<<<<<<<<<<<<
 *     '''
 *     A faster median
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_23median, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__median, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":868
 * # -------------- Min, Max subsequence
 * 
 * def max_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i=0,s=0,e=0,T,n
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_25max_subseq, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__max_subseq, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":896
 *     return (s, e, m)
 * 
 * def min_subseq(ndarray[double_t] arr):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t s, e
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_27min_subseq, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__min_subseq, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":908
 * # Rolling sum
 * 
 * def roll_sum(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0
 *     cdef int nobs = 0, i
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_29roll_sum, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_sum, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":950
 * # Rolling mean
 * 
 * def roll_mean(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_31roll_mean, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_mean, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1007
 * # Exponentially weighted moving average
 * 
 * def ewma(ndarray[double_t] input, double_t com, int adjust):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute exponentially-weighted moving average using center-of-mass.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_33ewma, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ewma, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1069
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def nancorr(ndarray[float64_t, ndim=2] mat, cov=False, minp=None):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, xi, yi, N, K
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_39 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_35nancorr, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__nancorr, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1126
 * # Rolling variance
 * 
 * def roll_var(ndarray[double_t] input, int win, int minp, int ddof=1):             # <<<<<<<<<<<<<<
 *     cdef double val, prev, sum_x = 0, sum_xx = 0, nobs = 0
 *     cdef Py_ssize_t i
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_37roll_var, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_var, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1180
 * # Rolling skewness
 * 
 * def roll_skew(ndarray[double_t] input, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, prev
 *     cdef double x = 0, xx = 0, xxx = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_39roll_skew, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_skew, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1241
 * 
 * 
 * def roll_kurt(ndarray[double_t] input,             # <<<<<<<<<<<<<<
 *                int win, int minp):
 *     cdef double val, prev
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_41roll_kurt, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_kurt, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1356
 * from skiplist cimport *
 * 
 * def roll_median_c(ndarray[float64_t] arg, int win, int minp):             # <<<<<<<<<<<<<<
 *     cdef double val, res, prev
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_43roll_median_c, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_median_c, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1411
 *     return output
 * 
 * def roll_median_cython(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_45roll_median_cython, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_median_cython, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_max2(ndarray[float64_t] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving max of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_47roll_max2, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_max2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1527
 *     return y
 * 
 * def roll_max(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_49roll_max, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_max, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1540
 *         return NaN
 * 
 * def roll_min(ndarray input, int win, int minp):             # <<<<<<<<<<<<<<
 *     '''
 *     O(N log(window)) implementation using skip list
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_51roll_min, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1540; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1548
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def roll_min2(np.ndarray[np.float64_t, ndim=1] a, int window, int minp):             # <<<<<<<<<<<<<<
 *     "Moving min of 1d array of dtype=float64 along axis=0 ignoring NaNs."
 *     cdef np.float64_t ai, aold
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_53roll_min2, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_min2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1634
 *         return NaN
 * 
 * def roll_quantile(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                   int minp, double quantile):
 *     '''
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_55roll_quantile, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_quantile, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1681
 *     return output
 * 
 * def roll_generic(ndarray[float64_t, cast=True] input, int win,             # <<<<<<<<<<<<<<
 *                  int minp, object func):
 *     cdef ndarray[double_t] output, counts, bufarr
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_57roll_generic, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_generic, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1723
 * 
 * 
 * def roll_window(ndarray[float64_t, ndim=1, cast=True] input,             # <<<<<<<<<<<<<<
 *                 ndarray[float64_t, ndim=1, cast=True] weights,
 *                 int minp, bint avg=True, bint avg_wgt=False):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_59roll_window, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__roll_window, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1796
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def is_lexsorted(list list_of_arrays):             # <<<<<<<<<<<<<<
 *     cdef:
 *         int i
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_61is_lexsorted, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_lexsorted, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1829
 * 
 * @cython.boundscheck(False)
 * def groupby_indices(ndarray values):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(values)
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_63groupby_indices, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_indices, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1866
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def group_labels(ndarray[object] values):             # <<<<<<<<<<<<<<
 *     '''
 *     Compute label vector from input values and associated useful data
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_65group_labels, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_labels, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1908
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def groupsort_indexer(ndarray[int64_t] index, Py_ssize_t ngroups):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, loc, label, n
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_67groupsort_indexer, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupsort_indexer, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1937
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_69group_add, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_add, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":1992
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_71group_prod, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_prod, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1992; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2049
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_73group_nth, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_nth, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2091
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] counts,
 *                      ndarray[object, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_75group_nth_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_nth_object, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2135
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_77group_nth_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_nth_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2181
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_nth_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                          ndarray[int64_t] counts,
 *                          ndarray[object, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_79group_nth_bin_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_238, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2229
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_81group_last, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_last, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2270
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                       ndarray[int64_t] counts,
 *                       ndarray[object, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_83group_last_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_last_object, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2313
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_85group_last_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_last_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2358
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_last_bin_object(ndarray[object, ndim=2] out,             # <<<<<<<<<<<<<<
 *                           ndarray[int64_t] counts,
 *                           ndarray[object, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_87group_last_bin_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_247, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2409
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_89group_min, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_min, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2409; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2468
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_91group_max, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_max, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2527
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_mean(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                ndarray[int64_t] counts,
 *                ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_93group_mean, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_mean, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2576
 * 
 * 
 * def group_median(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                  ndarray[int64_t] counts,
 *                  ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_95group_median, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_median, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2648
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *               ndarray[int64_t] counts,
 *               ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_97group_var, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_var, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2708
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_add_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_99group_add_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_add_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2765
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_prod_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_101group_prod_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_prod_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2822
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_min_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_103group_min_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_min_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2885
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_max_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_105group_max_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_max_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2885; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":2947
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_ohlc(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_107group_ohlc, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_ohlc, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":3022
 * # @cython.boundscheck(False)
 * # @cython.wraparound(False)
 * def group_mean_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                    ndarray[int64_t] counts,
 *                    ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_109group_mean_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_mean_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/algos.pyx":3077
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def group_var_bin(ndarray[float64_t, ndim=2] out,             # <<<<<<<<<<<<<<
 *                   ndarray[int64_t] counts,
 *                   ndarray[float64_t, ndim=2] values,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_111group_var_bin, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__group_var_bin, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":1
 * def inner_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                Py_ssize_t max_groups):
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_113inner_join, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__inner_join, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":52
 * 
 * def left_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,
 *                     Py_ssize_t max_groups, sort=True):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, count = 0
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_47 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":51
 *             _get_result_indexer(right_sorter, right_indexer))
 * 
 * def left_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                     Py_ssize_t max_groups, sort=True):
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_115left_outer_join, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__left_outer_join, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":120
 * 
 * 
 * def full_outer_join(ndarray[int64_t] left, ndarray[int64_t] right,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t max_groups):
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_117full_outer_join, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__full_outer_join, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":184
 * 
 * 
 * def _get_result_indexer(sorter, indexer):             # <<<<<<<<<<<<<<
 *     if indexer.dtype != np.int_:
 *         indexer = indexer.astype(np.int_)
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_119_get_result_indexer, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s___get_result_indexer, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":199
 * 
 * 
 * def ffill_indexer(ndarray[int64_t] indexer):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n = len(indexer)
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_121ffill_indexer, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ffill_indexer, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/join.pyx":219
 * 
 * 
 * def ffill_by_group(ndarray[int64_t] indexer, ndarray[int64_t] group_ids,             # <<<<<<<<<<<<<<
 *                    int64_t max_group):
 *     cdef:
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_123ffill_by_group, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ffill_by_group, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":15
 * cimport cpython
 * 
 * import numpy as np             # <<<<<<<<<<<<<<
 * isnan = np.isnan
 * 
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":16
 * 
 * import numpy as np
 * isnan = np.isnan             # <<<<<<<<<<<<<<
 * 
 * from datetime import datetime as pydatetime
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__isnan); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isnan, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "pandas/src/generated.pyx":18
 * isnan = np.isnan
 * 
 * from datetime import datetime as pydatetime             # <<<<<<<<<<<<<<
 * 
 * # this is our datetime.pxd
 */
  __pyx_t_9 = PyList_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__datetime));
  PyList_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_n_s__datetime));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__datetime));
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__datetime), ((PyObject *)__pyx_t_9), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__datetime);
  if (__pyx_t_9 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__datetime);
    if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_9);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pydatetime, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":31
 * 
 * # import datetime C API
 * PyDateTime_IMPORT             # <<<<<<<<<<<<<<
 * 
 * # initialize numpy
 */
  PyDateTime_IMPORT;

  /* "pandas/src/generated.pyx":34
 * 
 * # initialize numpy
 * import_array()             # <<<<<<<<<<<<<<
 * import_ufunc()
 * 
 */
  import_array();

  /* "pandas/src/generated.pyx":35
 * # initialize numpy
 * import_array()
 * import_ufunc()             # <<<<<<<<<<<<<<
 * 
 * cdef int PLATFORM_INT = (<ndarray> np.arange(0, dtype=np.int_)).descr.type_num
 */
  import_ufunc();

  /* "pandas/src/generated.pyx":37
 * import_ufunc()
 * 
 * cdef int PLATFORM_INT = (<ndarray> np.arange(0, dtype=np.int_)).descr.type_num             # <<<<<<<<<<<<<<
 * 
 * cpdef ensure_platform_int(object arr):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__arange); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int_); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_285), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1)->descr->type_num;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_6pandas_5algos_PLATFORM_INT = __pyx_t_10;

  /* "pandas/src/generated.pyx":203
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_145pad_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":264
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_147pad_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_object, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":325
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_149pad_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_int32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":386
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_151pad_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":447
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                    limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_153pad_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":509
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_float64(ndarray[float64_t] old, ndarray[float64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_155backfill_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__backfill_float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":571
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_object(ndarray[object] old, ndarray[object] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_157backfill_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__backfill_object, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":633
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int32(ndarray[int32_t] old, ndarray[int32_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_159backfill_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__backfill_int32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":695
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_int64(ndarray[int64_t] old, ndarray[int64_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_161backfill_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__backfill_int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":757
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_bool(ndarray[uint8_t] old, ndarray[uint8_t] new,             # <<<<<<<<<<<<<<
 *                       limit=None):
 *     cdef Py_ssize_t i, j, nleft, nright
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_163backfill_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__backfill_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":820
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_165pad_inplace_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_inplace_float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":849
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_167pad_inplace_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_inplace_object, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":878
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_169pad_inplace_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_inplace_int32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":907
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_171pad_inplace_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_inplace_int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":936
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                          ndarray[uint8_t, cast=True] mask,
 *                          limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_173pad_inplace_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_inplace_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":966
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_175backfill_inplace_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_319, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":994
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_177backfill_inplace_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_322, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1022
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_179backfill_inplace_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_325, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1050
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_181backfill_inplace_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_328, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1078
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_inplace_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                               ndarray[uint8_t, cast=True] mask,
 *                               limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_183backfill_inplace_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_331, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1107
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_185pad_2d_inplace_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_334, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1137
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_187pad_2d_inplace_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_337, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1167
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_189pad_2d_inplace_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_340, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1197
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_191pad_2d_inplace_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_343, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1227
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                             ndarray[uint8_t, ndim=2] mask,
 *                             limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_193pad_2d_inplace_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pad_2d_inplace_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1258
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_195backfill_2d_inplace_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_348, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1288
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_197backfill_2d_inplace_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_351, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1318
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_199backfill_2d_inplace_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_354, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1348
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_201backfill_2d_inplace_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_357, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1378
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                                  ndarray[uint8_t, ndim=2] mask,
 *                                  limit=None):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_203backfill_2d_inplace_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_360, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1410
 * def take_1d_float64(ndarray[float64_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_91 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1408
 * 
 * @cython.wraparound(False)
 * def take_1d_float64(ndarray[float64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_205take_1d_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_1d_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1442
 * def take_1d_object(ndarray[object] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_94 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1440
 * 
 * @cython.wraparound(False)
 * def take_1d_object(ndarray[object] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_207take_1d_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_1d_object, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1474
 * def take_1d_int32(ndarray[int32_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_96 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1472
 * 
 * @cython.wraparound(False)
 * def take_1d_int32(ndarray[int32_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_209take_1d_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_1d_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1506
 * def take_1d_int64(ndarray[int64_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_98 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1504
 * 
 * @cython.wraparound(False)
 * def take_1d_int64(ndarray[int64_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_211take_1d_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_1d_int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1538
 * def take_1d_bool(ndarray[uint8_t] values,
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_100 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1536
 * 
 * @cython.wraparound(False)
 * def take_1d_bool(ndarray[uint8_t] values,             # <<<<<<<<<<<<<<
 *                      ndarray[int64_t] indexer,
 *                      out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_213take_1d_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_1d_bool, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1570
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_float64(ndarray[float64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_215is_monotonic_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_373, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1570; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1597
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_object(ndarray[object] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_217is_monotonic_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_monotonic_object, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1624
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int32(ndarray[int32_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_219is_monotonic_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_monotonic_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1651
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_int64(ndarray[int64_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_221is_monotonic_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_monotonic_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1678
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * def is_monotonic_bool(ndarray[uint8_t] arr):             # <<<<<<<<<<<<<<
 *     '''
 *     Returns
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_223is_monotonic_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__is_monotonic_bool, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1706
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_float64(ndarray[float64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_225groupby_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_object(ndarray[object] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_227groupby_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_object, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1756
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int32(ndarray[int32_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_229groupby_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1781
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_int64(ndarray[int64_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_231groupby_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1806
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def groupby_bool(ndarray[uint8_t] index, ndarray labels):             # <<<<<<<<<<<<<<
 *     cdef dict result = {}
 *     cdef Py_ssize_t i, length
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_233groupby_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__groupby_bool, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1832
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_float64(ndarray[float64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_235arrmap_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap_float64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1847
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_object(ndarray[object] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_237arrmap_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap_object, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1862
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int32(ndarray[int32_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_239arrmap_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1877
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_int64(ndarray[int64_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_241arrmap_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1892
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def arrmap_bool(ndarray[uint8_t] index, object func):             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t length = index.shape[0]
 *     cdef Py_ssize_t i = 0
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_243arrmap_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__arrmap_bool, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1910
 * def take_2d_axis0_float64(ndarray[float64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_104 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1908
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_245take_2d_axis0_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_404, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1948
 * def take_2d_axis0_object(ndarray[object, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1948; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_106 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1946
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_247take_2d_axis0_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_407, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":1986
 * def take_2d_axis0_int32(ndarray[int32_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_108 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":1984
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_249take_2d_axis0_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis0_int32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 1984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2024
 * def take_2d_axis0_int64(ndarray[int64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_110 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2022
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_251take_2d_axis0_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis0_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2062
 * def take_2d_axis0_bool(ndarray[uint8_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_112 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2060
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis0_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_253take_2d_axis0_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis0_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2101
 * def take_2d_axis1_float64(ndarray[float64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_114 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2099
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_255take_2d_axis1_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_44, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2099; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2141
 * def take_2d_axis1_object(ndarray[object, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_116 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2139
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_257take_2d_axis1_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_418, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2181
 * def take_2d_axis1_int32(ndarray[int32_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_118 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2179
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_259take_2d_axis1_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis1_int32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2221
 * def take_2d_axis1_int64(ndarray[int64_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_120 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2219
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_261take_2d_axis1_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis1_int64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2261
 * def take_2d_axis1_bool(ndarray[uint8_t, ndim=2] values,
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_122 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2259
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_axis1_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] indexer,
 *                            out=None, fill_value=np.nan):
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_263take_2d_axis1_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_axis1_bool, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2303
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_124 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2300
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_float64(ndarray[float64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_265take_2d_multi_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_427, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2349
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_127 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_object(ndarray[object, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_267take_2d_multi_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_430, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2395
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_130 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2392
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int32(ndarray[int32_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_269take_2d_multi_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_multi_int32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2441
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__nan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_133 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2438
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_int64(ndarray[int64_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_271take_2d_multi_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_multi_int64, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pandas/src/generated.pyx":2487
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 *                            out=None, fill_value=np.nan):             # <<<<<<<<<<<<<<
 *     cdef:
 *         Py_ssize_t i, j, k, n, idx
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2487; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_k_136 = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2484
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def take_2d_multi_bool(ndarray[uint8_t, ndim=2] values,             # <<<<<<<<<<<<<<
 *                            ndarray[int64_t] idx0,
 *                            ndarray[int64_t] idx1,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_273take_2d_multi_bool, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_2d_multi_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2531
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[float64_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_275left_join_indexer_unique_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_439, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2576
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[object] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_277left_join_indexer_unique_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_442, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2621
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int32_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_279left_join_indexer_unique_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_445, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2666
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def left_join_indexer_unique_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                       ndarray[int64_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_281left_join_indexer_unique_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_448, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2711
 * 
 * 
 * def left_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_283left_join_indexer_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_451, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2813
 * 
 * 
 * def left_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_285left_join_indexer_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_454, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":2915
 * 
 * 
 * def left_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_287left_join_indexer_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_457, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3017
 * 
 * 
 * def left_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_289left_join_indexer_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_460, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3121
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[float64_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_291outer_join_indexer_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_463, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3250
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[object] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_293outer_join_indexer_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_466, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3379
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int32_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_295outer_join_indexer_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_469, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3508
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def outer_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                                 ndarray[int64_t] right):
 *     cdef:
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_297outer_join_indexer_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_472, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3638
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_float64(ndarray[float64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[float64_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_299inner_join_indexer_float64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_475, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3731
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_object(ndarray[object] left,             # <<<<<<<<<<<<<<
 *                               ndarray[object] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_301inner_join_indexer_object, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_478, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3824
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int32(ndarray[int32_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int32_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_303inner_join_indexer_int32, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_481, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/src/generated.pyx":3917
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def inner_join_indexer_int64(ndarray[int64_t] left,             # <<<<<<<<<<<<<<
 *                               ndarray[int64_t] right):
 *     '''
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pandas_5algos_305inner_join_indexer_int64, NULL, __pyx_n_s_159); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_484, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pandas/algos.pyx":1
 * from numpy cimport *             # <<<<<<<<<<<<<<
 * cimport numpy as np
 * import numpy as np
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "util.pxd":83
 *         return False
 * 
 * cdef inline bint _checknan(object val):             # <<<<<<<<<<<<<<
 *     return not cnp.PyArray_Check(val) and val != val
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  if (__pyx_m) {
    __Pyx_AddTraceback("init pandas.algos", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init pandas.algos");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

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

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,
                 "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

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

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

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

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        }
        else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause && cause != Py_None) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  unsigned int n = 1;
  return *(unsigned char*)(&n) != 0;
}
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1) /* First char was not a digit */
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count; /* Consume from buffer string */
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break; /* breaks both loops as ctx->enc_count == 0 */
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue; /* empty struct */
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static CYTHON_INLINE PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        if (isspace(*ts))
            continue;
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
                return ts;
      case ' ':
      case 10:
      case 13:
        ++ts;
        break;
      case '<':
        if (!__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_IsLittleEndian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T': /* substruct */
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0; /* Erase processed last struct element */
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}': /* end of substruct; either repeat or move on */
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0; /* Erase processed last struct element */
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }        /* fall through */
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 's': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
        } else {
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_count = ctx->new_count;
          ctx->enc_packmode = ctx->new_packmode;
          ctx->enc_type = *ts;
          ctx->is_complex = got_Z;
        }
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  if (obj == Py_None || obj == NULL) {
    __Pyx_ZeroBuffer(buf);
    return 0;
  }
  buf->buf = NULL;
  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  if (buf->ndim != nd) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if ((unsigned)buf->itemsize != dtype->size) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_ZeroBuffer(buf);
  return -1;
}
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (info->buf == NULL) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_Format(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (DECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
    long r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

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

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

static CYTHON_INLINE Py_ssize_t __Pyx_mod_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t r = a % b;
    r += ((r != 0) & ((r ^ b) < 0)) * b;
    return r;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    CYTHON_UNUSED PyObject *getbuffer_cobj;
  #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  #endif
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  #if PY_VERSION_HEX < 0x02060000
    if (obj->ob_type->tp_dict &&
        (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
                                             "__pyx_getbuffer"))) {
        getbufferproc func;
      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
        func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
      #else
        func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
      #endif
        Py_DECREF(getbuffer_cobj);
        if (!func)
            goto fail;
        return func(obj, view, flags);
    } else {
        PyErr_Clear();
    }
  #endif
    PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    CYTHON_UNUSED PyObject *releasebuffer_cobj;
    if (!obj) return;
  #if PY_VERSION_HEX >= 0x02060000
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
  #endif
        if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
  #if PY_VERSION_HEX < 0x02060000
    if (obj->ob_type->tp_dict &&
        (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
                                                      "__pyx_releasebuffer"))) {
        releasebufferproc func;
      #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
        func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
      #else
        func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
      #endif
        Py_DECREF(releasebuffer_cobj);
        if (!func)
            goto fail;
        func(obj, view);
        return;
    } else {
        PyErr_Clear();
    }
  #endif
    goto nofail;
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
    PyErr_WriteUnraisable(obj);
nofail:
    Py_DECREF(obj);
    view->obj = NULL;
}
#endif /*  PY_MAJOR_VERSION < 3 */


    static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                /* try package relative import first */
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) {
    const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(npy_int32) == sizeof(char)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(npy_int32) == sizeof(short)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(npy_int32) == sizeof(int)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(npy_int32) == sizeof(long)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
        #else
        npy_int32 val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        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 (npy_int32)-1;
    }
}

static CYTHON_INLINE npy_int64 __Pyx_PyInt_from_py_npy_int64(PyObject* x) {
    const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(npy_int64) == sizeof(char)) {
        if (is_unsigned)
            return (npy_int64)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (npy_int64)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(npy_int64) == sizeof(short)) {
        if (is_unsigned)
            return (npy_int64)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (npy_int64)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(npy_int64) == sizeof(int)) {
        if (is_unsigned)
            return (npy_int64)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_int64)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(npy_int64) == sizeof(long)) {
        if (is_unsigned)
            return (npy_int64)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (npy_int64)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (npy_int64)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (npy_int64)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
        #else
        npy_int64 val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        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 (npy_int64)-1;
    }
}

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
#if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
                 PyString_AsString(name));
#else
    PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
#endif
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
        op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
        op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
    }
    if (op->func_doc == 0) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        op->func_doc = Py_None; /* Mark as deleted */
    else
        op->func_doc = value;
    Py_INCREF(op->func_doc);
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (op->func_name == NULL) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (value == NULL || !PyUnicode_Check(value)) {
#else
    if (value == NULL || !PyString_Check(value)) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (op->func_dict == NULL) {
        op->func_dict = PyDict_New();
        if (op->func_dict == NULL)
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (value == NULL) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    PyObject* dict = PyModule_GetDict(__pyx_m);
    Py_XINCREF(dict);
    return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
{
    if (op->defaults_tuple) {
        Py_INCREF(op->defaults_tuple);
        return op->defaults_tuple;
    }
    if (op->defaults_getter) {
        PyObject *res = op->defaults_getter((PyObject *) op);
        if (res) {
            Py_INCREF(res);
            op->defaults_tuple = res;
        }
        return res;
    }
    Py_INCREF(Py_None);
    return Py_None;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
                                      PyObject *closure, PyObject *module, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_getter = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
    PyObject *func_name = __Pyx_CyFunction_get_name(op);
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                func_name, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(func_name), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*tp_new*/
    0,                                  /*tp_free*/
    0,                                  /*tp_is_gc*/
    0,                                  /*tp_bases*/
    0,                                  /*tp_mro*/
    0,                                  /*tp_cache*/
    0,                                  /*tp_subclasses*/
    0,                                  /*tp_weaklist*/
    0,                                  /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
    0,                                  /*tp_version_tag*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
        return -1;
    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, sizeof(size));
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;
    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int64(npy_int64 val) {
    const npy_int64 neg_one = (npy_int64)-1, const_zero = (npy_int64)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(npy_int64) == sizeof(char))  ||
        (sizeof(npy_int64) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(npy_int64) == sizeof(int)) ||
               (sizeof(npy_int64) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(npy_int64) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE npy_uint8 __Pyx_PyInt_from_py_npy_uint8(PyObject* x) {
    const npy_uint8 neg_one = (npy_uint8)-1, const_zero = (npy_uint8)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(npy_uint8) == sizeof(char)) {
        if (is_unsigned)
            return (npy_uint8)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (npy_uint8)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(npy_uint8) == sizeof(short)) {
        if (is_unsigned)
            return (npy_uint8)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (npy_uint8)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(npy_uint8) == sizeof(int)) {
        if (is_unsigned)
            return (npy_uint8)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (npy_uint8)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(npy_uint8) == sizeof(long)) {
        if (is_unsigned)
            return (npy_uint8)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (npy_uint8)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(npy_uint8) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (npy_uint8)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (npy_uint8)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
        PyErr_SetString(PyExc_RuntimeError,
                        "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
        #else
        npy_uint8 val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        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 (npy_uint8)-1;
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) {
    const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(npy_int32) == sizeof(char))  ||
        (sizeof(npy_int32) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(npy_int32) == sizeof(int)) ||
               (sizeof(npy_int32) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(npy_int32),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint8(npy_uint8 val) {
    const npy_uint8 neg_one = (npy_uint8)-1, const_zero = (npy_uint8)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(npy_uint8) == sizeof(char))  ||
        (sizeof(npy_uint8) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(npy_uint8) == sizeof(int)) ||
               (sizeof(npy_uint8) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(npy_uint8) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(npy_uint8),
                                     little, !is_unsigned);
    }
}

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        float denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(a, a);
                    case 3:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, a);
                    case 4:
                        z = __Pyx_c_prodf(a, a);
                        return __Pyx_c_prodf(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_absf(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

#if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        double denom = b.real * b.real + b.imag * b.imag;
        z.real = (a.real * b.real + a.imag * b.imag) / denom;
        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(a, a);
                    case 3:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, a);
                    case 4:
                        z = __Pyx_c_prod(a, a);
                        return __Pyx_c_prod(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                }
                r = a.real;
                theta = 0;
            } else {
                r = __Pyx_c_abs(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

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

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

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

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

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);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __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,      /*int firstlineno,*/
        __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;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}


/* Type Conversion Functions */

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

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

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

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


#endif /* Py_PYTHON_H */
