Generated by Cython 0.14.1 on Fri Dec 23 22:28:58 2011

Raw output: sandbox.c

     1: from numpy cimport *

      /* "sandbox.pyx":1
     * from numpy cimport *             # <<<<<<<<<<<<<<
     * cimport numpy as cnp
     * 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;

     2: cimport numpy as cnp

     3: import numpy as np

      /* "sandbox.pyx":3
     * from numpy cimport *
     * cimport numpy as cnp
     * import numpy as np             # <<<<<<<<<<<<<<
     *
     * cimport cpython
     */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); 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;

     4:

     5: cimport cpython

     6:

     7: cnp.import_array()

      /* "sandbox.pyx":7
     * cimport cpython
     *
     * cnp.import_array()             # <<<<<<<<<<<<<<
     *
     * cdef class SeriesIterator:
     */
      import_array();

     8:

     9: cdef class SeriesIterator:

    /* "sandbox.pyx":9
     * cnp.import_array()
     *
     * cdef class SeriesIterator:             # <<<<<<<<<<<<<<
     *
     *     def __init__(self, arr):
     */

    struct __pyx_obj_7sandbox_SeriesIterator {
      PyObject_HEAD
    };

     10:

     11:     def __init__(self, arr):

    /* "sandbox.pyx":11
     * cdef class SeriesIterator:
     *
     *     def __init__(self, arr):             # <<<<<<<<<<<<<<
     *         pass
     *
     */

    static int __pyx_pf_7sandbox_14SeriesIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pf_7sandbox_14SeriesIterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_arr = 0;
      int __pyx_r;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,0};
      __Pyx_RefNannySetupContext("__init__");
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[1] = {0};
        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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr);
          if (likely(values[0])) kw_args--;
          else goto __pyx_L5_argtuple_error;
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v_arr = values[0];
      } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
        goto __pyx_L5_argtuple_error;
      } else {
        __pyx_v_arr = PyTuple_GET_ITEM(__pyx_args, 0);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.SeriesIterator.__init__");
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;

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

     12:         pass

     13:

     14:     def next(self):

    /* "sandbox.pyx":14
     *         pass
     *
     *     def next(self):             # <<<<<<<<<<<<<<
     *         pass
     *
     */

    static PyObject *__pyx_pf_7sandbox_14SeriesIterator_1next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyObject *__pyx_pf_7sandbox_14SeriesIterator_1next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("next");

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

     15:         pass

     16:

     17: def foo(object o):

    /* "sandbox.pyx":17
     *         pass
     *
     * def foo(object o):             # <<<<<<<<<<<<<<
     *     cdef int64_t bar = o
     *     return bar
     */

    static PyObject *__pyx_pf_7sandbox_foo(PyObject *__pyx_self, PyObject *__pyx_v_o); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_foo = {__Pyx_NAMESTR("foo"), (PyCFunction)__pyx_pf_7sandbox_foo, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_foo(PyObject *__pyx_self, PyObject *__pyx_v_o) {
      __pyx_t_5numpy_int64_t __pyx_v_bar;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("foo");
      __pyx_self = __pyx_self;

      /* "sandbox.pyx":17
     *         pass
     *
     * def foo(object o):             # <<<<<<<<<<<<<<
     *     cdef int64_t bar = o
     *     return bar
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_foo, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__foo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     18:     cdef int64_t bar = o

      /* "sandbox.pyx":18
     *
     * def foo(object o):
     *     cdef int64_t bar = o             # <<<<<<<<<<<<<<
     *     return bar
     *
     */
      __pyx_t_1 = __Pyx_PyInt_from_py_npy_int64(__pyx_v_o); if (unlikely((__pyx_t_1 == (npy_int64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_bar = __pyx_t_1;

     19:     return bar

      /* "sandbox.pyx":19
     * def foo(object o):
     *     cdef int64_t bar = o
     *     return bar             # <<<<<<<<<<<<<<
     *
     * def foo2():
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyInt_to_py_npy_int64(__pyx_v_bar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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("sandbox.foo");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     20:

     21: def foo2():

    /* "sandbox.pyx":21
     *     return bar
     *
     * def foo2():             # <<<<<<<<<<<<<<
     *     print sizeof(PyObject*)
     *
     */

    static PyObject *__pyx_pf_7sandbox_1foo2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_1foo2 = {__Pyx_NAMESTR("foo2"), (PyCFunction)__pyx_pf_7sandbox_1foo2, METH_NOARGS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_1foo2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("foo2");
      __pyx_self = __pyx_self;

      /* "sandbox.pyx":21
     *     return bar
     *
     * def foo2():             # <<<<<<<<<<<<<<
     *     print sizeof(PyObject*)
     *
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_1foo2, NULL, __pyx_n_s__sandbox); 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);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__foo2, __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;

     22:     print sizeof(PyObject*)

      /* "sandbox.pyx":22
     *
     * def foo2():
     *     print sizeof(PyObject*)             # <<<<<<<<<<<<<<
     *
     * def bench_dict():
     */
      __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(PyObject *))); 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);
      if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("sandbox.foo2");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     23:

     24: def bench_dict():

    /* "sandbox.pyx":24
     *     print sizeof(PyObject*)
     *
     * def bench_dict():             # <<<<<<<<<<<<<<
     *     cdef:
     *         # Py_ssize_t i
     */

    static PyObject *__pyx_pf_7sandbox_2bench_dict(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_2bench_dict = {__Pyx_NAMESTR("bench_dict"), (PyCFunction)__pyx_pf_7sandbox_2bench_dict, METH_NOARGS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_2bench_dict(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      PyObject *__pyx_v_d = 0;
      long __pyx_v_i;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("bench_dict");
      __pyx_self = __pyx_self;

      /* "sandbox.pyx":24
     *     print sizeof(PyObject*)
     *
     * def bench_dict():             # <<<<<<<<<<<<<<
     *     cdef:
     *         # Py_ssize_t i
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_2bench_dict, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bench_dict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     25:     cdef:

     26:         # Py_ssize_t i

     27:         dict d = {}

      /* "sandbox.pyx":27
     *     cdef:
     *         # Py_ssize_t i
     *         dict d = {}             # <<<<<<<<<<<<<<
     *
     *     for i in range(1000000):
     */
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_v_d = __pyx_t_1;
      __pyx_t_1 = 0;

     28:

     29:     for i in range(1000000):

      /* "sandbox.pyx":29
     *         dict d = {}
     *
     *     for i in range(1000000):             # <<<<<<<<<<<<<<
     *         d[i] = i
     *
     */
      for (__pyx_t_2 = 0; __pyx_t_2 < 1000000; __pyx_t_2+=1) {
        __pyx_v_i = __pyx_t_2;

     30:         d[i] = i

        /* "sandbox.pyx":30
     *
     *     for i in range(1000000):
     *         d[i] = i             # <<<<<<<<<<<<<<
     *
     * from cpython cimport PyObject
     */
        __pyx_t_1 = PyInt_FromLong(__pyx_v_i); 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);
        if (__Pyx_SetItemInt(((PyObject *)__pyx_v_d), __pyx_v_i, __pyx_t_1, sizeof(long), PyInt_FromLong) < 0) {__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_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("sandbox.bench_dict");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_d);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     31:

     32: from cpython cimport PyObject

     33:

     34: cdef extern from "numpy/arrayobject.h":

     35:     bint PyArray_Check(PyObject*)

     36:

     37: cimport cython

     38:

     39: @cython.boundscheck(False)

     40: @cython.wraparound(False)

     41: def bench_typecheck1(ndarray[object] arr):

    /* "sandbox.pyx":41
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def bench_typecheck1(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     n = cnp.PyArray_SIZE(arr)
     */

    static PyObject *__pyx_pf_7sandbox_3bench_typecheck1(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_3bench_typecheck1 = {__Pyx_NAMESTR("bench_typecheck1"), (PyCFunction)__pyx_pf_7sandbox_3bench_typecheck1, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_3bench_typecheck1(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      Py_buffer __pyx_bstruct_arr;
      Py_ssize_t __pyx_bstride_0_arr = 0;
      Py_ssize_t __pyx_bshape_0_arr = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("bench_typecheck1");
      __pyx_self = __pyx_self;
      __pyx_bstruct_arr.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
      __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];

      /* "sandbox.pyx":41
     * @cython.boundscheck(False)
     * @cython.wraparound(False)
     * def bench_typecheck1(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     n = cnp.PyArray_SIZE(arr)
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_3bench_typecheck1, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bench_typecheck1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     42:     cdef Py_ssize_t i, n

     43:     n = cnp.PyArray_SIZE(arr)

      /* "sandbox.pyx":43
     * def bench_typecheck1(ndarray[object] arr):
     *     cdef Py_ssize_t i, n
     *     n = cnp.PyArray_SIZE(arr)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         cpython.PyFloat_Check(arr[i])
     */
      __pyx_t_1 = __pyx_v_arr;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_n = PyArray_SIZE(((PyArrayObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     44:     for i in range(n):

      /* "sandbox.pyx":44
     *     cdef Py_ssize_t i, n
     *     n = cnp.PyArray_SIZE(arr)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         cpython.PyFloat_Check(arr[i])
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

     45:         cpython.PyFloat_Check(arr[i])

        /* "sandbox.pyx":45
     *     n = cnp.PyArray_SIZE(arr)
     *     for i in range(n):
     *         cpython.PyFloat_Check(arr[i])             # <<<<<<<<<<<<<<
     *
     * def bench_typecheck2(ndarray[object] arr):
     */
        __pyx_t_4 = __pyx_v_i;
        __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_arr.buf, __pyx_t_4, __pyx_bstride_0_arr);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        PyFloat_Check(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }

      __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_bstruct_arr);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.bench_typecheck1");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     46:

     47: def bench_typecheck2(ndarray[object] arr):

    /* "sandbox.pyx":47
     *         cpython.PyFloat_Check(arr[i])
     *
     * def bench_typecheck2(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef PyObject** buf = <PyObject**> arr.data
     */

    static PyObject *__pyx_pf_7sandbox_4bench_typecheck2(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_4bench_typecheck2 = {__Pyx_NAMESTR("bench_typecheck2"), (PyCFunction)__pyx_pf_7sandbox_4bench_typecheck2, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_4bench_typecheck2(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject **__pyx_v_buf;
      Py_buffer __pyx_bstruct_arr;
      Py_ssize_t __pyx_bstride_0_arr = 0;
      Py_ssize_t __pyx_bshape_0_arr = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("bench_typecheck2");
      __pyx_self = __pyx_self;
      __pyx_bstruct_arr.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
      __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];

      /* "sandbox.pyx":47
     *         cpython.PyFloat_Check(arr[i])
     *
     * def bench_typecheck2(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef Py_ssize_t i, n
     *     cdef PyObject** buf = <PyObject**> arr.data
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_4bench_typecheck2, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bench_typecheck2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     48:     cdef Py_ssize_t i, n

     49:     cdef PyObject** buf = <PyObject**> arr.data

      /* "sandbox.pyx":49
     * def bench_typecheck2(ndarray[object] arr):
     *     cdef Py_ssize_t i, n
     *     cdef PyObject** buf = <PyObject**> arr.data             # <<<<<<<<<<<<<<
     *     n = cnp.PyArray_SIZE(arr)
     *     for i in range(n):
     */
      __pyx_v_buf = ((PyObject **)((PyArrayObject *)__pyx_v_arr)->data);

     50:     n = cnp.PyArray_SIZE(arr)

      /* "sandbox.pyx":50
     *     cdef Py_ssize_t i, n
     *     cdef PyObject** buf = <PyObject**> arr.data
     *     n = cnp.PyArray_SIZE(arr)             # <<<<<<<<<<<<<<
     *     for i in range(n):
     *         PyArray_Check(buf[i])
     */
      __pyx_t_1 = __pyx_v_arr;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_n = PyArray_SIZE(((PyArrayObject *)__pyx_t_1));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     51:     for i in range(n):

      /* "sandbox.pyx":51
     *     cdef PyObject** buf = <PyObject**> arr.data
     *     n = cnp.PyArray_SIZE(arr)
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         PyArray_Check(buf[i])
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

     52:         PyArray_Check(buf[i])

        /* "sandbox.pyx":52
     *     n = cnp.PyArray_SIZE(arr)
     *     for i in range(n):
     *         PyArray_Check(buf[i])             # <<<<<<<<<<<<<<
     *
     *
     */
        PyArray_Check((__pyx_v_buf[__pyx_v_i]));
      }

      __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_bstruct_arr);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.bench_typecheck2");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
      __pyx_L2:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     53:

     54:

     55: def foo(object _chunk, object _arr):

    /* "sandbox.pyx":55
     *
     *
     * def foo(object _chunk, object _arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         char* dummy_buf
     */

    static PyObject *__pyx_pf_7sandbox_5foo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_5foo = {__Pyx_NAMESTR("foo"), (PyCFunction)__pyx_pf_7sandbox_5foo, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_5foo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v__chunk = 0;
      PyObject *__pyx_v__arr = 0;
      char *__pyx_v_dummy_buf;
      PyArrayObject *__pyx_v_arr;
      PyArrayObject *__pyx_v_chunk;
      npy_intp *__pyx_v_shape;
      long __pyx_v_group_size;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_inc;
      PyObject *__pyx_r = NULL;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s___chunk,&__pyx_n_s___arr,0};
      __Pyx_RefNannySetupContext("foo");
      __pyx_self = __pyx_self;
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[2] = {0,0};
        switch (PyTuple_GET_SIZE(__pyx_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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___chunk);
          if (likely(values[0])) kw_args--;
          else goto __pyx_L5_argtuple_error;
          case  1:
          values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___arr);
          if (likely(values[1])) kw_args--;
          else {
            __Pyx_RaiseArgtupleInvalid("foo", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "foo") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v__chunk = values[0];
        __pyx_v__arr = values[1];
      } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
        goto __pyx_L5_argtuple_error;
      } else {
        __pyx_v__chunk = PyTuple_GET_ITEM(__pyx_args, 0);
        __pyx_v__arr = PyTuple_GET_ITEM(__pyx_args, 1);
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("foo", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.foo");
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_v_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
      __pyx_v_chunk = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
      __pyx_v_inc = Py_None; __Pyx_INCREF(Py_None);

      /* "sandbox.pyx":55
     *
     *
     * def foo(object _chunk, object _arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         char* dummy_buf
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_5foo, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__foo, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     56:     cdef:

     57:         char* dummy_buf

     58:         ndarray arr, result, chunk

     59:

     60:     arr = _arr

      /* "sandbox.pyx":60
     *         ndarray arr, result, chunk
     *
     *     arr = _arr             # <<<<<<<<<<<<<<
     *     chunk = _chunk
     *
     */
      if (!(likely(((__pyx_v__arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_INCREF(__pyx_v__arr);
      __Pyx_DECREF(((PyObject *)__pyx_v_arr));
      __pyx_v_arr = ((PyArrayObject *)__pyx_v__arr);

     61:     chunk = _chunk

      /* "sandbox.pyx":61
     *
     *     arr = _arr
     *     chunk = _chunk             # <<<<<<<<<<<<<<
     *
     *     dummy_buf = chunk.data
     */
      if (!(likely(((__pyx_v__chunk) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__chunk, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_INCREF(__pyx_v__chunk);
      __Pyx_DECREF(((PyObject *)__pyx_v_chunk));
      __pyx_v_chunk = ((PyArrayObject *)__pyx_v__chunk);

     62:

     63:     dummy_buf = chunk.data

      /* "sandbox.pyx":63
     *     chunk = _chunk
     *
     *     dummy_buf = chunk.data             # <<<<<<<<<<<<<<
     *     chunk.data = arr.data
     *
     */
      __pyx_v_dummy_buf = __pyx_v_chunk->data;

     64:     chunk.data = arr.data

      /* "sandbox.pyx":64
     *
     *     dummy_buf = chunk.data
     *     chunk.data = arr.data             # <<<<<<<<<<<<<<
     *
     *     shape = chunk.shape
     */
      __pyx_v_chunk->data = __pyx_v_arr->data;

     65:

     66:     shape = chunk.shape

      /* "sandbox.pyx":66
     *     chunk.data = arr.data
     *
     *     shape = chunk.shape             # <<<<<<<<<<<<<<
     *     group_size = 0
     *     n = len(arr)
     */
      __pyx_v_shape = __pyx_v_chunk->dimensions;

     67:     group_size = 0

      /* "sandbox.pyx":67
     *
     *     shape = chunk.shape
     *     group_size = 0             # <<<<<<<<<<<<<<
     *     n = len(arr)
     *
     */
      __pyx_v_group_size = 0;

     68:     n = len(arr)

      /* "sandbox.pyx":68
     *     shape = chunk.shape
     *     group_size = 0
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *
     *     inc = arr.dtype.itemsize
     */
      __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_arr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_v_n = __pyx_t_1;

     69:

     70:     inc = arr.dtype.itemsize

      /* "sandbox.pyx":70
     *     n = len(arr)
     *
     *     inc = arr.dtype.itemsize             # <<<<<<<<<<<<<<
     *
     *     # chunk.shape[0] = 100
     */
      __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_inc);
      __pyx_v_inc = __pyx_t_3;
      __pyx_t_3 = 0;

     71:

     72:     # chunk.shape[0] = 100

     73:     return chunk

      /* "sandbox.pyx":73
     *
     *     # chunk.shape[0] = 100
     *     return chunk             # <<<<<<<<<<<<<<
     *
     * from khash cimport *
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_chunk));
      __pyx_r = ((PyObject *)__pyx_v_chunk);
      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("sandbox.foo");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_DECREF((PyObject *)__pyx_v_arr);
      __Pyx_DECREF((PyObject *)__pyx_v_chunk);
      __Pyx_DECREF(__pyx_v_inc);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     74:

     75: from khash cimport *

     76:

     77: def test(ndarray arr, Py_ssize_t size_hint):

    /* "sandbox.pyx":77
     * from khash cimport *
     *
     * def test(ndarray arr, Py_ssize_t size_hint):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_pymap_t *table
     */

    static PyObject *__pyx_pf_7sandbox_6test(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_6test = {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pf_7sandbox_6test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_6test(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_arr = 0;
      Py_ssize_t __pyx_v_size_hint;
      kh_pymap_t *__pyx_v_table;
      int __pyx_v_ret;
      khiter_t __pyx_v_k;
      PyObject **__pyx_v_data;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_indexer;
      Py_buffer __pyx_bstruct_indexer;
      Py_ssize_t __pyx_bstride_0_indexer = 0;
      Py_ssize_t __pyx_bshape_0_indexer = 0;
      PyObject *__pyx_r = NULL;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__size_hint,0};
      __Pyx_RefNannySetupContext("test");
      __pyx_self = __pyx_self;
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[2] = {0,0};
        switch (PyTuple_GET_SIZE(__pyx_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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr);
          if (likely(values[0])) kw_args--;
          else goto __pyx_L5_argtuple_error;
          case  1:
          values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size_hint);
          if (likely(values[1])) kw_args--;
          else {
            __Pyx_RaiseArgtupleInvalid("test", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v_arr = ((PyArrayObject *)values[0]);
        __pyx_v_size_hint = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_size_hint == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
        goto __pyx_L5_argtuple_error;
      } else {
        __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
        __pyx_v_size_hint = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_size_hint == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("test", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.test");
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
      __pyx_bstruct_indexer.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "sandbox.pyx":77
     * from khash cimport *
     *
     * def test(ndarray arr, Py_ssize_t size_hint):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_pymap_t *table
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_6test, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     78:     cdef:

     79:         kh_pymap_t *table

     80:         int ret

     81:         khiter_t k

     82:         PyObject **data

     83:         Py_ssize_t i, n

     84:         ndarray[Py_ssize_t] indexer

     85:

     86:     table = kh_init_pymap()

      /* "sandbox.pyx":86
     *         ndarray[Py_ssize_t] indexer
     *
     *     table = kh_init_pymap()             # <<<<<<<<<<<<<<
     *     kh_resize_pymap(table, size_hint)
     *
     */
      __pyx_v_table = kh_init_pymap();

     87:     kh_resize_pymap(table, size_hint)

      /* "sandbox.pyx":87
     *
     *     table = kh_init_pymap()
     *     kh_resize_pymap(table, size_hint)             # <<<<<<<<<<<<<<
     *
     *     data = <PyObject**> arr.data
     */
      kh_resize_pymap(__pyx_v_table, __pyx_v_size_hint);

     88:

     89:     data = <PyObject**> arr.data

      /* "sandbox.pyx":89
     *     kh_resize_pymap(table, size_hint)
     *
     *     data = <PyObject**> arr.data             # <<<<<<<<<<<<<<
     *     n = len(arr)
     *
     */
      __pyx_v_data = ((PyObject **)__pyx_v_arr->data);

     90:     n = len(arr)

      /* "sandbox.pyx":90
     *
     *     data = <PyObject**> arr.data
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *
     *     indexer = np.empty(n, dtype=np.int_)
     */
      __pyx_t_1 = ((PyObject *)__pyx_v_arr);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_n = __pyx_t_2;

     91:

     92:     indexer = np.empty(n, dtype=np.int_)

      /* "sandbox.pyx":92
     *     n = len(arr)
     *
     *     indexer = np.empty(n, dtype=np.int_)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __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_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 92; __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[0]; __pyx_lineno = 92; __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[0]; __pyx_lineno = 92; __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[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_Py_ssize_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_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_Py_ssize_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_bstride_0_indexer = __pyx_bstruct_indexer.strides[0];
        __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_indexer));
      __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     93:

     94:     for i in range(n):

      /* "sandbox.pyx":94
     *     indexer = np.empty(n, dtype=np.int_)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         k = kh_put_pymap(table, data[i], &ret)
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     95:         k = kh_put_pymap(table, data[i], &ret)

        /* "sandbox.pyx":95
     *
     *     for i in range(n):
     *         k = kh_put_pymap(table, data[i], &ret)             # <<<<<<<<<<<<<<
     *
     *         # if not ret:
     */
        __pyx_v_k = kh_put_pymap(__pyx_v_table, (__pyx_v_data[__pyx_v_i]), (&__pyx_v_ret));

     96:

     97:         # if not ret:

     98:         #     kh_del_pymap(table, k)

     99:

     100:         table.vals[k] = i

        /* "sandbox.pyx":100
     *         #     kh_del_pymap(table, k)
     *
     *         table.vals[k] = i             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
        (__pyx_v_table->vals[__pyx_v_k]) = __pyx_v_i;
      }

     101:

     102:     for i in range(n):

      /* "sandbox.pyx":102
     *         table.vals[k] = i
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         k = kh_get_pymap(table, data[i])
     *         indexer[i] = table.vals[k]
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     103:         k = kh_get_pymap(table, data[i])

        /* "sandbox.pyx":103
     *
     *     for i in range(n):
     *         k = kh_get_pymap(table, data[i])             # <<<<<<<<<<<<<<
     *         indexer[i] = table.vals[k]
     *
     */
        __pyx_v_k = kh_get_pymap(__pyx_v_table, (__pyx_v_data[__pyx_v_i]));

     104:         indexer[i] = table.vals[k]

        /* "sandbox.pyx":104
     *     for i in range(n):
     *         k = kh_get_pymap(table, data[i])
     *         indexer[i] = table.vals[k]             # <<<<<<<<<<<<<<
     *
     *     kh_destroy_pymap(table)
     */
        __pyx_t_13 = __pyx_v_i;
        __pyx_t_8 = -1;
        if (__pyx_t_13 < 0) {
          __pyx_t_13 += __pyx_bshape_0_indexer;
          if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 0;
        } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_indexer)) __pyx_t_8 = 0;
        if (unlikely(__pyx_t_8 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_8);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        *__Pyx_BufPtrStrided1d(Py_ssize_t *, __pyx_bstruct_indexer.buf, __pyx_t_13, __pyx_bstride_0_indexer) = (__pyx_v_table->vals[__pyx_v_k]);
      }

     105:

     106:     kh_destroy_pymap(table)

      /* "sandbox.pyx":106
     *         indexer[i] = table.vals[k]
     *
     *     kh_destroy_pymap(table)             # <<<<<<<<<<<<<<
     *
     *     return indexer
     */
      kh_destroy_pymap(__pyx_v_table);

     107:

     108:     return indexer

      /* "sandbox.pyx":108
     *     kh_destroy_pymap(table)
     *
     *     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_1);
      __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_bstruct_indexer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.test");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
      __pyx_L2:;
      __Pyx_DECREF((PyObject *)__pyx_v_indexer);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     109:

     110:

     111: from cpython cimport PyString_AsString

     112:

     113: def test_str(ndarray arr, Py_ssize_t size_hint):

    /* "sandbox.pyx":113
     * from cpython cimport PyString_AsString
     *
     * def test_str(ndarray arr, Py_ssize_t size_hint):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_str_t *table
     */

    static PyObject *__pyx_pf_7sandbox_7test_str(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_7test_str = {__Pyx_NAMESTR("test_str"), (PyCFunction)__pyx_pf_7sandbox_7test_str, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_7test_str(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyArrayObject *__pyx_v_arr = 0;
      Py_ssize_t __pyx_v_size_hint;
      kh_str_t *__pyx_v_table;
      int __pyx_v_ret;
      khiter_t __pyx_v_k;
      PyObject **__pyx_v_data;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_indexer;
      Py_buffer __pyx_bstruct_indexer;
      Py_ssize_t __pyx_bstride_0_indexer = 0;
      Py_ssize_t __pyx_bshape_0_indexer = 0;
      PyObject *__pyx_r = NULL;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__arr,&__pyx_n_s__size_hint,0};
      __Pyx_RefNannySetupContext("test_str");
      __pyx_self = __pyx_self;
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[2] = {0,0};
        switch (PyTuple_GET_SIZE(__pyx_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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arr);
          if (likely(values[0])) kw_args--;
          else goto __pyx_L5_argtuple_error;
          case  1:
          values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size_hint);
          if (likely(values[1])) kw_args--;
          else {
            __Pyx_RaiseArgtupleInvalid("test_str", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test_str") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v_arr = ((PyArrayObject *)values[0]);
        __pyx_v_size_hint = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_size_hint == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
        goto __pyx_L5_argtuple_error;
      } else {
        __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0));
        __pyx_v_size_hint = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_size_hint == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("test_str", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.test_str");
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_v_indexer = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
      __pyx_bstruct_indexer.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "sandbox.pyx":113
     * from cpython cimport PyString_AsString
     *
     * def test_str(ndarray arr, Py_ssize_t size_hint):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_str_t *table
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_7test_str, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__test_str, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     114:     cdef:

     115:         kh_str_t *table

     116:         kh_cstr_t val

     117:         int ret

     118:         khiter_t k

     119:         PyObject **data

     120:         Py_ssize_t i, n

     121:         ndarray[Py_ssize_t] indexer

     122:

     123:     table = kh_init_str()

      /* "sandbox.pyx":123
     *         ndarray[Py_ssize_t] indexer
     *
     *     table = kh_init_str()             # <<<<<<<<<<<<<<
     *     kh_resize_str(table, size_hint)
     *
     */
      __pyx_v_table = kh_init_str();

     124:     kh_resize_str(table, size_hint)

      /* "sandbox.pyx":124
     *
     *     table = kh_init_str()
     *     kh_resize_str(table, size_hint)             # <<<<<<<<<<<<<<
     *
     *     data = <PyObject**> arr.data
     */
      kh_resize_str(__pyx_v_table, __pyx_v_size_hint);

     125:

     126:     data = <PyObject**> arr.data

      /* "sandbox.pyx":126
     *     kh_resize_str(table, size_hint)
     *
     *     data = <PyObject**> arr.data             # <<<<<<<<<<<<<<
     *     n = len(arr)
     *
     */
      __pyx_v_data = ((PyObject **)__pyx_v_arr->data);

     127:     n = len(arr)

      /* "sandbox.pyx":127
     *
     *     data = <PyObject**> arr.data
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *
     *     indexer = np.empty(n, dtype=np.int_)
     */
      __pyx_t_1 = ((PyObject *)__pyx_v_arr);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_n = __pyx_t_2;

     128:

     129:     indexer = np.empty(n, dtype=np.int_)

      /* "sandbox.pyx":129
     *     n = len(arr)
     *
     *     indexer = np.empty(n, dtype=np.int_)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __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 = 129; __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_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __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 = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 129; __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[0]; __pyx_lineno = 129; __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[0]; __pyx_lineno = 129; __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[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __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;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
        __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_indexer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_Py_ssize_t, PyBUF_FORMAT| PyBUF_STRIDES, 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_bstruct_indexer, (PyObject*)__pyx_v_indexer, &__Pyx_TypeInfo_Py_ssize_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_bstride_0_indexer = __pyx_bstruct_indexer.strides[0];
        __pyx_bshape_0_indexer = __pyx_bstruct_indexer.shape[0];
        if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_7 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_indexer));
      __pyx_v_indexer = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     130:

     131:     for i in range(n):

      /* "sandbox.pyx":131
     *     indexer = np.empty(n, dtype=np.int_)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         k = kh_put_str(table, PyString_AsString(<object> data[i]), &ret)
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_2; __pyx_t_12+=1) {
        __pyx_v_i = __pyx_t_12;

     132:         k = kh_put_str(table, PyString_AsString(<object> data[i]), &ret)

        /* "sandbox.pyx":132
     *
     *     for i in range(n):
     *         k = kh_put_str(table, PyString_AsString(<object> data[i]), &ret)             # <<<<<<<<<<<<<<
     *
     *         # if not ret:
     */
        __pyx_t_6 = ((PyObject *)(__pyx_v_data[__pyx_v_i]));
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_13 = PyString_AsString(__pyx_t_6); if (unlikely(__pyx_t_13 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_k = kh_put_str(__pyx_v_table, __pyx_t_13, (&__pyx_v_ret));

     133:

     134:         # if not ret:

     135:         #     kh_del_str(table, k)

     136:

     137:         table.vals[k] = i

        /* "sandbox.pyx":137
     *         #     kh_del_str(table, k)
     *
     *         table.vals[k] = i             # <<<<<<<<<<<<<<
     *
     *     # for i in range(n):
     */
        (__pyx_v_table->vals[__pyx_v_k]) = __pyx_v_i;
      }

     138:

     139:     # for i in range(n):

     140:     #     k = kh_get_str(table, PyString_AsString(<object> data[i]))

     141:     #     indexer[i] = table.vals[k]

     142:

     143:     kh_destroy_str(table)

      /* "sandbox.pyx":143
     *     #     indexer[i] = table.vals[k]
     *
     *     kh_destroy_str(table)             # <<<<<<<<<<<<<<
     *
     *     return indexer
     */
      kh_destroy_str(__pyx_v_table);

     144:

     145:     return indexer

      /* "sandbox.pyx":145
     *     kh_destroy_str(table)
     *
     *     return indexer             # <<<<<<<<<<<<<<
     *
     * # def test2(ndarray[object] arr):
     */
      __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_1);
      __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_bstruct_indexer);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.test_str");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indexer);
      __pyx_L2:;
      __Pyx_DECREF((PyObject *)__pyx_v_indexer);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     146:

     147: # def test2(ndarray[object] arr):

     148: #     cdef:

     149: #         dict table

     150: #         object obj

     151: #         Py_ssize_t i, loc, n

     152: #         ndarray[Py_ssize_t] indexer

     153:

     154: #     n = len(arr)

     155: #     indexer = np.empty(n, dtype=np.int_)

     156:

     157: #     table = {}

     158: #     for i in range(n):

     159: #         table[arr[i]] = i

     160:

     161: #     for i in range(n):

     162: #         indexer[i] =  table[arr[i]]

     163:

     164: #     return indexer

     165:

     166: from cpython cimport Py_INCREF

     167:

     168: def obj_unique(ndarray[object] arr):

    /* "sandbox.pyx":168
     * from cpython cimport Py_INCREF
     *
     * def obj_unique(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_pyset_t *table
     */

    static PyObject *__pyx_pf_7sandbox_8obj_unique(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_8obj_unique = {__Pyx_NAMESTR("obj_unique"), (PyCFunction)__pyx_pf_7sandbox_8obj_unique, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_8obj_unique(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      kh_pyset_t *__pyx_v_table;
      PyObject *__pyx_v_obj;
      PyObject **__pyx_v_data;
      int __pyx_v_ret;
      khiter_t __pyx_v_k;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_n;
      PyObject *__pyx_v_uniques;
      Py_buffer __pyx_bstruct_arr;
      Py_ssize_t __pyx_bstride_0_arr = 0;
      Py_ssize_t __pyx_bshape_0_arr = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("obj_unique");
      __pyx_self = __pyx_self;
      __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None);
      __pyx_v_uniques = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
      __pyx_bstruct_arr.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (PyObject*)__pyx_v_arr, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
      __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];

      /* "sandbox.pyx":168
     * from cpython cimport Py_INCREF
     *
     * def obj_unique(ndarray[object] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_pyset_t *table
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_8obj_unique, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__obj_unique, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     169:     cdef:

     170:         kh_pyset_t *table

     171:         # PyObject *obj

     172:         object obj

     173:         PyObject **data

     174:         int ret

     175:         khiter_t k

     176:         Py_ssize_t i, n

     177:         list uniques

     178:

     179:     n = len(arr)

      /* "sandbox.pyx":179
     *         list uniques
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     uniques = []
     *
     */
      __pyx_t_1 = __pyx_v_arr;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_n = __pyx_t_2;

     180:     uniques = []

      /* "sandbox.pyx":180
     *
     *     n = len(arr)
     *     uniques = []             # <<<<<<<<<<<<<<
     *
     *     table = kh_init_pyset()
     */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __Pyx_DECREF(((PyObject *)__pyx_v_uniques));
      __pyx_v_uniques = __pyx_t_1;
      __pyx_t_1 = 0;

     181:

     182:     table = kh_init_pyset()

      /* "sandbox.pyx":182
     *     uniques = []
     *
     *     table = kh_init_pyset()             # <<<<<<<<<<<<<<
     *
     *     data = <PyObject**> arr.data
     */
      __pyx_v_table = kh_init_pyset();

     183:

     184:     data = <PyObject**> arr.data

      /* "sandbox.pyx":184
     *     table = kh_init_pyset()
     *
     *     data = <PyObject**> arr.data             # <<<<<<<<<<<<<<
     *
     *     # size hint
     */
      __pyx_v_data = ((PyObject **)((PyArrayObject *)__pyx_v_arr)->data);

     185:

     186:     # size hint

     187:     kh_resize_pyset(table, n // 10)

      /* "sandbox.pyx":187
     *
     *     # size hint
     *     kh_resize_pyset(table, n // 10)             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      kh_resize_pyset(__pyx_v_table, __Pyx_div_Py_ssize_t(__pyx_v_n, 10));

     188:

     189:     for i in range(n):

      /* "sandbox.pyx":189
     *     kh_resize_pyset(table, n // 10)
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         obj = arr[i]
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
        __pyx_v_i = __pyx_t_3;

     190:         obj = arr[i]

        /* "sandbox.pyx":190
     *
     *     for i in range(n):
     *         obj = arr[i]             # <<<<<<<<<<<<<<
     *
     *         k = kh_get_pyset(table, <PyObject*> obj)
     */
        __pyx_t_4 = __pyx_v_i;
        __pyx_t_5 = -1;
        if (__pyx_t_4 < 0) {
          __pyx_t_4 += __pyx_bshape_0_arr;
          if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
        } else if (unlikely(__pyx_t_4 >= __pyx_bshape_0_arr)) __pyx_t_5 = 0;
        if (unlikely(__pyx_t_5 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_5);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_arr.buf, __pyx_t_4, __pyx_bstride_0_arr);
        __Pyx_INCREF((PyObject*)__pyx_t_1);
        __Pyx_DECREF(__pyx_v_obj);
        __pyx_v_obj = __pyx_t_1;
        __pyx_t_1 = 0;

     191:

     192:         k = kh_get_pyset(table, <PyObject*> obj)

        /* "sandbox.pyx":192
     *         obj = arr[i]
     *
     *         k = kh_get_pyset(table, <PyObject*> obj)             # <<<<<<<<<<<<<<
     *         if not kh_exist_pyset(table, k):
     *             k = kh_put_pyset(table, <PyObject*> obj, &ret)
     */
        __pyx_v_k = kh_get_pyset(__pyx_v_table, ((PyObject *)__pyx_v_obj));

     193:         if not kh_exist_pyset(table, k):

        /* "sandbox.pyx":193
     *
     *         k = kh_get_pyset(table, <PyObject*> obj)
     *         if not kh_exist_pyset(table, k):             # <<<<<<<<<<<<<<
     *             k = kh_put_pyset(table, <PyObject*> obj, &ret)
     *             # uniques.append(obj)
     */
        __pyx_t_6 = (!kh_exist_pyset(__pyx_v_table, __pyx_v_k));
        if (__pyx_t_6) {

     194:             k = kh_put_pyset(table, <PyObject*> obj, &ret)

          /* "sandbox.pyx":194
     *         k = kh_get_pyset(table, <PyObject*> obj)
     *         if not kh_exist_pyset(table, k):
     *             k = kh_put_pyset(table, <PyObject*> obj, &ret)             # <<<<<<<<<<<<<<
     *             # uniques.append(obj)
     *             # Py_INCREF(<object> obj)
     */
          __pyx_v_k = kh_put_pyset(__pyx_v_table, ((PyObject *)__pyx_v_obj), (&__pyx_v_ret));
          goto __pyx_L7;
        }
        __pyx_L7:;
      }

     195:             # uniques.append(obj)

     196:             # Py_INCREF(<object> obj)

     197:

     198:     kh_destroy_pyset(table)

      /* "sandbox.pyx":198
     *             # Py_INCREF(<object> obj)
     *
     *     kh_destroy_pyset(table)             # <<<<<<<<<<<<<<
     *
     *     return None
     */
      kh_destroy_pyset(__pyx_v_table);

     199:

     200:     return None

      /* "sandbox.pyx":200
     *     kh_destroy_pyset(table)
     *
     *     return None             # <<<<<<<<<<<<<<
     *
     * def int64_unique(ndarray[int64_t] arr):
     */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      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_bstruct_arr);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.obj_unique");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
      __pyx_L2:;
      __Pyx_DECREF(__pyx_v_obj);
      __Pyx_DECREF(__pyx_v_uniques);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     201:

     202: def int64_unique(ndarray[int64_t] arr):

    /* "sandbox.pyx":202
     *     return None
     *
     * def int64_unique(ndarray[int64_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_int64_t *table
     */

    static PyObject *__pyx_pf_7sandbox_9int64_unique(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/
    static PyMethodDef __pyx_mdef_7sandbox_9int64_unique = {__Pyx_NAMESTR("int64_unique"), (PyCFunction)__pyx_pf_7sandbox_9int64_unique, METH_O, __Pyx_DOCSTR(0)};
    static PyObject *__pyx_pf_7sandbox_9int64_unique(PyObject *__pyx_self, PyObject *__pyx_v_arr) {
      kh_int64_t *__pyx_v_table;
      __pyx_t_5numpy_int64_t __pyx_v_obj;
      int __pyx_v_ret;
      khiter_t __pyx_v_k;
      Py_ssize_t __pyx_v_i;
      Py_ssize_t __pyx_v_j;
      Py_ssize_t __pyx_v_n;
      PyArrayObject *__pyx_v_uniques;
      Py_buffer __pyx_bstruct_arr;
      Py_ssize_t __pyx_bstride_0_arr = 0;
      Py_ssize_t __pyx_bshape_0_arr = 0;
      Py_buffer __pyx_bstruct_uniques;
      Py_ssize_t __pyx_bstride_0_uniques = 0;
      Py_ssize_t __pyx_bshape_0_uniques = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("int64_unique");
      __pyx_self = __pyx_self;
      __pyx_v_uniques = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
      __pyx_bstruct_uniques.buf = NULL;
      __pyx_bstruct_arr.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_arr, (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[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_bstride_0_arr = __pyx_bstruct_arr.strides[0];
      __pyx_bshape_0_arr = __pyx_bstruct_arr.shape[0];

      /* "sandbox.pyx":202
     *     return None
     *
     * def int64_unique(ndarray[int64_t] arr):             # <<<<<<<<<<<<<<
     *     cdef:
     *         kh_int64_t *table
     */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sandbox_9int64_unique, NULL, __pyx_n_s__sandbox); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__int64_unique, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     203:     cdef:

     204:         kh_int64_t *table

     205:         # PyObject *obj

     206:         int64_t obj

     207:         PyObject **data

     208:         int ret

     209:         khiter_t k

     210:         Py_ssize_t i, j, n

     211:         ndarray[int64_t] uniques

     212:

     213:     n = len(arr)

      /* "sandbox.pyx":213
     *         ndarray[int64_t] uniques
     *
     *     n = len(arr)             # <<<<<<<<<<<<<<
     *     uniques = np.empty(n, dtype='i8')
     *
     */
      __pyx_t_1 = __pyx_v_arr;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_n = __pyx_t_2;

     214:     uniques = np.empty(n, dtype='i8')

      /* "sandbox.pyx":214
     *
     *     n = len(arr)
     *     uniques = np.empty(n, dtype='i8')             # <<<<<<<<<<<<<<
     *
     *     table = kh_init_int64()
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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 = 214; __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_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 214; __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__i8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __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_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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uniques);
        __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_uniques, (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_bstruct_uniques, (PyObject*)__pyx_v_uniques, &__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_bstride_0_uniques = __pyx_bstruct_uniques.strides[0];
        __pyx_bshape_0_uniques = __pyx_bstruct_uniques.shape[0];
        if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_v_uniques));
      __pyx_v_uniques = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     215:

     216:     table = kh_init_int64()

      /* "sandbox.pyx":216
     *     uniques = np.empty(n, dtype='i8')
     *
     *     table = kh_init_int64()             # <<<<<<<<<<<<<<
     *     kh_resize_int64(table, n)
     *
     */
      __pyx_v_table = kh_init_int64();

     217:     kh_resize_int64(table, n)

      /* "sandbox.pyx":217
     *
     *     table = kh_init_int64()
     *     kh_resize_int64(table, n)             # <<<<<<<<<<<<<<
     *
     *     j = 0
     */
      kh_resize_int64(__pyx_v_table, __pyx_v_n);

     218:

     219:     j = 0

      /* "sandbox.pyx":219
     *     kh_resize_int64(table, n)
     *
     *     j = 0             # <<<<<<<<<<<<<<
     *
     *     for i in range(n):
     */
      __pyx_v_j = 0;

     220:

     221:     for i in range(n):

      /* "sandbox.pyx":221
     *     j = 0
     *
     *     for i in range(n):             # <<<<<<<<<<<<<<
     *         obj = arr[i]
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) {
        __pyx_v_i = __pyx_t_11;

     222:         obj = arr[i]

        /* "sandbox.pyx":222
     *
     *     for i in range(n):
     *         obj = arr[i]             # <<<<<<<<<<<<<<
     *
     *         k = kh_get_int64(table, obj)
     */
        __pyx_t_12 = __pyx_v_i;
        __pyx_t_7 = -1;
        if (__pyx_t_12 < 0) {
          __pyx_t_12 += __pyx_bshape_0_arr;
          if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
        } else if (unlikely(__pyx_t_12 >= __pyx_bshape_0_arr)) __pyx_t_7 = 0;
        if (unlikely(__pyx_t_7 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_7);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_v_obj = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_arr.buf, __pyx_t_12, __pyx_bstride_0_arr));

     223:

     224:         k = kh_get_int64(table, obj)

        /* "sandbox.pyx":224
     *         obj = arr[i]
     *
     *         k = kh_get_int64(table, obj)             # <<<<<<<<<<<<<<
     *         if not kh_exist_int64(table, k):
     *             k = kh_put_int64(table, obj, &ret)
     */
        __pyx_v_k = kh_get_int64(__pyx_v_table, __pyx_v_obj);

     225:         if not kh_exist_int64(table, k):

        /* "sandbox.pyx":225
     *
     *         k = kh_get_int64(table, obj)
     *         if not kh_exist_int64(table, k):             # <<<<<<<<<<<<<<
     *             k = kh_put_int64(table, obj, &ret)
     *             uniques[j] = obj
     */
        __pyx_t_13 = (!kh_exist_int64(__pyx_v_table, __pyx_v_k));
        if (__pyx_t_13) {

     226:             k = kh_put_int64(table, obj, &ret)

          /* "sandbox.pyx":226
     *         k = kh_get_int64(table, obj)
     *         if not kh_exist_int64(table, k):
     *             k = kh_put_int64(table, obj, &ret)             # <<<<<<<<<<<<<<
     *             uniques[j] = obj
     *             j += 1
     */
          __pyx_v_k = kh_put_int64(__pyx_v_table, __pyx_v_obj, (&__pyx_v_ret));

     227:             uniques[j] = obj

          /* "sandbox.pyx":227
     *         if not kh_exist_int64(table, k):
     *             k = kh_put_int64(table, obj, &ret)
     *             uniques[j] = obj             # <<<<<<<<<<<<<<
     *             j += 1
     *             # Py_INCREF(<object> obj)
     */
          __pyx_t_14 = __pyx_v_j;
          __pyx_t_7 = -1;
          if (__pyx_t_14 < 0) {
            __pyx_t_14 += __pyx_bshape_0_uniques;
            if (unlikely(__pyx_t_14 < 0)) __pyx_t_7 = 0;
          } else if (unlikely(__pyx_t_14 >= __pyx_bshape_0_uniques)) __pyx_t_7 = 0;
          if (unlikely(__pyx_t_7 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_7);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_bstruct_uniques.buf, __pyx_t_14, __pyx_bstride_0_uniques) = __pyx_v_obj;

     228:             j += 1

          /* "sandbox.pyx":228
     *             k = kh_put_int64(table, obj, &ret)
     *             uniques[j] = obj
     *             j += 1             # <<<<<<<<<<<<<<
     *             # Py_INCREF(<object> obj)
     *
     */
          __pyx_v_j = (__pyx_v_j + 1);
          goto __pyx_L7;
        }
        __pyx_L7:;
      }

     229:             # Py_INCREF(<object> obj)

     230:

     231:     kh_destroy_int64(table)

      /* "sandbox.pyx":231
     *             # Py_INCREF(<object> obj)
     *
     *     kh_destroy_int64(table)             # <<<<<<<<<<<<<<
     *
     *     return np.sort(uniques[:j])
     */
      kh_destroy_int64(__pyx_v_table);

     232:

     233:     return np.sort(uniques[:j])

      /* "sandbox.pyx":233
     *     kh_destroy_int64(table)
     *
     *     return np.sort(uniques[:j])             # <<<<<<<<<<<<<<
     *
     * from cpython cimport PyString_Check, PyString_AsString
     */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__sort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_uniques), 0, __pyx_v_j); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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_4)); __pyx_t_4 = 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_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
        __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uniques);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.int64_unique");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_arr);
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_uniques);
      __pyx_L2:;
      __Pyx_DECREF((PyObject *)__pyx_v_uniques);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     234:

     235: from cpython cimport PyString_Check, PyString_AsString

     236:

     237: cdef class StringHashTable:

    /* "sandbox.pyx":237
     * from cpython cimport PyString_Check, PyString_AsString
     *
     * cdef class StringHashTable:             # <<<<<<<<<<<<<<
     *
     *     cdef:
     */

    struct __pyx_obj_7sandbox_StringHashTable {
      PyObject_HEAD
      struct __pyx_vtabstruct_7sandbox_StringHashTable *__pyx_vtab;
      kh_str_t *table;
    };

    /* "sandbox.pyx":237
     * from cpython cimport PyString_Check, PyString_AsString
     *
     * cdef class StringHashTable:             # <<<<<<<<<<<<<<
     *
     *     cdef:
     */

    struct __pyx_vtabstruct_7sandbox_StringHashTable {
      int (*check_type)(struct __pyx_obj_7sandbox_StringHashTable *, PyObject *);
      PyObject *(*get_item)(struct __pyx_obj_7sandbox_StringHashTable *, PyObject *, int __pyx_skip_dispatch);
      PyObject *(*set_item)(struct __pyx_obj_7sandbox_StringHashTable *, PyObject *, Py_ssize_t, int __pyx_skip_dispatch);
    };

     238:

     239:     cdef:

     240:         kh_str_t *table

     241:

     242:     def __init__(self, size_hint=None):

    /* "sandbox.pyx":242
     *         kh_str_t *table
     *
     *     def __init__(self, size_hint=None):             # <<<<<<<<<<<<<<
     *         if size_hint is not None:
     *             kh_resize_str(self.table, size_hint)
     */

    static int __pyx_pf_7sandbox_15StringHashTable___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pf_7sandbox_15StringHashTable___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_size_hint = 0;
      int __pyx_r;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size_hint,0};
      __Pyx_RefNannySetupContext("__init__");
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[1] = {0};
        values[0] = ((PyObject *)Py_None);
        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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          if (kw_args > 0) {
            PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size_hint);
            if (value) { values[0] = value; kw_args--; }
          }
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v_size_hint = values[0];
      } else {
        __pyx_v_size_hint = ((PyObject *)Py_None);
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  1: __pyx_v_size_hint = PyTuple_GET_ITEM(__pyx_args, 0);
          case  0: break;
          default: goto __pyx_L5_argtuple_error;
        }
      }
      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[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.StringHashTable.__init__");
      __Pyx_RefNannyFinishContext();
      return -1;
      __pyx_L4_argument_unpacking_done:;

     243:         if size_hint is not None:

      /* "sandbox.pyx":243
     *
     *     def __init__(self, size_hint=None):
     *         if size_hint is not None:             # <<<<<<<<<<<<<<
     *             kh_resize_str(self.table, size_hint)
     *
     */
      __pyx_t_1 = (__pyx_v_size_hint != Py_None);
      if (__pyx_t_1) {

     244:             kh_resize_str(self.table, size_hint)

        /* "sandbox.pyx":244
     *     def __init__(self, size_hint=None):
     *         if size_hint is not None:
     *             kh_resize_str(self.table, size_hint)             # <<<<<<<<<<<<<<
     *
     *     def __cinit__(self):
     */
        __pyx_t_2 = ((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table;
        __pyx_t_3 = __Pyx_PyInt_from_py_npy_uint32(__pyx_v_size_hint); if (unlikely((__pyx_t_3 == (khint_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        kh_resize_str(__pyx_t_2, __pyx_t_3);
        goto __pyx_L6;
      }
      __pyx_L6:;

      __pyx_r = 0;
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_AddTraceback("sandbox.StringHashTable.__init__");
      __pyx_r = -1;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     245:

     246:     def __cinit__(self):

    /* "sandbox.pyx":246
     *             kh_resize_str(self.table, size_hint)
     *
     *     def __cinit__(self):             # <<<<<<<<<<<<<<
     *         self.table = kh_init_str()
     *
     */

    static int __pyx_pf_7sandbox_15StringHashTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static int __pyx_pf_7sandbox_15StringHashTable_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_r;
      __Pyx_RefNannySetupContext("__cinit__");
      if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
      if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;

     247:         self.table = kh_init_str()

      /* "sandbox.pyx":247
     *
     *     def __cinit__(self):
     *         self.table = kh_init_str()             # <<<<<<<<<<<<<<
     *
     *     def __dealloc__(self):
     */
      ((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table = kh_init_str();

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

     248:

     249:     def __dealloc__(self):

    /* "sandbox.pyx":249
     *         self.table = kh_init_str()
     *
     *     def __dealloc__(self):             # <<<<<<<<<<<<<<
     *         kh_destroy_str(self.table)
     *
     */

    static void __pyx_pf_7sandbox_15StringHashTable_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
    static void __pyx_pf_7sandbox_15StringHashTable_2__dealloc__(PyObject *__pyx_v_self) {
      __Pyx_RefNannySetupContext("__dealloc__");

     250:         kh_destroy_str(self.table)

      /* "sandbox.pyx":250
     *
     *     def __dealloc__(self):
     *         kh_destroy_str(self.table)             # <<<<<<<<<<<<<<
     *
     *     cdef inline int check_type(self, object val):
     */
      kh_destroy_str(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table);

      __Pyx_RefNannyFinishContext();
    }

     251:

     252:     cdef inline int check_type(self, object val):

    /* "sandbox.pyx":252
     *         kh_destroy_str(self.table)
     *
     *     cdef inline int check_type(self, object val):             # <<<<<<<<<<<<<<
     *         return PyString_Check(val)
     *
     */

    static CYTHON_INLINE int __pyx_f_7sandbox_15StringHashTable_check_type(struct __pyx_obj_7sandbox_StringHashTable *__pyx_v_self, PyObject *__pyx_v_val) {
      int __pyx_r;
      __Pyx_RefNannySetupContext("check_type");

     253:         return PyString_Check(val)

      /* "sandbox.pyx":253
     *
     *     cdef inline int check_type(self, object val):
     *         return PyString_Check(val)             # <<<<<<<<<<<<<<
     *
     *     cpdef get_item(self, object val):
     */
      __pyx_t_1 = __pyx_v_val;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_r = PyString_Check(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

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

     254:

     255:     cpdef get_item(self, object val):

    /* "sandbox.pyx":255
     *         return PyString_Check(val)
     *
     *     cpdef get_item(self, object val):             # <<<<<<<<<<<<<<
     *         cdef khiter_t k
     *
     */

    static PyObject *__pyx_pf_7sandbox_15StringHashTable_3get_item(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
    static  PyObject *__pyx_f_7sandbox_15StringHashTable_get_item(struct __pyx_obj_7sandbox_StringHashTable *__pyx_v_self, PyObject *__pyx_v_val, int __pyx_skip_dispatch) {
      khiter_t __pyx_v_k;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("get_item");
      /* 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_item); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sandbox_15StringHashTable_3get_item)) {
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__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_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          goto __pyx_L0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }

    /* "sandbox.pyx":255
     *         return PyString_Check(val)
     *
     *     cpdef get_item(self, object val):             # <<<<<<<<<<<<<<
     *         cdef khiter_t k
     *
     */

    static PyObject *__pyx_pf_7sandbox_15StringHashTable_3get_item(PyObject *__pyx_v_self, PyObject *__pyx_v_val); /*proto*/
    static PyObject *__pyx_pf_7sandbox_15StringHashTable_3get_item(PyObject *__pyx_v_self, PyObject *__pyx_v_val) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("get_item");
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_v_val;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = ((struct __pyx_vtabstruct_7sandbox_StringHashTable *)((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->__pyx_vtab)->get_item(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self), __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __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_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("sandbox.StringHashTable.get_item");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     256:         cdef khiter_t k

     257:

     258:         k = kh_get_str(self.table, PyString_AsString(val))

      /* "sandbox.pyx":258
     *         cdef khiter_t k
     *
     *         k = kh_get_str(self.table, PyString_AsString(val))             # <<<<<<<<<<<<<<
     *         if kh_exist_str(self.table, k):
     *             return self.table.vals[k]
     */
      __pyx_t_4 = __pyx_v_self->table;
      __pyx_t_1 = __pyx_v_val;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = PyString_AsString(__pyx_t_1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_k = kh_get_str(__pyx_t_4, __pyx_t_5);

     259:         if kh_exist_str(self.table, k):

      /* "sandbox.pyx":259
     *
     *         k = kh_get_str(self.table, PyString_AsString(val))
     *         if kh_exist_str(self.table, k):             # <<<<<<<<<<<<<<
     *             return self.table.vals[k]
     *         else:
     */
      __pyx_t_6 = kh_exist_str(__pyx_v_self->table, __pyx_v_k);
      if (__pyx_t_6) {

     260:             return self.table.vals[k]

        /* "sandbox.pyx":260
     *         k = kh_get_str(self.table, PyString_AsString(val))
     *         if kh_exist_str(self.table, k):
     *             return self.table.vals[k]             # <<<<<<<<<<<<<<
     *         else:
     *             raise KeyError(val)
     */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_self->table->vals[__pyx_v_k])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __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_L3;
      }
      /*else*/ {

     261:         else:

     262:             raise KeyError(val)

        /* "sandbox.pyx":262
     *             return self.table.vals[k]
     *         else:
     *             raise KeyError(val)             # <<<<<<<<<<<<<<
     *
     *     cpdef set_item(self, object key, Py_ssize_t val):
     */
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_val);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_val);
        __Pyx_GIVEREF(__pyx_v_val);
        __pyx_t_3 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __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);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("sandbox.StringHashTable.get_item");
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     263:

     264:     cpdef set_item(self, object key, Py_ssize_t val):

    /* "sandbox.pyx":264
     *             raise KeyError(val)
     *
     *     cpdef set_item(self, object key, Py_ssize_t val):             # <<<<<<<<<<<<<<
     *         cdef:
     *             khiter_t k
     */

    static PyObject *__pyx_pf_7sandbox_15StringHashTable_4set_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static  PyObject *__pyx_f_7sandbox_15StringHashTable_set_item(struct __pyx_obj_7sandbox_StringHashTable *__pyx_v_self, PyObject *__pyx_v_key, Py_ssize_t __pyx_v_val, int __pyx_skip_dispatch) {
      khiter_t __pyx_v_k;
      int __pyx_v_ret;
      char *__pyx_v_buf;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("set_item");
      /* 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__set_item); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sandbox_15StringHashTable_4set_item)) {
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_3));
          __Pyx_INCREF(__pyx_v_key);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
          __Pyx_GIVEREF(__pyx_v_key);
          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[0]; __pyx_lineno = 264; __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;
      }

    /* "sandbox.pyx":264
     *             raise KeyError(val)
     *
     *     cpdef set_item(self, object key, Py_ssize_t val):             # <<<<<<<<<<<<<<
     *         cdef:
     *             khiter_t k
     */

    static PyObject *__pyx_pf_7sandbox_15StringHashTable_4set_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_pf_7sandbox_15StringHashTable_4set_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_key = 0;
      Py_ssize_t __pyx_v_val;
      PyObject *__pyx_r = NULL;
      static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__key,&__pyx_n_s__val,0};
      __Pyx_RefNannySetupContext("set_item");
      if (unlikely(__pyx_kwds)) {
        Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
        PyObject* values[2] = {0,0};
        switch (PyTuple_GET_SIZE(__pyx_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;
        }
        switch (PyTuple_GET_SIZE(__pyx_args)) {
          case  0:
          values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__key);
          if (likely(values[0])) kw_args--;
          else goto __pyx_L5_argtuple_error;
          case  1:
          values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val);
          if (likely(values[1])) kw_args--;
          else {
            __Pyx_RaiseArgtupleInvalid("set_item", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
          }
        }
        if (unlikely(kw_args > 0)) {
          if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_item") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        __pyx_v_key = values[0];
        __pyx_v_val = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_val == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
        goto __pyx_L5_argtuple_error;
      } else {
        __pyx_v_key = PyTuple_GET_ITEM(__pyx_args, 0);
        __pyx_v_val = __Pyx_PyIndex_AsSsize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_val == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("set_item", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __pyx_L3_error:;
      __Pyx_AddTraceback("sandbox.StringHashTable.set_item");
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_v_key;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = ((struct __pyx_vtabstruct_7sandbox_StringHashTable *)((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->__pyx_vtab)->set_item(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self), __pyx_t_1, __pyx_v_val, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __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_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("sandbox.StringHashTable.set_item");
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     265:         cdef:

     266:             khiter_t k

     267:             int ret

     268:             char* buf

     269:

     270:         buf = PyString_AsString(key)

      /* "sandbox.pyx":270
     *             char* buf
     *
     *         buf = PyString_AsString(key)             # <<<<<<<<<<<<<<
     *
     *         k = kh_put_str(self.table, buf, &ret)
     */
      __pyx_t_1 = __pyx_v_key;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = PyString_AsString(__pyx_t_1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_buf = __pyx_t_4;

     271:

     272:         k = kh_put_str(self.table, buf, &ret)

      /* "sandbox.pyx":272
     *         buf = PyString_AsString(key)
     *
     *         k = kh_put_str(self.table, buf, &ret)             # <<<<<<<<<<<<<<
     *         self.table.keys[k] = key
     *         if kh_exist_str(self.table, k):
     */
      __pyx_v_k = kh_put_str(__pyx_v_self->table, __pyx_v_buf, (&__pyx_v_ret));

     273:         self.table.keys[k] = key

      /* "sandbox.pyx":273
     *
     *         k = kh_put_str(self.table, buf, &ret)
     *         self.table.keys[k] = key             # <<<<<<<<<<<<<<
     *         if kh_exist_str(self.table, k):
     *             self.table.vals[k] = val
     */
      __pyx_t_5 = PyBytes_AsString(__pyx_v_key); if (unlikely((__pyx_t_5 == (kh_cstr_t)NULL) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      (__pyx_v_self->table->keys[__pyx_v_k]) = __pyx_t_5;

     274:         if kh_exist_str(self.table, k):

      /* "sandbox.pyx":274
     *         k = kh_put_str(self.table, buf, &ret)
     *         self.table.keys[k] = key
     *         if kh_exist_str(self.table, k):             # <<<<<<<<<<<<<<
     *             self.table.vals[k] = val
     *         else:
     */
      __pyx_t_6 = kh_exist_str(__pyx_v_self->table, __pyx_v_k);
      if (__pyx_t_6) {

     275:             self.table.vals[k] = val

        /* "sandbox.pyx":275
     *         self.table.keys[k] = key
     *         if kh_exist_str(self.table, k):
     *             self.table.vals[k] = val             # <<<<<<<<<<<<<<
     *         else:
     *             raise KeyError(key)
     */
        (__pyx_v_self->table->vals[__pyx_v_k]) = __pyx_v_val;
        goto __pyx_L3;
      }
      /*else*/ {

     276:         else:

     277:             raise KeyError(key)

        /* "sandbox.pyx":277
     *             self.table.vals[k] = val
     *         else:
     *             raise KeyError(key)             # <<<<<<<<<<<<<<
     *
     *     def labelize(self, ndarray[object] values):
     */
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_1));
        __Pyx_INCREF(__pyx_v_key);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_key);
        __Pyx_GIVEREF(__pyx_v_key);
        __pyx_t_2 = PyObject_Call(__pyx_builtin_KeyError, ((PyObject *)__pyx_t_1), 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(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_2, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("sandbox.StringHashTable.set_item");
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     278:

     279:     def labelize(self, ndarray[object] values):

    /* "sandbox.pyx":279
     *             raise KeyError(key)
     *
     *     def labelize(self, ndarray[object] values):             # <<<<<<<<<<<<<<
     *         cdef:
     *             Py_ssize_t i, n = len(values)
     */

    static PyObject *__pyx_pf_7sandbox_15StringHashTable_5labelize(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
    static PyObject *__pyx_pf_7sandbox_15StringHashTable_5labelize(PyObject *__pyx_v_self, PyObject *__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_reverse = 0;
      Py_ssize_t __pyx_v_idx;
      Py_ssize_t __pyx_v_count;
      int __pyx_v_ret;
      PyObject *__pyx_v_val;
      char *__pyx_v_buf;
      khiter_t __pyx_v_k;
      Py_buffer __pyx_bstruct_labels;
      Py_ssize_t __pyx_bstride_0_labels = 0;
      Py_ssize_t __pyx_bshape_0_labels = 0;
      Py_buffer __pyx_bstruct_values;
      Py_ssize_t __pyx_bstride_0_values = 0;
      Py_ssize_t __pyx_bshape_0_values = 0;
      Py_buffer __pyx_bstruct_counts;
      Py_ssize_t __pyx_bstride_0_counts = 0;
      Py_ssize_t __pyx_bshape_0_counts = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannySetupContext("labelize");
      __pyx_v_val = Py_None; __Pyx_INCREF(Py_None);
      __pyx_bstruct_labels.buf = NULL;
      __pyx_bstruct_counts.buf = NULL;
      __pyx_bstruct_values.buf = NULL;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_bstride_0_values = __pyx_bstruct_values.strides[0];
      __pyx_bshape_0_values = __pyx_bstruct_values.shape[0];

     280:         cdef:

     281:             Py_ssize_t i, n = len(values)

      /* "sandbox.pyx":281
     *     def labelize(self, ndarray[object] values):
     *         cdef:
     *             Py_ssize_t i, n = len(values)             # <<<<<<<<<<<<<<
     *             ndarray[int32_t] labels = np.empty(n, dtype=np.int32)
     *             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)
     */
      __pyx_t_1 = __pyx_v_values;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_n = __pyx_t_2;

     282:             ndarray[int32_t] labels = np.empty(n, dtype=np.int32)

      /* "sandbox.pyx":282
     *         cdef:
     *             Py_ssize_t i, n = len(values)
     *             ndarray[int32_t] labels = np.empty(n, dtype=np.int32)             # <<<<<<<<<<<<<<
     *             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)
     *             dict reverse = {}
     */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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 = 282; __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_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 282; __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[0]; __pyx_lineno = 282; __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[0]; __pyx_lineno = 282; __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[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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_bstruct_labels, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_labels = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_labels.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_bstride_0_labels = __pyx_bstruct_labels.strides[0];
          __pyx_bshape_0_labels = __pyx_bstruct_labels.shape[0];
        }
      }
      __pyx_t_7 = 0;
      __pyx_v_labels = ((PyArrayObject *)__pyx_t_6);
      __pyx_t_6 = 0;

     283:             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)

      /* "sandbox.pyx":283
     *             Py_ssize_t i, n = len(values)
     *             ndarray[int32_t] labels = np.empty(n, dtype=np.int32)
     *             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)             # <<<<<<<<<<<<<<
     *             dict reverse = {}
     *             Py_ssize_t idx, count = 0
     */
      __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __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 = 283; __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 = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 283; __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 = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __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 = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __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_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 = 283; __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_bstruct_counts, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          __pyx_v_counts = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_counts.buf = NULL;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        } else {__pyx_bstride_0_counts = __pyx_bstruct_counts.strides[0];
          __pyx_bshape_0_counts = __pyx_bstruct_counts.shape[0];
        }
      }
      __pyx_t_8 = 0;
      __pyx_v_counts = ((PyArrayObject *)__pyx_t_5);
      __pyx_t_5 = 0;

     284:             dict reverse = {}

      /* "sandbox.pyx":284
     *             ndarray[int32_t] labels = np.empty(n, dtype=np.int32)
     *             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)
     *             dict reverse = {}             # <<<<<<<<<<<<<<
     *             Py_ssize_t idx, count = 0
     *             int ret
     */
      __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __pyx_v_reverse = __pyx_t_5;
      __pyx_t_5 = 0;

     285:             Py_ssize_t idx, count = 0

      /* "sandbox.pyx":285
     *             ndarray[int32_t] counts = np.empty(n, dtype=np.int32)
     *             dict reverse = {}
     *             Py_ssize_t idx, count = 0             # <<<<<<<<<<<<<<
     *             int ret
     *             object val
     */
      __pyx_v_count = 0;

     286:             int ret

     287:             object val

     288:             char *buf

     289:             khiter_t k

     290:

     291:         for i in range(n):

      /* "sandbox.pyx":291
     *             khiter_t k
     *
     *         for i in range(n):             # <<<<<<<<<<<<<<
     *             val = values[i]
     *
     */
      __pyx_t_2 = __pyx_v_n;
      for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_2; __pyx_t_9+=1) {
        __pyx_v_i = __pyx_t_9;

     292:             val = values[i]

        /* "sandbox.pyx":292
     *
     *         for i in range(n):
     *             val = values[i]             # <<<<<<<<<<<<<<
     *
     *             # is NaN
     */
        __pyx_t_10 = __pyx_v_i;
        __pyx_t_11 = -1;
        if (__pyx_t_10 < 0) {
          __pyx_t_10 += __pyx_bshape_0_values;
          if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
        } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_values)) __pyx_t_11 = 0;
        if (unlikely(__pyx_t_11 != -1)) {
          __Pyx_RaiseBufferIndexError(__pyx_t_11);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = *__Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_values.buf, __pyx_t_10, __pyx_bstride_0_values);
        __Pyx_INCREF((PyObject*)__pyx_t_5);
        __Pyx_DECREF(__pyx_v_val);
        __pyx_v_val = __pyx_t_5;
        __pyx_t_5 = 0;

     293:

     294:             # is NaN

     295:             if val != val:

        /* "sandbox.pyx":295
     *
     *             # is NaN
     *             if val != val:             # <<<<<<<<<<<<<<
     *                 labels[i] = -1
     *                 continue
     */
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_val, __pyx_v_val, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_12) {

     296:                 labels[i] = -1

          /* "sandbox.pyx":296
     *             # is NaN
     *             if val != val:
     *                 labels[i] = -1             # <<<<<<<<<<<<<<
     *                 continue
     *
     */
          __pyx_t_13 = __pyx_v_i;
          __pyx_t_11 = -1;
          if (__pyx_t_13 < 0) {
            __pyx_t_13 += __pyx_bshape_0_labels;
            if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_labels)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_labels.buf, __pyx_t_13, __pyx_bstride_0_labels) = -1;

     297:                 continue

          /* "sandbox.pyx":297
     *             if val != val:
     *                 labels[i] = -1
     *                 continue             # <<<<<<<<<<<<<<
     *
     *             # should do this in one shot?
     */
          goto __pyx_L5_continue;
          goto __pyx_L7;
        }
        __pyx_L7:;

     298:

     299:             # should do this in one shot?

     300:             # if not self.check_type(val):

     301:             #     raise TypeError('foo')

     302:

     303:             buf = PyString_AsString(val)

        /* "sandbox.pyx":303
     *             #     raise TypeError('foo')
     *
     *             buf = PyString_AsString(val)             # <<<<<<<<<<<<<<
     *
     *             k = kh_get_str(self.table, buf)
     */
        __pyx_t_14 = PyString_AsString(__pyx_v_val); if (unlikely(__pyx_t_14 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_v_buf = __pyx_t_14;

     304:

     305:             k = kh_get_str(self.table, buf)

        /* "sandbox.pyx":305
     *             buf = PyString_AsString(val)
     *
     *             k = kh_get_str(self.table, buf)             # <<<<<<<<<<<<<<
     *             if k != self.table.n_buckets:
     *                 idx = self.table.vals[k]
     */
        __pyx_v_k = kh_get_str(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table, __pyx_v_buf);

     306:             if k != self.table.n_buckets:

        /* "sandbox.pyx":306
     *
     *             k = kh_get_str(self.table, buf)
     *             if k != self.table.n_buckets:             # <<<<<<<<<<<<<<
     *                 idx = self.table.vals[k]
     *                 labels[i] = idx
     */
        __pyx_t_12 = (__pyx_v_k != ((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table->n_buckets);
        if (__pyx_t_12) {

     307:                 idx = self.table.vals[k]

          /* "sandbox.pyx":307
     *             k = kh_get_str(self.table, buf)
     *             if k != self.table.n_buckets:
     *                 idx = self.table.vals[k]             # <<<<<<<<<<<<<<
     *                 labels[i] = idx
     *                 # print idx
     */
          __pyx_v_idx = (((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table->vals[__pyx_v_k]);

     308:                 labels[i] = idx

          /* "sandbox.pyx":308
     *             if k != self.table.n_buckets:
     *                 idx = self.table.vals[k]
     *                 labels[i] = idx             # <<<<<<<<<<<<<<
     *                 # print idx
     *                 counts[idx] = counts[idx] + 1
     */
          __pyx_t_15 = __pyx_v_i;
          __pyx_t_11 = -1;
          if (__pyx_t_15 < 0) {
            __pyx_t_15 += __pyx_bshape_0_labels;
            if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_15 >= __pyx_bshape_0_labels)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_labels.buf, __pyx_t_15, __pyx_bstride_0_labels) = __pyx_v_idx;

     309:                 # print idx

     310:                 counts[idx] = counts[idx] + 1

          /* "sandbox.pyx":310
     *                 labels[i] = idx
     *                 # print idx
     *                 counts[idx] = counts[idx] + 1             # <<<<<<<<<<<<<<
     *             else:
     *                 k = kh_put_str(self.table, buf, &ret)
     */
          __pyx_t_16 = __pyx_v_idx;
          __pyx_t_11 = -1;
          if (__pyx_t_16 < 0) {
            __pyx_t_16 += __pyx_bshape_0_counts;
            if (unlikely(__pyx_t_16 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_counts)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_17 = __pyx_v_idx;
          __pyx_t_11 = -1;
          if (__pyx_t_17 < 0) {
            __pyx_t_17 += __pyx_bshape_0_counts;
            if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_counts)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_counts.buf, __pyx_t_17, __pyx_bstride_0_counts) = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_counts.buf, __pyx_t_16, __pyx_bstride_0_counts)) + 1);
          goto __pyx_L8;
        }
        /*else*/ {

     311:             else:

     312:                 k = kh_put_str(self.table, buf, &ret)

          /* "sandbox.pyx":312
     *                 counts[idx] = counts[idx] + 1
     *             else:
     *                 k = kh_put_str(self.table, buf, &ret)             # <<<<<<<<<<<<<<
     *                 # print 'putting %s, %s' % (val, count)
     *                 if not ret:
     */
          __pyx_v_k = kh_put_str(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table, __pyx_v_buf, (&__pyx_v_ret));

     313:                 # print 'putting %s, %s' % (val, count)

     314:                 if not ret:

          /* "sandbox.pyx":314
     *                 k = kh_put_str(self.table, buf, &ret)
     *                 # print 'putting %s, %s' % (val, count)
     *                 if not ret:             # <<<<<<<<<<<<<<
     *                     kh_del_str(self.table, k)
     *
     */
          __pyx_t_12 = (!__pyx_v_ret);
          if (__pyx_t_12) {

     315:                     kh_del_str(self.table, k)

            /* "sandbox.pyx":315
     *                 # print 'putting %s, %s' % (val, count)
     *                 if not ret:
     *                     kh_del_str(self.table, k)             # <<<<<<<<<<<<<<
     *
     *                 self.table.vals[k] = count
     */
            kh_del_str(((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table, __pyx_v_k);
            goto __pyx_L9;
          }
          __pyx_L9:;

     316:

     317:                 self.table.vals[k] = count

          /* "sandbox.pyx":317
     *                     kh_del_str(self.table, k)
     *
     *                 self.table.vals[k] = count             # <<<<<<<<<<<<<<
     *                 reverse[count] = val
     *                 labels[i] = count
     */
          (((struct __pyx_obj_7sandbox_StringHashTable *)__pyx_v_self)->table->vals[__pyx_v_k]) = __pyx_v_count;

     318:                 reverse[count] = val

          /* "sandbox.pyx":318
     *
     *                 self.table.vals[k] = count
     *                 reverse[count] = val             # <<<<<<<<<<<<<<
     *                 labels[i] = count
     *                 counts[count] = 1
     */
          if (__Pyx_SetItemInt(((PyObject *)__pyx_v_reverse), __pyx_v_count, __pyx_v_val, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

     319:                 labels[i] = count

          /* "sandbox.pyx":319
     *                 self.table.vals[k] = count
     *                 reverse[count] = val
     *                 labels[i] = count             # <<<<<<<<<<<<<<
     *                 counts[count] = 1
     *                 count += 1
     */
          __pyx_t_18 = __pyx_v_i;
          __pyx_t_11 = -1;
          if (__pyx_t_18 < 0) {
            __pyx_t_18 += __pyx_bshape_0_labels;
            if (unlikely(__pyx_t_18 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_labels)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_labels.buf, __pyx_t_18, __pyx_bstride_0_labels) = __pyx_v_count;

     320:                 counts[count] = 1

          /* "sandbox.pyx":320
     *                 reverse[count] = val
     *                 labels[i] = count
     *                 counts[count] = 1             # <<<<<<<<<<<<<<
     *                 count += 1
     *
     */
          __pyx_t_19 = __pyx_v_count;
          __pyx_t_11 = -1;
          if (__pyx_t_19 < 0) {
            __pyx_t_19 += __pyx_bshape_0_counts;
            if (unlikely(__pyx_t_19 < 0)) __pyx_t_11 = 0;
          } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_counts)) __pyx_t_11 = 0;
          if (unlikely(__pyx_t_11 != -1)) {
            __Pyx_RaiseBufferIndexError(__pyx_t_11);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_bstruct_counts.buf, __pyx_t_19, __pyx_bstride_0_counts) = 1;

     321:                 count += 1

          /* "sandbox.pyx":321
     *                 labels[i] = count
     *                 counts[count] = 1
     *                 count += 1             # <<<<<<<<<<<<<<
     *
     *         return reverse, labels, counts[:count].copy()
     */
          __pyx_v_count = (__pyx_v_count + 1);
        }
        __pyx_L8:;
        __pyx_L5_continue:;
      }

     322:

     323:         return reverse, labels, counts[:count].copy()

      /* "sandbox.pyx":323
     *                 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 = 323; __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 = 323; __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 = 323; __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 = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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_1);
      __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_bstruct_labels);
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
        __Pyx_SafeReleaseBuffer(&__pyx_bstruct_counts);
      __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
      __Pyx_AddTraceback("sandbox.StringHashTable.labelize");
      __pyx_r = NULL;
      goto __pyx_L2;
      __pyx_L0:;
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_labels);
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_values);
      __Pyx_SafeReleaseBuffer(&__pyx_bstruct_counts);
      __pyx_L2:;
      __Pyx_XDECREF((PyObject *)__pyx_v_labels);
      __Pyx_XDECREF((PyObject *)__pyx_v_counts);
      __Pyx_XDECREF(__pyx_v_reverse);
      __Pyx_DECREF(__pyx_v_val);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }