/* Generated by Cython 0.23.3 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_23_3"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
#define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
    unaryfunc am_await;
    unaryfunc am_aiter;
    unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)

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

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


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

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

#define __PYX_HAVE__bzrlib___chk_map_pyx
#define __PYX_HAVE_API__bzrlib___chk_map_pyx
#include "python-compat.h"
#include "_static_tuple_c.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

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


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

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "bzrlib/_chk_map_pyx.pyx",
  "bzrlib/_static_tuple_c.pxd",
};

/*--- Type declarations ---*/

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

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

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

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

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

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

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

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

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

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

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

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

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

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static int __Pyx_check_binary_version(void);

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

static PyObject *__Pyx_ImportModule(const char *name);

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

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'bzrlib._static_tuple_c' */

/* Module declarations from 'bzrlib._static_tuple_c' */
static PyTypeObject *__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = 0;

/* Module declarations from 'bzrlib._chk_map_pyx' */
static PyObject *__pyx_v_6bzrlib_12_chk_map_pyx_crc32 = 0;
static PyObject *__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode = 0;
static PyObject *__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode = 0;
static PyObject *__pyx_v_6bzrlib_12_chk_map_pyx__unknown = 0;
static void *__pyx_f_6bzrlib_12_chk_map_pyx__my_memrchr(void *, int, size_t); /*proto*/
static PyObject *__pyx_f_6bzrlib_12_chk_map_pyx_safe_interned_string_from_size(char *, Py_ssize_t); /*proto*/
static int __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line(char **, char *, char *); /*proto*/
static PyObject *__pyx_f_6bzrlib_12_chk_map_pyx__import_globals(void); /*proto*/
#define __Pyx_MODULE_NAME "bzrlib._chk_map_pyx"
int __pyx_module_is_main_bzrlib___chk_map_pyx = 0;

/* Implementation of 'bzrlib._chk_map_pyx' */
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_TypeError;
static char __pyx_k_i[] = "i";
static char __pyx_k_j[] = "j";
static char __pyx_k_08X[] = "%08X";
static char __pyx_k_cur[] = "cur";
static char __pyx_k_end[] = "end";
static char __pyx_k_key[] = "key";
static char __pyx_k_len[] = "_len";
static char __pyx_k_out[] = "out";
static char __pyx_k_pos[] = "pos";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_next[] = "next";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_zlib[] = "zlib";
static char __pyx_k_bytes[] = "bytes";
static char __pyx_k_c_out[] = "c_out";
static char __pyx_k_crc32[] = "crc32";
static char __pyx_k_entry[] = "entry";
static char __pyx_k_items[] = "_items";
static char __pyx_k_key_2[] = "_key";
static char __pyx_k_value[] = "value";
static char __pyx_k_width[] = "width";
static char __pyx_k_bzrlib[] = "bzrlib";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_intern[] = "intern";
static char __pyx_k_length[] = "length";
static char __pyx_k_prefix[] = "prefix";
static char __pyx_k_result[] = "result";
static char __pyx_k_c_bytes[] = "c_bytes";
static char __pyx_k_c_entry[] = "c_entry";
static char __pyx_k_chk_map[] = "chk_map";
static char __pyx_k_chkleaf[] = "chkleaf:\n";
static char __pyx_k_chknode[] = "chknode:\n";
static char __pyx_k_crc_val[] = "crc_val";
static char __pyx_k_cur_end[] = "cur_end";
static char __pyx_k_file_id[] = "file_id";
static char __pyx_k_items_2[] = "items";
static char __pyx_k_out_off[] = "out_off";
static char __pyx_k_unknown[] = "_unknown";
static char __pyx_k_LeafNode[] = "LeafNode";
static char __pyx_k_byte_end[] = "byte_end";
static char __pyx_k_byte_str[] = "byte_str";
static char __pyx_k_flat_key[] = "flat_key";
static char __pyx_k_num_bits[] = "num_bits";
static char __pyx_k_raw_size[] = "_raw_size";
static char __pyx_k_revision[] = "revision";
static char __pyx_k_TypeError[] = "TypeError";
static char __pyx_k_byte_size[] = "byte_size";
static char __pyx_k_key_width[] = "_key_width";
static char __pyx_k_last_null[] = "last_null";
static char __pyx_k_next_line[] = "next_line";
static char __pyx_k_next_null[] = "next_null";
static char __pyx_k_null_line[] = "null line\n";
static char __pyx_k_ValueError[] = "ValueError";
static char __pyx_k_entry_bits[] = "entry_bits";
static char __pyx_k_line_start[] = "line_start";
static char __pyx_k_node_width[] = "_node_width";
static char __pyx_k_bad_no_null[] = "bad no null";
static char __pyx_k_c_bytes_len[] = "c_bytes_len";
static char __pyx_k_entry_start[] = "entry_start";
static char __pyx_k_file_id_len[] = "file_id_len";
static char __pyx_k_file_id_str[] = "file_id_str";
static char __pyx_k_item_prefix[] = "item_prefix";
static char __pyx_k_line_prefix[] = "line_prefix";
static char __pyx_k_prefix_bits[] = "prefix_bits";
static char __pyx_k_prefix_tail[] = "prefix_tail";
static char __pyx_k_value_start[] = "value_start";
static char __pyx_k_InternalNode[] = "InternalNode";
static char __pyx_k_current_size[] = "_current_size";
static char __pyx_k_items_length[] = "items_length";
static char __pyx_k_maximum_size[] = "maximum_size";
static char __pyx_k_revision_str[] = "revision_str";
static char __pyx_k_c_item_prefix[] = "c_item_prefix";
static char __pyx_k_num_out_bytes[] = "num_out_bytes";
static char __pyx_k_prefix_length[] = "prefix_length";
static char __pyx_k_search_key_16[] = "_search_key_16";
static char __pyx_k_search_prefix[] = "_search_prefix";
static char __pyx_k_AssertionError[] = "AssertionError";
static char __pyx_k_Missing_s_line[] = "Missing %s line\n";
static char __pyx_k_maximum_size_2[] = "_maximum_size";
static char __pyx_k_search_key_255[] = "_search_key_255";
static char __pyx_k_bad_no_null_bad[] = "bad no null, bad";
static char __pyx_k_num_prefix_bits[] = "num_prefix_bits";
static char __pyx_k_num_value_lines[] = "num value lines";
static char __pyx_k_prefix_tail_len[] = "prefix_tail_len";
static char __pyx_k_search_key_func[] = "search_key_func";
static char __pyx_k_bytes_to_text_key[] = "_bytes_to_text_key";
static char __pyx_k_num_value_lines_2[] = "num_value_lines";
static char __pyx_k_bzrlib__chk_map_pyx[] = "bzrlib._chk_map_pyx";
static char __pyx_k_No_kind_section_found[] = "No kind section found.";
static char __pyx_k_deserialise_leaf_node[] = "_deserialise_leaf_node";
static char __pyx_k_Missing_the_prefix_line[] = "Missing the prefix line\n";
static char __pyx_k_Too_many_bits_for_entry[] = "Too many bits for entry";
static char __pyx_k_s_line_not_a_proper_int[] = "%s line not a proper int\n";
static char __pyx_k_common_serialised_prefix[] = "_common_serialised_prefix";
static char __pyx_k_missing_trailing_newline[] = "missing trailing newline";
static char __pyx_k_no_newline_after_file_id[] = "no newline after file-id";
static char __pyx_k_deserialise_internal_node[] = "_deserialise_internal_node";
static char __pyx_k_no_newline_after_name_str[] = "no newline after name str";
static char __pyx_k_key_r_is_not_a_StaticTuple[] = "key %r is not a StaticTuple";
static char __pyx_k_no_newline_after_parent_str[] = "no newline after parent_str";
static char __pyx_k_bytes_must_be_a_string_got_r[] = "bytes must be a string, got %r";
static char __pyx_k_not_a_serialised_leaf_node_r[] = "not a serialised leaf node: %r";
static char __pyx_k_bytes_does_not_end_in_a_newline[] = "bytes does not end in a newline";
static char __pyx_k_current_size_computed_incorrect[] = "_current_size computed incorrectly %d != %d";
static char __pyx_k_home_vila_src_bzr_integration_2[] = "/home/vila/src/bzr/integration/2.7.0-dev/bzrlib/_chk_map_pyx.pyx";
static char __pyx_k_item_count_d_mismatch_for_key_s[] = "item count (%d) mismatch for key %s, bytes %r";
static char __pyx_k_Incorrect_number_of_elements_d_v[] = "Incorrect number of elements (%d vs %d)";
static char __pyx_k_Kind_section_should_end_with_got[] = "Kind section should end with \": \", got %r";
static char __pyx_k_Prefix_has_too_many_nulls_versus[] = "Prefix has too many nulls versus width";
static char __pyx_k_bytes_must_be_a_plain_string_not[] = "bytes must be a plain string not %s";
static char __pyx_k_fail_to_find_the_num_value_lines[] = "fail to find the num value lines null";
static char __pyx_k_not_a_serialised_internal_node_r[] = "not a serialised internal node: %r";
static char __pyx_k_tried_to_create_a_string_with_an[] = "tried to create a string with an invalid size: %d @0x%x";
static PyObject *__pyx_n_s_AssertionError;
static PyObject *__pyx_kp_s_Incorrect_number_of_elements_d_v;
static PyObject *__pyx_n_s_InternalNode;
static PyObject *__pyx_kp_s_Kind_section_should_end_with_got;
static PyObject *__pyx_n_s_LeafNode;
static PyObject *__pyx_kp_s_Missing_s_line;
static PyObject *__pyx_kp_s_Missing_the_prefix_line;
static PyObject *__pyx_kp_s_No_kind_section_found;
static PyObject *__pyx_kp_s_Prefix_has_too_many_nulls_versus;
static PyObject *__pyx_kp_s_Too_many_bits_for_entry;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_kp_s_bad_no_null;
static PyObject *__pyx_kp_s_bad_no_null_bad;
static PyObject *__pyx_n_s_byte_end;
static PyObject *__pyx_n_s_byte_size;
static PyObject *__pyx_n_s_byte_str;
static PyObject *__pyx_n_s_bytes;
static PyObject *__pyx_kp_s_bytes_does_not_end_in_a_newline;
static PyObject *__pyx_kp_s_bytes_must_be_a_plain_string_not;
static PyObject *__pyx_kp_s_bytes_must_be_a_string_got_r;
static PyObject *__pyx_n_s_bytes_to_text_key;
static PyObject *__pyx_n_s_bzrlib;
static PyObject *__pyx_n_s_bzrlib__chk_map_pyx;
static PyObject *__pyx_n_s_c_bytes;
static PyObject *__pyx_n_s_c_bytes_len;
static PyObject *__pyx_n_s_c_entry;
static PyObject *__pyx_n_s_c_item_prefix;
static PyObject *__pyx_n_s_c_out;
static PyObject *__pyx_n_s_chk_map;
static PyObject *__pyx_n_s_common_serialised_prefix;
static PyObject *__pyx_n_s_crc32;
static PyObject *__pyx_n_s_crc_val;
static PyObject *__pyx_n_s_cur;
static PyObject *__pyx_n_s_cur_end;
static PyObject *__pyx_n_s_current_size;
static PyObject *__pyx_kp_s_current_size_computed_incorrect;
static PyObject *__pyx_n_s_deserialise_internal_node;
static PyObject *__pyx_n_s_deserialise_leaf_node;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_entry;
static PyObject *__pyx_n_s_entry_bits;
static PyObject *__pyx_n_s_entry_start;
static PyObject *__pyx_kp_s_fail_to_find_the_num_value_lines;
static PyObject *__pyx_n_s_file_id;
static PyObject *__pyx_n_s_file_id_len;
static PyObject *__pyx_n_s_file_id_str;
static PyObject *__pyx_n_s_flat_key;
static PyObject *__pyx_kp_s_home_vila_src_bzr_integration_2;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_intern;
static PyObject *__pyx_kp_s_item_count_d_mismatch_for_key_s;
static PyObject *__pyx_n_s_item_prefix;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_items_2;
static PyObject *__pyx_n_s_items_length;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_key_2;
static PyObject *__pyx_kp_s_key_r_is_not_a_StaticTuple;
static PyObject *__pyx_n_s_key_width;
static PyObject *__pyx_n_s_last_null;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_n_s_length;
static PyObject *__pyx_n_s_line_prefix;
static PyObject *__pyx_n_s_line_start;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_maximum_size;
static PyObject *__pyx_n_s_maximum_size_2;
static PyObject *__pyx_kp_s_missing_trailing_newline;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_next_line;
static PyObject *__pyx_n_s_next_null;
static PyObject *__pyx_kp_s_no_newline_after_file_id;
static PyObject *__pyx_kp_s_no_newline_after_name_str;
static PyObject *__pyx_kp_s_no_newline_after_parent_str;
static PyObject *__pyx_n_s_node_width;
static PyObject *__pyx_kp_s_not_a_serialised_internal_node_r;
static PyObject *__pyx_kp_s_not_a_serialised_leaf_node_r;
static PyObject *__pyx_kp_s_null_line;
static PyObject *__pyx_n_s_num_bits;
static PyObject *__pyx_n_s_num_out_bytes;
static PyObject *__pyx_n_s_num_prefix_bits;
static PyObject *__pyx_n_s_num_value_lines_2;
static PyObject *__pyx_n_s_out;
static PyObject *__pyx_n_s_out_off;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_prefix;
static PyObject *__pyx_n_s_prefix_bits;
static PyObject *__pyx_n_s_prefix_length;
static PyObject *__pyx_n_s_prefix_tail;
static PyObject *__pyx_n_s_prefix_tail_len;
static PyObject *__pyx_n_s_raw_size;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_revision;
static PyObject *__pyx_n_s_revision_str;
static PyObject *__pyx_kp_s_s_line_not_a_proper_int;
static PyObject *__pyx_n_s_search_key_16;
static PyObject *__pyx_n_s_search_key_255;
static PyObject *__pyx_n_s_search_key_func;
static PyObject *__pyx_n_s_search_prefix;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_s_tried_to_create_a_string_with_an;
static PyObject *__pyx_n_s_unknown;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_value_start;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_zlib;
static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx__search_key_16(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_2_search_key_255(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_4_deserialise_leaf_node(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes, PyObject *__pyx_v_key, PyObject *__pyx_v_search_key_func); /* proto */
static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_6_deserialise_internal_node(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes, PyObject *__pyx_v_key, PyObject *__pyx_v_search_key_func); /* proto */
static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_8_bytes_to_text_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;

/* "bzrlib/_chk_map_pyx.pyx":71
 * 
 * # We shouldn't just copy this from _dirstate_helpers_pyx
 * cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise             # <<<<<<<<<<<<<<
 *     # memrchr seems to be a GNU extension, so we have to implement it ourselves
 *     cdef char *pos
 */

static void *__pyx_f_6bzrlib_12_chk_map_pyx__my_memrchr(void *__pyx_v_s, int __pyx_v_c, size_t __pyx_v_n) {
  char *__pyx_v_pos;
  char *__pyx_v_start;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_my_memrchr", 0);

  /* "bzrlib/_chk_map_pyx.pyx":76
 *     cdef char *start
 * 
 *     start = <char*>s             # <<<<<<<<<<<<<<
 *     pos = start + n - 1
 *     while pos >= start:
 */
  __pyx_v_start = ((char *)__pyx_v_s);

  /* "bzrlib/_chk_map_pyx.pyx":77
 * 
 *     start = <char*>s
 *     pos = start + n - 1             # <<<<<<<<<<<<<<
 *     while pos >= start:
 *         if pos[0] == c:
 */
  __pyx_v_pos = ((__pyx_v_start + __pyx_v_n) - 1);

  /* "bzrlib/_chk_map_pyx.pyx":78
 *     start = <char*>s
 *     pos = start + n - 1
 *     while pos >= start:             # <<<<<<<<<<<<<<
 *         if pos[0] == c:
 *             return <void*>pos
 */
  while (1) {
    __pyx_t_1 = ((__pyx_v_pos >= __pyx_v_start) != 0);
    if (!__pyx_t_1) break;

    /* "bzrlib/_chk_map_pyx.pyx":79
 *     pos = start + n - 1
 *     while pos >= start:
 *         if pos[0] == c:             # <<<<<<<<<<<<<<
 *             return <void*>pos
 *         pos = pos - 1
 */
    __pyx_t_1 = (((__pyx_v_pos[0]) == __pyx_v_c) != 0);
    if (__pyx_t_1) {

      /* "bzrlib/_chk_map_pyx.pyx":80
 *     while pos >= start:
 *         if pos[0] == c:
 *             return <void*>pos             # <<<<<<<<<<<<<<
 *         pos = pos - 1
 *     return NULL
 */
      __pyx_r = ((void *)__pyx_v_pos);
      goto __pyx_L0;

      /* "bzrlib/_chk_map_pyx.pyx":79
 *     pos = start + n - 1
 *     while pos >= start:
 *         if pos[0] == c:             # <<<<<<<<<<<<<<
 *             return <void*>pos
 *         pos = pos - 1
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":81
 *         if pos[0] == c:
 *             return <void*>pos
 *         pos = pos - 1             # <<<<<<<<<<<<<<
 *     return NULL
 * 
 */
    __pyx_v_pos = (__pyx_v_pos - 1);
  }

  /* "bzrlib/_chk_map_pyx.pyx":82
 *             return <void*>pos
 *         pos = pos - 1
 *     return NULL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = NULL;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":71
 * 
 * # We shouldn't just copy this from _dirstate_helpers_pyx
 * cdef void* _my_memrchr(void *s, int c, size_t n): # cannot_raise             # <<<<<<<<<<<<<<
 *     # memrchr seems to be a GNU extension, so we have to implement it ourselves
 *     cdef char *pos
 */

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

/* "bzrlib/_chk_map_pyx.pyx":85
 * 
 * 
 * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size):             # <<<<<<<<<<<<<<
 *     cdef PyObject *py_str
 *     if size < 0:
 */

static PyObject *__pyx_f_6bzrlib_12_chk_map_pyx_safe_interned_string_from_size(char *__pyx_v_s, Py_ssize_t __pyx_v_size) {
  PyObject *__pyx_v_py_str;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("safe_interned_string_from_size", 0);

  /* "bzrlib/_chk_map_pyx.pyx":87
 * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size):
 *     cdef PyObject *py_str
 *     if size < 0:             # <<<<<<<<<<<<<<
 *         raise AssertionError(
 *             'tried to create a string with an invalid size: %d @0x%x'
 */
  __pyx_t_1 = ((__pyx_v_size < 0) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":90
 *         raise AssertionError(
 *             'tried to create a string with an invalid size: %d @0x%x'
 *             % (size, <int>s))             # <<<<<<<<<<<<<<
 *     py_str = PyString_FromStringAndSize_ptr(s, size)
 *     PyString_InternInPlace(&py_str)
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_From_int(((int)__pyx_v_s)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_tried_to_create_a_string_with_an, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":88
 *     cdef PyObject *py_str
 *     if size < 0:
 *         raise AssertionError(             # <<<<<<<<<<<<<<
 *             'tried to create a string with an invalid size: %d @0x%x'
 *             % (size, <int>s))
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":87
 * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size):
 *     cdef PyObject *py_str
 *     if size < 0:             # <<<<<<<<<<<<<<
 *         raise AssertionError(
 *             'tried to create a string with an invalid size: %d @0x%x'
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":91
 *             'tried to create a string with an invalid size: %d @0x%x'
 *             % (size, <int>s))
 *     py_str = PyString_FromStringAndSize_ptr(s, size)             # <<<<<<<<<<<<<<
 *     PyString_InternInPlace(&py_str)
 *     result = <object>py_str
 */
  __pyx_v_py_str = PyString_FromStringAndSize(__pyx_v_s, __pyx_v_size);

  /* "bzrlib/_chk_map_pyx.pyx":92
 *             % (size, <int>s))
 *     py_str = PyString_FromStringAndSize_ptr(s, size)
 *     PyString_InternInPlace(&py_str)             # <<<<<<<<<<<<<<
 *     result = <object>py_str
 *     # Casting a PyObject* to an <object> triggers an INCREF from Pyrex, so we
 */
  PyString_InternInPlace((&__pyx_v_py_str));

  /* "bzrlib/_chk_map_pyx.pyx":93
 *     py_str = PyString_FromStringAndSize_ptr(s, size)
 *     PyString_InternInPlace(&py_str)
 *     result = <object>py_str             # <<<<<<<<<<<<<<
 *     # Casting a PyObject* to an <object> triggers an INCREF from Pyrex, so we
 *     # DECREF it to avoid geting immortal strings
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_py_str);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":96
 *     # Casting a PyObject* to an <object> triggers an INCREF from Pyrex, so we
 *     # DECREF it to avoid geting immortal strings
 *     Py_DECREF_ptr(py_str)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  Py_DECREF(__pyx_v_py_str);

  /* "bzrlib/_chk_map_pyx.pyx":97
 *     # DECREF it to avoid geting immortal strings
 *     Py_DECREF_ptr(py_str)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":85
 * 
 * 
 * cdef object safe_interned_string_from_size(char *s, Py_ssize_t size):             # <<<<<<<<<<<<<<
 *     cdef PyObject *py_str
 *     if size < 0:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx.safe_interned_string_from_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":100
 * 
 * 
 * def _search_key_16(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_16."""
 *     cdef Py_ssize_t num_bits
 */

/* Python wrapper */
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_1_search_key_16(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6bzrlib_12_chk_map_pyx__search_key_16[] = "See chk_map._search_key_16.";
static PyMethodDef __pyx_mdef_6bzrlib_12_chk_map_pyx_1_search_key_16 = {"_search_key_16", (PyCFunction)__pyx_pw_6bzrlib_12_chk_map_pyx_1_search_key_16, METH_O, __pyx_doc_6bzrlib_12_chk_map_pyx__search_key_16};
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_1_search_key_16(PyObject *__pyx_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_search_key_16 (wrapper)", 0);
  __pyx_r = __pyx_pf_6bzrlib_12_chk_map_pyx__search_key_16(__pyx_self, ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx__search_key_16(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key) {
  Py_ssize_t __pyx_v_num_bits;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_num_out_bytes;
  unsigned long __pyx_v_crc_val;
  char *__pyx_v_c_out;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_search_key_16", 0);

  /* "bzrlib/_chk_map_pyx.pyx":109
 *     cdef char *c_out
 * 
 *     num_bits = len(key)             # <<<<<<<<<<<<<<
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (9 * num_bits) - 1
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_num_bits = __pyx_t_1;

  /* "bzrlib/_chk_map_pyx.pyx":111
 *     num_bits = len(key)
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (9 * num_bits) - 1             # <<<<<<<<<<<<<<
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)
 */
  __pyx_v_num_out_bytes = ((9 * __pyx_v_num_bits) - 1);

  /* "bzrlib/_chk_map_pyx.pyx":112
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (9 * num_bits) - 1
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)             # <<<<<<<<<<<<<<
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 */
  __pyx_t_2 = PyString_FromStringAndSize(NULL, __pyx_v_num_out_bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":113
 *     num_out_bytes = (9 * num_bits) - 1
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < num_bits:
 *         if i > 0:
 */
  __pyx_v_c_out = PyString_AS_STRING(__pyx_v_out);

  /* "bzrlib/_chk_map_pyx.pyx":114
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:             # <<<<<<<<<<<<<<
 *         if i > 0:
 *             c_out[0] = c'\x00'
 */
  __pyx_t_1 = __pyx_v_num_bits;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "bzrlib/_chk_map_pyx.pyx":115
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 *         if i > 0:             # <<<<<<<<<<<<<<
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 */
    __pyx_t_3 = ((__pyx_v_i > 0) != 0);
    if (__pyx_t_3) {

      /* "bzrlib/_chk_map_pyx.pyx":116
 *     for i from 0 <= i < num_bits:
 *         if i > 0:
 *             c_out[0] = c'\x00'             # <<<<<<<<<<<<<<
 *             c_out = c_out + 1
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 */
      (__pyx_v_c_out[0]) = '\x00';

      /* "bzrlib/_chk_map_pyx.pyx":117
 *         if i > 0:
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1             # <<<<<<<<<<<<<<
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 *         # Hex(val) order
 */
      __pyx_v_c_out = (__pyx_v_c_out + 1);

      /* "bzrlib/_chk_map_pyx.pyx":115
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 *         if i > 0:             # <<<<<<<<<<<<<<
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":118
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))             # <<<<<<<<<<<<<<
 *         # Hex(val) order
 *         sprintf(c_out, '%08X', crc_val)
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_key, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_6bzrlib_12_chk_map_pyx_crc32);
    __pyx_t_5 = __pyx_v_6bzrlib_12_chk_map_pyx_crc32; __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_crc_val = PyInt_AS_LONG(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":120
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 *         # Hex(val) order
 *         sprintf(c_out, '%08X', crc_val)             # <<<<<<<<<<<<<<
 *         c_out = c_out + 8
 *     return out
 */
    sprintf(__pyx_v_c_out, __pyx_k_08X, __pyx_v_crc_val);

    /* "bzrlib/_chk_map_pyx.pyx":121
 *         # Hex(val) order
 *         sprintf(c_out, '%08X', crc_val)
 *         c_out = c_out + 8             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
    __pyx_v_c_out = (__pyx_v_c_out + 8);
  }

  /* "bzrlib/_chk_map_pyx.pyx":122
 *         sprintf(c_out, '%08X', crc_val)
 *         c_out = c_out + 8
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":100
 * 
 * 
 * def _search_key_16(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_16."""
 *     cdef Py_ssize_t num_bits
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._search_key_16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":125
 * 
 * 
 * def _search_key_255(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_255."""
 *     cdef Py_ssize_t num_bits
 */

/* Python wrapper */
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_3_search_key_255(PyObject *__pyx_self, PyObject *__pyx_v_key); /*proto*/
static char __pyx_doc_6bzrlib_12_chk_map_pyx_2_search_key_255[] = "See chk_map._search_key_255.";
static PyMethodDef __pyx_mdef_6bzrlib_12_chk_map_pyx_3_search_key_255 = {"_search_key_255", (PyCFunction)__pyx_pw_6bzrlib_12_chk_map_pyx_3_search_key_255, METH_O, __pyx_doc_6bzrlib_12_chk_map_pyx_2_search_key_255};
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_3_search_key_255(PyObject *__pyx_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_search_key_255 (wrapper)", 0);
  __pyx_r = __pyx_pf_6bzrlib_12_chk_map_pyx_2_search_key_255(__pyx_self, ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_2_search_key_255(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_key) {
  Py_ssize_t __pyx_v_num_bits;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_num_out_bytes;
  unsigned long __pyx_v_crc_val;
  char *__pyx_v_c_out;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_search_key_255", 0);

  /* "bzrlib/_chk_map_pyx.pyx":134
 *     cdef char *c_out
 * 
 *     num_bits = len(key)             # <<<<<<<<<<<<<<
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (5 * num_bits) - 1
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_num_bits = __pyx_t_1;

  /* "bzrlib/_chk_map_pyx.pyx":136
 *     num_bits = len(key)
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (5 * num_bits) - 1             # <<<<<<<<<<<<<<
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)
 */
  __pyx_v_num_out_bytes = ((5 * __pyx_v_num_bits) - 1);

  /* "bzrlib/_chk_map_pyx.pyx":137
 *     # 4 bytes per crc32, and another 1 byte between bits
 *     num_out_bytes = (5 * num_bits) - 1
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)             # <<<<<<<<<<<<<<
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 */
  __pyx_t_2 = PyString_FromStringAndSize(NULL, __pyx_v_num_out_bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_out = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":138
 *     num_out_bytes = (5 * num_bits) - 1
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)             # <<<<<<<<<<<<<<
 *     for i from 0 <= i < num_bits:
 *         if i > 0:
 */
  __pyx_v_c_out = PyString_AS_STRING(__pyx_v_out);

  /* "bzrlib/_chk_map_pyx.pyx":139
 *     out = PyString_FromStringAndSize(NULL, num_out_bytes)
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:             # <<<<<<<<<<<<<<
 *         if i > 0:
 *             c_out[0] = c'\x00'
 */
  __pyx_t_1 = __pyx_v_num_bits;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {

    /* "bzrlib/_chk_map_pyx.pyx":140
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 *         if i > 0:             # <<<<<<<<<<<<<<
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 */
    __pyx_t_3 = ((__pyx_v_i > 0) != 0);
    if (__pyx_t_3) {

      /* "bzrlib/_chk_map_pyx.pyx":141
 *     for i from 0 <= i < num_bits:
 *         if i > 0:
 *             c_out[0] = c'\x00'             # <<<<<<<<<<<<<<
 *             c_out = c_out + 1
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 */
      (__pyx_v_c_out[0]) = '\x00';

      /* "bzrlib/_chk_map_pyx.pyx":142
 *         if i > 0:
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1             # <<<<<<<<<<<<<<
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 *         # MSB order
 */
      __pyx_v_c_out = (__pyx_v_c_out + 1);

      /* "bzrlib/_chk_map_pyx.pyx":140
 *     c_out = PyString_AS_STRING(out)
 *     for i from 0 <= i < num_bits:
 *         if i > 0:             # <<<<<<<<<<<<<<
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":143
 *             c_out[0] = c'\x00'
 *             c_out = c_out + 1
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))             # <<<<<<<<<<<<<<
 *         # MSB order
 *         c_out[0] = (crc_val >> 24) & 0xFF
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_key, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_6bzrlib_12_chk_map_pyx_crc32);
    __pyx_t_5 = __pyx_v_6bzrlib_12_chk_map_pyx_crc32; __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_crc_val = PyInt_AS_LONG(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":145
 *         crc_val = PyInt_AS_LONG(crc32(key[i]))
 *         # MSB order
 *         c_out[0] = (crc_val >> 24) & 0xFF             # <<<<<<<<<<<<<<
 *         c_out[1] = (crc_val >> 16) & 0xFF
 *         c_out[2] = (crc_val >> 8) & 0xFF
 */
    (__pyx_v_c_out[0]) = ((__pyx_v_crc_val >> 24) & 0xFF);

    /* "bzrlib/_chk_map_pyx.pyx":146
 *         # MSB order
 *         c_out[0] = (crc_val >> 24) & 0xFF
 *         c_out[1] = (crc_val >> 16) & 0xFF             # <<<<<<<<<<<<<<
 *         c_out[2] = (crc_val >> 8) & 0xFF
 *         c_out[3] = (crc_val >> 0) & 0xFF
 */
    (__pyx_v_c_out[1]) = ((__pyx_v_crc_val >> 16) & 0xFF);

    /* "bzrlib/_chk_map_pyx.pyx":147
 *         c_out[0] = (crc_val >> 24) & 0xFF
 *         c_out[1] = (crc_val >> 16) & 0xFF
 *         c_out[2] = (crc_val >> 8) & 0xFF             # <<<<<<<<<<<<<<
 *         c_out[3] = (crc_val >> 0) & 0xFF
 *         for j from 0 <= j < 4:
 */
    (__pyx_v_c_out[2]) = ((__pyx_v_crc_val >> 8) & 0xFF);

    /* "bzrlib/_chk_map_pyx.pyx":148
 *         c_out[1] = (crc_val >> 16) & 0xFF
 *         c_out[2] = (crc_val >> 8) & 0xFF
 *         c_out[3] = (crc_val >> 0) & 0xFF             # <<<<<<<<<<<<<<
 *         for j from 0 <= j < 4:
 *             if c_out[j] == c'\n':
 */
    (__pyx_v_c_out[3]) = ((__pyx_v_crc_val >> 0) & 0xFF);

    /* "bzrlib/_chk_map_pyx.pyx":149
 *         c_out[2] = (crc_val >> 8) & 0xFF
 *         c_out[3] = (crc_val >> 0) & 0xFF
 *         for j from 0 <= j < 4:             # <<<<<<<<<<<<<<
 *             if c_out[j] == c'\n':
 *                 c_out[j] = c'_'
 */
    for (__pyx_v_j = 0; __pyx_v_j < 4; __pyx_v_j++) {

      /* "bzrlib/_chk_map_pyx.pyx":150
 *         c_out[3] = (crc_val >> 0) & 0xFF
 *         for j from 0 <= j < 4:
 *             if c_out[j] == c'\n':             # <<<<<<<<<<<<<<
 *                 c_out[j] = c'_'
 *         c_out = c_out + 4
 */
      __pyx_t_3 = (((__pyx_v_c_out[__pyx_v_j]) == '\n') != 0);
      if (__pyx_t_3) {

        /* "bzrlib/_chk_map_pyx.pyx":151
 *         for j from 0 <= j < 4:
 *             if c_out[j] == c'\n':
 *                 c_out[j] = c'_'             # <<<<<<<<<<<<<<
 *         c_out = c_out + 4
 *     return out
 */
        (__pyx_v_c_out[__pyx_v_j]) = '_';

        /* "bzrlib/_chk_map_pyx.pyx":150
 *         c_out[3] = (crc_val >> 0) & 0xFF
 *         for j from 0 <= j < 4:
 *             if c_out[j] == c'\n':             # <<<<<<<<<<<<<<
 *                 c_out[j] = c'_'
 *         c_out = c_out + 4
 */
      }
    }

    /* "bzrlib/_chk_map_pyx.pyx":152
 *             if c_out[j] == c'\n':
 *                 c_out[j] = c'_'
 *         c_out = c_out + 4             # <<<<<<<<<<<<<<
 *     return out
 * 
 */
    __pyx_v_c_out = (__pyx_v_c_out + 4);
  }

  /* "bzrlib/_chk_map_pyx.pyx":153
 *                 c_out[j] = c'_'
 *         c_out = c_out + 4
 *     return out             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":125
 * 
 * 
 * def _search_key_255(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_255."""
 *     cdef Py_ssize_t num_bits
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._search_key_255", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":156
 * 
 * 
 * cdef int _get_int_from_line(char **cur, char *end, char *message) except -1:             # <<<<<<<<<<<<<<
 *     """Read a positive integer from the data stream.
 * 
 */

static int __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line(char **__pyx_v_cur, char *__pyx_v_end, char *__pyx_v_message) {
  int __pyx_v_value;
  char *__pyx_v_next_line;
  char *__pyx_v_next;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_int_from_line", 0);

  /* "bzrlib/_chk_map_pyx.pyx":167
 *     cdef char *next_line, *next
 * 
 *     next_line = <char *>memchr(cur[0], c'\n', end - cur[0])             # <<<<<<<<<<<<<<
 *     if next_line == NULL:
 *         raise ValueError("Missing %s line\n" % message)
 */
  __pyx_v_next_line = ((char *)memchr((__pyx_v_cur[0]), '\n', (__pyx_v_end - (__pyx_v_cur[0]))));

  /* "bzrlib/_chk_map_pyx.pyx":168
 * 
 *     next_line = <char *>memchr(cur[0], c'\n', end - cur[0])
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Missing %s line\n" % message)
 * 
 */
  __pyx_t_1 = ((__pyx_v_next_line == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":169
 *     next_line = <char *>memchr(cur[0], c'\n', end - cur[0])
 *     if next_line == NULL:
 *         raise ValueError("Missing %s line\n" % message)             # <<<<<<<<<<<<<<
 * 
 *     value = strtol(cur[0], &next, 10)
 */
    __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Missing_s_line, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":168
 * 
 *     next_line = <char *>memchr(cur[0], c'\n', end - cur[0])
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError("Missing %s line\n" % message)
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":171
 *         raise ValueError("Missing %s line\n" % message)
 * 
 *     value = strtol(cur[0], &next, 10)             # <<<<<<<<<<<<<<
 *     if next != next_line:
 *         raise ValueError("%s line not a proper int\n" % message)
 */
  __pyx_v_value = strtol((__pyx_v_cur[0]), (&__pyx_v_next), 10);

  /* "bzrlib/_chk_map_pyx.pyx":172
 * 
 *     value = strtol(cur[0], &next, 10)
 *     if next != next_line:             # <<<<<<<<<<<<<<
 *         raise ValueError("%s line not a proper int\n" % message)
 *     cur[0] = next_line + 1
 */
  __pyx_t_1 = ((__pyx_v_next != __pyx_v_next_line) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":173
 *     value = strtol(cur[0], &next, 10)
 *     if next != next_line:
 *         raise ValueError("%s line not a proper int\n" % message)             # <<<<<<<<<<<<<<
 *     cur[0] = next_line + 1
 *     return value
 */
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_message); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_s_line_not_a_proper_int, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":172
 * 
 *     value = strtol(cur[0], &next, 10)
 *     if next != next_line:             # <<<<<<<<<<<<<<
 *         raise ValueError("%s line not a proper int\n" % message)
 *     cur[0] = next_line + 1
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":174
 *     if next != next_line:
 *         raise ValueError("%s line not a proper int\n" % message)
 *     cur[0] = next_line + 1             # <<<<<<<<<<<<<<
 *     return value
 * 
 */
  (__pyx_v_cur[0]) = (__pyx_v_next_line + 1);

  /* "bzrlib/_chk_map_pyx.pyx":175
 *         raise ValueError("%s line not a proper int\n" % message)
 *     cur[0] = next_line + 1
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_value;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":156
 * 
 * 
 * cdef int _get_int_from_line(char **cur, char *end, char *message) except -1:             # <<<<<<<<<<<<<<
 *     """Read a positive integer from the data stream.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._get_int_from_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":178
 * 
 * 
 * cdef _import_globals():             # <<<<<<<<<<<<<<
 *     """Set the global attributes. Done lazy to avoid recursive import loops."""
 *     global _LeafNode, _InternalNode, _unknown
 */

static PyObject *__pyx_f_6bzrlib_12_chk_map_pyx__import_globals(void) {
  PyObject *__pyx_v_chk_map = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_import_globals", 0);

  /* "bzrlib/_chk_map_pyx.pyx":182
 *     global _LeafNode, _InternalNode, _unknown
 * 
 *     from bzrlib import chk_map             # <<<<<<<<<<<<<<
 *     _LeafNode = chk_map.LeafNode
 *     _InternalNode = chk_map.InternalNode
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_chk_map);
  __Pyx_GIVEREF(__pyx_n_s_chk_map);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_chk_map);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_bzrlib, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_chk_map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_chk_map = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":183
 * 
 *     from bzrlib import chk_map
 *     _LeafNode = chk_map.LeafNode             # <<<<<<<<<<<<<<
 *     _InternalNode = chk_map.InternalNode
 *     _unknown = chk_map._unknown
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_chk_map, __pyx_n_s_LeafNode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":184
 *     from bzrlib import chk_map
 *     _LeafNode = chk_map.LeafNode
 *     _InternalNode = chk_map.InternalNode             # <<<<<<<<<<<<<<
 *     _unknown = chk_map._unknown
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_chk_map, __pyx_n_s_InternalNode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":185
 *     _LeafNode = chk_map.LeafNode
 *     _InternalNode = chk_map.InternalNode
 *     _unknown = chk_map._unknown             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_chk_map, __pyx_n_s_unknown); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__unknown);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__unknown, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":178
 * 
 * 
 * cdef _import_globals():             # <<<<<<<<<<<<<<
 *     """Set the global attributes. Done lazy to avoid recursive import loops."""
 *     global _LeafNode, _InternalNode, _unknown
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._import_globals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chk_map);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":188
 * 
 * 
 * def _deserialise_leaf_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     """Deserialise bytes, with key key, into a LeafNode.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_5_deserialise_leaf_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_12_chk_map_pyx_4_deserialise_leaf_node[] = "Deserialise bytes, with key key, into a LeafNode.\n\n    :param bytes: The bytes of the node.\n    :param key: The key that the serialised node has.\n    ";
static PyMethodDef __pyx_mdef_6bzrlib_12_chk_map_pyx_5_deserialise_leaf_node = {"_deserialise_leaf_node", (PyCFunction)__pyx_pw_6bzrlib_12_chk_map_pyx_5_deserialise_leaf_node, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_12_chk_map_pyx_4_deserialise_leaf_node};
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_5_deserialise_leaf_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bytes = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_search_key_func = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_deserialise_leaf_node (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bytes,&__pyx_n_s_key,&__pyx_n_s_search_key_func,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_deserialise_leaf_node", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_search_key_func);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_deserialise_leaf_node") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bytes = values[0];
    __pyx_v_key = values[1];
    __pyx_v_search_key_func = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_deserialise_leaf_node", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._deserialise_leaf_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6bzrlib_12_chk_map_pyx_4_deserialise_leaf_node(__pyx_self, __pyx_v_bytes, __pyx_v_key, __pyx_v_search_key_func);

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

static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_4_deserialise_leaf_node(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes, PyObject *__pyx_v_key, PyObject *__pyx_v_search_key_func) {
  char *__pyx_v_c_bytes;
  char *__pyx_v_cur;
  char *__pyx_v_end;
  char *__pyx_v_next_line;
  Py_ssize_t __pyx_v_c_bytes_len;
  Py_ssize_t __pyx_v_prefix_length;
  Py_ssize_t __pyx_v_items_length;
  int __pyx_v_maximum_size;
  int __pyx_v_width;
  int __pyx_v_length;
  int __pyx_v_i;
  int __pyx_v_prefix_tail_len;
  int __pyx_v_num_value_lines;
  int __pyx_v_num_prefix_bits;
  char *__pyx_v_prefix;
  char *__pyx_v_value_start;
  char *__pyx_v_prefix_tail;
  char *__pyx_v_next_null;
  char *__pyx_v_last_null;
  char *__pyx_v_line_start;
  char *__pyx_v_c_entry;
  char *__pyx_v_entry_start;
  StaticTuple *__pyx_v_entry_bits = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_prefix_bits = NULL;
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_deserialise_leaf_node", 0);

  /* "bzrlib/_chk_map_pyx.pyx":204
 *     cdef StaticTuple entry_bits
 * 
 *     if _LeafNode is None:             # <<<<<<<<<<<<<<
 *         _import_globals()
 * 
 */
  __pyx_t_1 = (__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":205
 * 
 *     if _LeafNode is None:
 *         _import_globals()             # <<<<<<<<<<<<<<
 * 
 *     result = _LeafNode(search_key_func=search_key_func)
 */
    __pyx_t_3 = __pyx_f_6bzrlib_12_chk_map_pyx__import_globals(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":204
 *     cdef StaticTuple entry_bits
 * 
 *     if _LeafNode is None:             # <<<<<<<<<<<<<<
 *         _import_globals()
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":207
 *         _import_globals()
 * 
 *     result = _LeafNode(search_key_func=search_key_func)             # <<<<<<<<<<<<<<
 *     # Splitlines can split on '\r' so don't use it, split('\n') adds an
 *     # extra '' if the bytes ends in a final newline.
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_search_key_func, __pyx_v_search_key_func) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":210
 *     # Splitlines can split on '\r' so don't use it, split('\n') adds an
 *     # extra '' if the bytes ends in a final newline.
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 */
  __pyx_t_2 = ((!(PyString_CheckExact(__pyx_v_bytes) != 0)) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":211
 *     # extra '' if the bytes ends in a final newline.
 *     if not PyString_CheckExact(bytes):
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))             # <<<<<<<<<<<<<<
 * 
 *     c_bytes = PyString_AS_STRING(bytes)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_bytes_must_be_a_plain_string_not, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":210
 *     # Splitlines can split on '\r' so don't use it, split('\n') adds an
 *     # extra '' if the bytes ends in a final newline.
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":213
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 *     c_bytes = PyString_AS_STRING(bytes)             # <<<<<<<<<<<<<<
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 */
  __pyx_v_c_bytes = PyString_AS_STRING(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":214
 * 
 *     c_bytes = PyString_AS_STRING(bytes)
 *     c_bytes_len = PyString_GET_SIZE(bytes)             # <<<<<<<<<<<<<<
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:
 */
  __pyx_v_c_bytes_len = PyString_GET_SIZE(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":216
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:             # <<<<<<<<<<<<<<
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 */
  __pyx_t_1 = ((__pyx_v_c_bytes_len < 9) != 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_1 = ((memcmp(__pyx_v_c_bytes, __pyx_k_chkleaf, 9) != 0) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":217
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:
 *         raise ValueError("not a serialised leaf node: %r" % bytes)             # <<<<<<<<<<<<<<
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")
 */
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_not_a_serialised_leaf_node_r, __pyx_v_bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":216
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:             # <<<<<<<<<<<<<<
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":218
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':             # <<<<<<<<<<<<<<
 *         raise ValueError("bytes does not end in a newline")
 * 
 */
  __pyx_t_2 = (((__pyx_v_c_bytes[(__pyx_v_c_bytes_len - 1)]) != '\n') != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":219
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")             # <<<<<<<<<<<<<<
 * 
 *     end = c_bytes + c_bytes_len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":218
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chkleaf:\n", 9) != 0:
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':             # <<<<<<<<<<<<<<
 *         raise ValueError("bytes does not end in a newline")
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":221
 *         raise ValueError("bytes does not end in a newline")
 * 
 *     end = c_bytes + c_bytes_len             # <<<<<<<<<<<<<<
 *     cur = c_bytes + 9
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 */
  __pyx_v_end = (__pyx_v_c_bytes + __pyx_v_c_bytes_len);

  /* "bzrlib/_chk_map_pyx.pyx":222
 * 
 *     end = c_bytes + c_bytes_len
 *     cur = c_bytes + 9             # <<<<<<<<<<<<<<
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")
 */
  __pyx_v_cur = (__pyx_v_c_bytes + 9);

  /* "bzrlib/_chk_map_pyx.pyx":223
 *     end = c_bytes + c_bytes_len
 *     cur = c_bytes + 9
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")             # <<<<<<<<<<<<<<
 *     width = _get_int_from_line(&cur, end, "width")
 *     length = _get_int_from_line(&cur, end, "length")
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_maximum_size); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_maximum_size = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":224
 *     cur = c_bytes + 9
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")             # <<<<<<<<<<<<<<
 *     length = _get_int_from_line(&cur, end, "length")
 * 
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_width); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_width = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":225
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")
 *     length = _get_int_from_line(&cur, end, "length")             # <<<<<<<<<<<<<<
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_length); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":227
 *     length = _get_int_from_line(&cur, end, "length")
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)             # <<<<<<<<<<<<<<
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')
 */
  __pyx_v_next_line = ((char *)memchr(__pyx_v_cur, '\n', (__pyx_v_end - __pyx_v_cur)));

  /* "bzrlib/_chk_map_pyx.pyx":228
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 */
  __pyx_t_2 = ((__pyx_v_next_line == NULL) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":229
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')             # <<<<<<<<<<<<<<
 *     prefix = cur
 *     prefix_length = next_line - cur
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":228
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":230
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur             # <<<<<<<<<<<<<<
 *     prefix_length = next_line - cur
 *     cur = next_line + 1
 */
  __pyx_v_prefix = __pyx_v_cur;

  /* "bzrlib/_chk_map_pyx.pyx":231
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 *     prefix_length = next_line - cur             # <<<<<<<<<<<<<<
 *     cur = next_line + 1
 * 
 */
  __pyx_v_prefix_length = (__pyx_v_next_line - __pyx_v_cur);

  /* "bzrlib/_chk_map_pyx.pyx":232
 *     prefix = cur
 *     prefix_length = next_line - cur
 *     cur = next_line + 1             # <<<<<<<<<<<<<<
 * 
 *     prefix_bits = []
 */
  __pyx_v_cur = (__pyx_v_next_line + 1);

  /* "bzrlib/_chk_map_pyx.pyx":234
 *     cur = next_line + 1
 * 
 *     prefix_bits = []             # <<<<<<<<<<<<<<
 *     prefix_tail = prefix
 *     num_prefix_bits = 0
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_prefix_bits = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":235
 * 
 *     prefix_bits = []
 *     prefix_tail = prefix             # <<<<<<<<<<<<<<
 *     num_prefix_bits = 0
 *     next_null = <char *>memchr(prefix, c'\0', prefix_length)
 */
  __pyx_v_prefix_tail = __pyx_v_prefix;

  /* "bzrlib/_chk_map_pyx.pyx":236
 *     prefix_bits = []
 *     prefix_tail = prefix
 *     num_prefix_bits = 0             # <<<<<<<<<<<<<<
 *     next_null = <char *>memchr(prefix, c'\0', prefix_length)
 *     while next_null != NULL:
 */
  __pyx_v_num_prefix_bits = 0;

  /* "bzrlib/_chk_map_pyx.pyx":237
 *     prefix_tail = prefix
 *     num_prefix_bits = 0
 *     next_null = <char *>memchr(prefix, c'\0', prefix_length)             # <<<<<<<<<<<<<<
 *     while next_null != NULL:
 *         num_prefix_bits = num_prefix_bits + 1
 */
  __pyx_v_next_null = ((char *)memchr(__pyx_v_prefix, '\x00', __pyx_v_prefix_length));

  /* "bzrlib/_chk_map_pyx.pyx":238
 *     num_prefix_bits = 0
 *     next_null = <char *>memchr(prefix, c'\0', prefix_length)
 *     while next_null != NULL:             # <<<<<<<<<<<<<<
 *         num_prefix_bits = num_prefix_bits + 1
 *         prefix_bits.append(
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_next_null != NULL) != 0);
    if (!__pyx_t_2) break;

    /* "bzrlib/_chk_map_pyx.pyx":239
 *     next_null = <char *>memchr(prefix, c'\0', prefix_length)
 *     while next_null != NULL:
 *         num_prefix_bits = num_prefix_bits + 1             # <<<<<<<<<<<<<<
 *         prefix_bits.append(
 *             PyString_FromStringAndSize(prefix_tail, next_null - prefix_tail))
 */
    __pyx_v_num_prefix_bits = (__pyx_v_num_prefix_bits + 1);

    /* "bzrlib/_chk_map_pyx.pyx":241
 *         num_prefix_bits = num_prefix_bits + 1
 *         prefix_bits.append(
 *             PyString_FromStringAndSize(prefix_tail, next_null - prefix_tail))             # <<<<<<<<<<<<<<
 *         prefix_tail = next_null + 1
 *         next_null = <char *>memchr(prefix_tail, c'\0', next_line - prefix_tail)
 */
    __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_prefix_tail, (__pyx_v_next_null - __pyx_v_prefix_tail)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "bzrlib/_chk_map_pyx.pyx":240
 *     while next_null != NULL:
 *         num_prefix_bits = num_prefix_bits + 1
 *         prefix_bits.append(             # <<<<<<<<<<<<<<
 *             PyString_FromStringAndSize(prefix_tail, next_null - prefix_tail))
 *         prefix_tail = next_null + 1
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_prefix_bits, __pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":242
 *         prefix_bits.append(
 *             PyString_FromStringAndSize(prefix_tail, next_null - prefix_tail))
 *         prefix_tail = next_null + 1             # <<<<<<<<<<<<<<
 *         next_null = <char *>memchr(prefix_tail, c'\0', next_line - prefix_tail)
 *     prefix_tail_len = next_line - prefix_tail
 */
    __pyx_v_prefix_tail = (__pyx_v_next_null + 1);

    /* "bzrlib/_chk_map_pyx.pyx":243
 *             PyString_FromStringAndSize(prefix_tail, next_null - prefix_tail))
 *         prefix_tail = next_null + 1
 *         next_null = <char *>memchr(prefix_tail, c'\0', next_line - prefix_tail)             # <<<<<<<<<<<<<<
 *     prefix_tail_len = next_line - prefix_tail
 * 
 */
    __pyx_v_next_null = ((char *)memchr(__pyx_v_prefix_tail, '\x00', (__pyx_v_next_line - __pyx_v_prefix_tail)));
  }

  /* "bzrlib/_chk_map_pyx.pyx":244
 *         prefix_tail = next_null + 1
 *         next_null = <char *>memchr(prefix_tail, c'\0', next_line - prefix_tail)
 *     prefix_tail_len = next_line - prefix_tail             # <<<<<<<<<<<<<<
 * 
 *     if num_prefix_bits >= width:
 */
  __pyx_v_prefix_tail_len = (__pyx_v_next_line - __pyx_v_prefix_tail);

  /* "bzrlib/_chk_map_pyx.pyx":246
 *     prefix_tail_len = next_line - prefix_tail
 * 
 *     if num_prefix_bits >= width:             # <<<<<<<<<<<<<<
 *         raise ValueError('Prefix has too many nulls versus width')
 * 
 */
  __pyx_t_2 = ((__pyx_v_num_prefix_bits >= __pyx_v_width) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":247
 * 
 *     if num_prefix_bits >= width:
 *         raise ValueError('Prefix has too many nulls versus width')             # <<<<<<<<<<<<<<
 * 
 *     items_length = end - cur
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":246
 *     prefix_tail_len = next_line - prefix_tail
 * 
 *     if num_prefix_bits >= width:             # <<<<<<<<<<<<<<
 *         raise ValueError('Prefix has too many nulls versus width')
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":249
 *         raise ValueError('Prefix has too many nulls versus width')
 * 
 *     items_length = end - cur             # <<<<<<<<<<<<<<
 *     items = {}
 *     while cur < end:
 */
  __pyx_v_items_length = (__pyx_v_end - __pyx_v_cur);

  /* "bzrlib/_chk_map_pyx.pyx":250
 * 
 *     items_length = end - cur
 *     items = {}             # <<<<<<<<<<<<<<
 *     while cur < end:
 *         line_start = cur
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_items = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":251
 *     items_length = end - cur
 *     items = {}
 *     while cur < end:             # <<<<<<<<<<<<<<
 *         line_start = cur
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_cur < __pyx_v_end) != 0);
    if (!__pyx_t_2) break;

    /* "bzrlib/_chk_map_pyx.pyx":252
 *     items = {}
 *     while cur < end:
 *         line_start = cur             # <<<<<<<<<<<<<<
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:
 */
    __pyx_v_line_start = __pyx_v_cur;

    /* "bzrlib/_chk_map_pyx.pyx":253
 *     while cur < end:
 *         line_start = cur
 *         next_line = <char *>memchr(cur, c'\n', end - cur)             # <<<<<<<<<<<<<<
 *         if next_line == NULL:
 *             raise ValueError('null line\n')
 */
    __pyx_v_next_line = ((char *)memchr(__pyx_v_cur, '\n', (__pyx_v_end - __pyx_v_cur)));

    /* "bzrlib/_chk_map_pyx.pyx":254
 *         line_start = cur
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('null line\n')
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 */
    __pyx_t_2 = ((__pyx_v_next_line == NULL) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":255
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:
 *             raise ValueError('null line\n')             # <<<<<<<<<<<<<<
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, 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_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":254
 *         line_start = cur
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('null line\n')
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":256
 *         if next_line == NULL:
 *             raise ValueError('null line\n')
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)             # <<<<<<<<<<<<<<
 *         if last_null == NULL:
 *             raise ValueError('fail to find the num value lines null')
 */
    __pyx_v_last_null = ((char *)__pyx_f_6bzrlib_12_chk_map_pyx__my_memrchr(__pyx_v_cur, '\x00', (__pyx_v_next_line - __pyx_v_cur)));

    /* "bzrlib/_chk_map_pyx.pyx":257
 *             raise ValueError('null line\n')
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('fail to find the num value lines null')
 *         next_null = last_null + 1 # move past NULL
 */
    __pyx_t_2 = ((__pyx_v_last_null == NULL) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":258
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:
 *             raise ValueError('fail to find the num value lines null')             # <<<<<<<<<<<<<<
 *         next_null = last_null + 1 # move past NULL
 *         num_value_lines = _get_int_from_line(&next_null, next_line + 1,
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":257
 *             raise ValueError('null line\n')
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('fail to find the num value lines null')
 *         next_null = last_null + 1 # move past NULL
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":259
 *         if last_null == NULL:
 *             raise ValueError('fail to find the num value lines null')
 *         next_null = last_null + 1 # move past NULL             # <<<<<<<<<<<<<<
 *         num_value_lines = _get_int_from_line(&next_null, next_line + 1,
 *                                              "num value lines")
 */
    __pyx_v_next_null = (__pyx_v_last_null + 1);

    /* "bzrlib/_chk_map_pyx.pyx":260
 *             raise ValueError('fail to find the num value lines null')
 *         next_null = last_null + 1 # move past NULL
 *         num_value_lines = _get_int_from_line(&next_null, next_line + 1,             # <<<<<<<<<<<<<<
 *                                              "num value lines")
 *         cur = next_line + 1
 */
    __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_next_null), (__pyx_v_next_line + 1), __pyx_k_num_value_lines); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_num_value_lines = __pyx_t_5;

    /* "bzrlib/_chk_map_pyx.pyx":262
 *         num_value_lines = _get_int_from_line(&next_null, next_line + 1,
 *                                              "num value lines")
 *         cur = next_line + 1             # <<<<<<<<<<<<<<
 *         value_start = cur
 *         # Walk num_value_lines forward
 */
    __pyx_v_cur = (__pyx_v_next_line + 1);

    /* "bzrlib/_chk_map_pyx.pyx":263
 *                                              "num value lines")
 *         cur = next_line + 1
 *         value_start = cur             # <<<<<<<<<<<<<<
 *         # Walk num_value_lines forward
 *         for i from 0 <= i < num_value_lines:
 */
    __pyx_v_value_start = __pyx_v_cur;

    /* "bzrlib/_chk_map_pyx.pyx":265
 *         value_start = cur
 *         # Walk num_value_lines forward
 *         for i from 0 <= i < num_value_lines:             # <<<<<<<<<<<<<<
 *             next_line = <char *>memchr(cur, c'\n', end - cur)
 *             if next_line == NULL:
 */
    __pyx_t_5 = __pyx_v_num_value_lines;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

      /* "bzrlib/_chk_map_pyx.pyx":266
 *         # Walk num_value_lines forward
 *         for i from 0 <= i < num_value_lines:
 *             next_line = <char *>memchr(cur, c'\n', end - cur)             # <<<<<<<<<<<<<<
 *             if next_line == NULL:
 *                 raise ValueError('missing trailing newline')
 */
      __pyx_v_next_line = ((char *)memchr(__pyx_v_cur, '\n', (__pyx_v_end - __pyx_v_cur)));

      /* "bzrlib/_chk_map_pyx.pyx":267
 *         for i from 0 <= i < num_value_lines:
 *             next_line = <char *>memchr(cur, c'\n', end - cur)
 *             if next_line == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('missing trailing newline')
 *             cur = next_line + 1
 */
      __pyx_t_2 = ((__pyx_v_next_line == NULL) != 0);
      if (__pyx_t_2) {

        /* "bzrlib/_chk_map_pyx.pyx":268
 *             next_line = <char *>memchr(cur, c'\n', end - cur)
 *             if next_line == NULL:
 *                 raise ValueError('missing trailing newline')             # <<<<<<<<<<<<<<
 *             cur = next_line + 1
 *         entry_bits = StaticTuple_New(width)
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "bzrlib/_chk_map_pyx.pyx":267
 *         for i from 0 <= i < num_value_lines:
 *             next_line = <char *>memchr(cur, c'\n', end - cur)
 *             if next_line == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('missing trailing newline')
 *             cur = next_line + 1
 */
      }

      /* "bzrlib/_chk_map_pyx.pyx":269
 *             if next_line == NULL:
 *                 raise ValueError('missing trailing newline')
 *             cur = next_line + 1             # <<<<<<<<<<<<<<
 *         entry_bits = StaticTuple_New(width)
 *         for i from 0 <= i < num_prefix_bits:
 */
      __pyx_v_cur = (__pyx_v_next_line + 1);
    }

    /* "bzrlib/_chk_map_pyx.pyx":270
 *                 raise ValueError('missing trailing newline')
 *             cur = next_line + 1
 *         entry_bits = StaticTuple_New(width)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < num_prefix_bits:
 *             # TODO: Use PyList_GetItem, or turn prefix_bits into a
 */
    __pyx_t_3 = ((PyObject *)StaticTuple_New(__pyx_v_width)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_entry_bits, ((StaticTuple *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":271
 *             cur = next_line + 1
 *         entry_bits = StaticTuple_New(width)
 *         for i from 0 <= i < num_prefix_bits:             # <<<<<<<<<<<<<<
 *             # TODO: Use PyList_GetItem, or turn prefix_bits into a
 *             #       tuple/StaticTuple
 */
    __pyx_t_5 = __pyx_v_num_prefix_bits;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) {

      /* "bzrlib/_chk_map_pyx.pyx":274
 *             # TODO: Use PyList_GetItem, or turn prefix_bits into a
 *             #       tuple/StaticTuple
 *             entry = prefix_bits[i]             # <<<<<<<<<<<<<<
 *             # SET_ITEM 'steals' a reference
 *             Py_INCREF(entry)
 */
      __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_prefix_bits, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "bzrlib/_chk_map_pyx.pyx":276
 *             entry = prefix_bits[i]
 *             # SET_ITEM 'steals' a reference
 *             Py_INCREF(entry)             # <<<<<<<<<<<<<<
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         value = PyString_FromStringAndSize(value_start, next_line - value_start)
 */
      Py_INCREF(__pyx_v_entry);

      /* "bzrlib/_chk_map_pyx.pyx":277
 *             # SET_ITEM 'steals' a reference
 *             Py_INCREF(entry)
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)             # <<<<<<<<<<<<<<
 *         value = PyString_FromStringAndSize(value_start, next_line - value_start)
 *         # The next entry bit needs the 'tail' from the prefix, and first part
 */
      StaticTuple_SET_ITEM(__pyx_v_entry_bits, __pyx_v_i, __pyx_v_entry);
    }

    /* "bzrlib/_chk_map_pyx.pyx":278
 *             Py_INCREF(entry)
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         value = PyString_FromStringAndSize(value_start, next_line - value_start)             # <<<<<<<<<<<<<<
 *         # The next entry bit needs the 'tail' from the prefix, and first part
 *         # of the line
 */
    __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_value_start, (__pyx_v_next_line - __pyx_v_value_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":281
 *         # The next entry bit needs the 'tail' from the prefix, and first part
 *         # of the line
 *         entry_start = line_start             # <<<<<<<<<<<<<<
 *         next_null = <char *>memchr(entry_start, c'\0',
 *                                    last_null - entry_start + 1)
 */
    __pyx_v_entry_start = __pyx_v_line_start;

    /* "bzrlib/_chk_map_pyx.pyx":282
 *         # of the line
 *         entry_start = line_start
 *         next_null = <char *>memchr(entry_start, c'\0',             # <<<<<<<<<<<<<<
 *                                    last_null - entry_start + 1)
 *         if next_null == NULL:
 */
    __pyx_v_next_null = ((char *)memchr(__pyx_v_entry_start, '\x00', ((__pyx_v_last_null - __pyx_v_entry_start) + 1)));

    /* "bzrlib/_chk_map_pyx.pyx":284
 *         next_null = <char *>memchr(entry_start, c'\0',
 *                                    last_null - entry_start + 1)
 *         if next_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('bad no null, bad')
 *         entry = PyString_FromStringAndSize(NULL,
 */
    __pyx_t_2 = ((__pyx_v_next_null == NULL) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":285
 *                                    last_null - entry_start + 1)
 *         if next_null == NULL:
 *             raise ValueError('bad no null, bad')             # <<<<<<<<<<<<<<
 *         entry = PyString_FromStringAndSize(NULL,
 *                     prefix_tail_len + next_null - line_start)
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":284
 *         next_null = <char *>memchr(entry_start, c'\0',
 *                                    last_null - entry_start + 1)
 *         if next_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('bad no null, bad')
 *         entry = PyString_FromStringAndSize(NULL,
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":286
 *         if next_null == NULL:
 *             raise ValueError('bad no null, bad')
 *         entry = PyString_FromStringAndSize(NULL,             # <<<<<<<<<<<<<<
 *                     prefix_tail_len + next_null - line_start)
 *         c_entry = PyString_AS_STRING(entry)
 */
    __pyx_t_3 = PyString_FromStringAndSize(NULL, ((__pyx_v_prefix_tail_len + __pyx_v_next_null) - __pyx_v_line_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":288
 *         entry = PyString_FromStringAndSize(NULL,
 *                     prefix_tail_len + next_null - line_start)
 *         c_entry = PyString_AS_STRING(entry)             # <<<<<<<<<<<<<<
 *         if prefix_tail_len > 0:
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 */
    __pyx_v_c_entry = PyString_AS_STRING(__pyx_v_entry);

    /* "bzrlib/_chk_map_pyx.pyx":289
 *                     prefix_tail_len + next_null - line_start)
 *         c_entry = PyString_AS_STRING(entry)
 *         if prefix_tail_len > 0:             # <<<<<<<<<<<<<<
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 *         if next_null - line_start > 0:
 */
    __pyx_t_2 = ((__pyx_v_prefix_tail_len > 0) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":290
 *         c_entry = PyString_AS_STRING(entry)
 *         if prefix_tail_len > 0:
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)             # <<<<<<<<<<<<<<
 *         if next_null - line_start > 0:
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)
 */
      memcpy(__pyx_v_c_entry, __pyx_v_prefix_tail, __pyx_v_prefix_tail_len);

      /* "bzrlib/_chk_map_pyx.pyx":289
 *                     prefix_tail_len + next_null - line_start)
 *         c_entry = PyString_AS_STRING(entry)
 *         if prefix_tail_len > 0:             # <<<<<<<<<<<<<<
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 *         if next_null - line_start > 0:
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":291
 *         if prefix_tail_len > 0:
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 *         if next_null - line_start > 0:             # <<<<<<<<<<<<<<
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)
 *         Py_INCREF(entry)
 */
    __pyx_t_2 = (((__pyx_v_next_null - __pyx_v_line_start) > 0) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":292
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 *         if next_null - line_start > 0:
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)             # <<<<<<<<<<<<<<
 *         Py_INCREF(entry)
 *         i = num_prefix_bits
 */
      memcpy((__pyx_v_c_entry + __pyx_v_prefix_tail_len), __pyx_v_line_start, (__pyx_v_next_null - __pyx_v_line_start));

      /* "bzrlib/_chk_map_pyx.pyx":291
 *         if prefix_tail_len > 0:
 *             memcpy(c_entry, prefix_tail, prefix_tail_len)
 *         if next_null - line_start > 0:             # <<<<<<<<<<<<<<
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)
 *         Py_INCREF(entry)
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":293
 *         if next_null - line_start > 0:
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)
 *         Py_INCREF(entry)             # <<<<<<<<<<<<<<
 *         i = num_prefix_bits
 *         StaticTuple_SET_ITEM(entry_bits, i, entry)
 */
    Py_INCREF(__pyx_v_entry);

    /* "bzrlib/_chk_map_pyx.pyx":294
 *             memcpy(c_entry + prefix_tail_len, line_start, next_null - line_start)
 *         Py_INCREF(entry)
 *         i = num_prefix_bits             # <<<<<<<<<<<<<<
 *         StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         while next_null != last_null: # We have remaining bits
 */
    __pyx_v_i = __pyx_v_num_prefix_bits;

    /* "bzrlib/_chk_map_pyx.pyx":295
 *         Py_INCREF(entry)
 *         i = num_prefix_bits
 *         StaticTuple_SET_ITEM(entry_bits, i, entry)             # <<<<<<<<<<<<<<
 *         while next_null != last_null: # We have remaining bits
 *             i = i + 1
 */
    StaticTuple_SET_ITEM(__pyx_v_entry_bits, __pyx_v_i, __pyx_v_entry);

    /* "bzrlib/_chk_map_pyx.pyx":296
 *         i = num_prefix_bits
 *         StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         while next_null != last_null: # We have remaining bits             # <<<<<<<<<<<<<<
 *             i = i + 1
 *             if i > width:
 */
    while (1) {
      __pyx_t_2 = ((__pyx_v_next_null != __pyx_v_last_null) != 0);
      if (!__pyx_t_2) break;

      /* "bzrlib/_chk_map_pyx.pyx":297
 *         StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         while next_null != last_null: # We have remaining bits
 *             i = i + 1             # <<<<<<<<<<<<<<
 *             if i > width:
 *                 raise ValueError("Too many bits for entry")
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "bzrlib/_chk_map_pyx.pyx":298
 *         while next_null != last_null: # We have remaining bits
 *             i = i + 1
 *             if i > width:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Too many bits for entry")
 *             entry_start = next_null + 1
 */
      __pyx_t_2 = ((__pyx_v_i > __pyx_v_width) != 0);
      if (__pyx_t_2) {

        /* "bzrlib/_chk_map_pyx.pyx":299
 *             i = i + 1
 *             if i > width:
 *                 raise ValueError("Too many bits for entry")             # <<<<<<<<<<<<<<
 *             entry_start = next_null + 1
 *             next_null = <char *>memchr(entry_start, c'\0',
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "bzrlib/_chk_map_pyx.pyx":298
 *         while next_null != last_null: # We have remaining bits
 *             i = i + 1
 *             if i > width:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Too many bits for entry")
 *             entry_start = next_null + 1
 */
      }

      /* "bzrlib/_chk_map_pyx.pyx":300
 *             if i > width:
 *                 raise ValueError("Too many bits for entry")
 *             entry_start = next_null + 1             # <<<<<<<<<<<<<<
 *             next_null = <char *>memchr(entry_start, c'\0',
 *                                        last_null - entry_start + 1)
 */
      __pyx_v_entry_start = (__pyx_v_next_null + 1);

      /* "bzrlib/_chk_map_pyx.pyx":301
 *                 raise ValueError("Too many bits for entry")
 *             entry_start = next_null + 1
 *             next_null = <char *>memchr(entry_start, c'\0',             # <<<<<<<<<<<<<<
 *                                        last_null - entry_start + 1)
 *             if next_null == NULL:
 */
      __pyx_v_next_null = ((char *)memchr(__pyx_v_entry_start, '\x00', ((__pyx_v_last_null - __pyx_v_entry_start) + 1)));

      /* "bzrlib/_chk_map_pyx.pyx":303
 *             next_null = <char *>memchr(entry_start, c'\0',
 *                                        last_null - entry_start + 1)
 *             if next_null == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('bad no null')
 *             entry = PyString_FromStringAndSize(entry_start,
 */
      __pyx_t_2 = ((__pyx_v_next_null == NULL) != 0);
      if (__pyx_t_2) {

        /* "bzrlib/_chk_map_pyx.pyx":304
 *                                        last_null - entry_start + 1)
 *             if next_null == NULL:
 *                 raise ValueError('bad no null')             # <<<<<<<<<<<<<<
 *             entry = PyString_FromStringAndSize(entry_start,
 *                                                next_null - entry_start)
 */
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "bzrlib/_chk_map_pyx.pyx":303
 *             next_null = <char *>memchr(entry_start, c'\0',
 *                                        last_null - entry_start + 1)
 *             if next_null == NULL:             # <<<<<<<<<<<<<<
 *                 raise ValueError('bad no null')
 *             entry = PyString_FromStringAndSize(entry_start,
 */
      }

      /* "bzrlib/_chk_map_pyx.pyx":305
 *             if next_null == NULL:
 *                 raise ValueError('bad no null')
 *             entry = PyString_FromStringAndSize(entry_start,             # <<<<<<<<<<<<<<
 *                                                next_null - entry_start)
 *             Py_INCREF(entry)
 */
      __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_entry_start, (__pyx_v_next_null - __pyx_v_entry_start)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_entry, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "bzrlib/_chk_map_pyx.pyx":307
 *             entry = PyString_FromStringAndSize(entry_start,
 *                                                next_null - entry_start)
 *             Py_INCREF(entry)             # <<<<<<<<<<<<<<
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         if StaticTuple_GET_SIZE(entry_bits) != width:
 */
      Py_INCREF(__pyx_v_entry);

      /* "bzrlib/_chk_map_pyx.pyx":308
 *                                                next_null - entry_start)
 *             Py_INCREF(entry)
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)             # <<<<<<<<<<<<<<
 *         if StaticTuple_GET_SIZE(entry_bits) != width:
 *             raise AssertionError(
 */
      StaticTuple_SET_ITEM(__pyx_v_entry_bits, __pyx_v_i, __pyx_v_entry);
    }

    /* "bzrlib/_chk_map_pyx.pyx":309
 *             Py_INCREF(entry)
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         if StaticTuple_GET_SIZE(entry_bits) != width:             # <<<<<<<<<<<<<<
 *             raise AssertionError(
 *                 'Incorrect number of elements (%d vs %d)'
 */
    __pyx_t_2 = ((StaticTuple_GET_SIZE(__pyx_v_entry_bits) != __pyx_v_width) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":312
 *             raise AssertionError(
 *                 'Incorrect number of elements (%d vs %d)'
 *                 % (len(entry_bits)+1, width + 1))             # <<<<<<<<<<<<<<
 *         entry_bits = StaticTuple_Intern(entry_bits)
 *         PyDict_SetItem(items, entry_bits, value)
 */
      __pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_entry_bits)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_7 + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_width + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incorrect_number_of_elements_d_v, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "bzrlib/_chk_map_pyx.pyx":310
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         if StaticTuple_GET_SIZE(entry_bits) != width:
 *             raise AssertionError(             # <<<<<<<<<<<<<<
 *                 'Incorrect number of elements (%d vs %d)'
 *                 % (len(entry_bits)+1, width + 1))
 */
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":309
 *             Py_INCREF(entry)
 *             StaticTuple_SET_ITEM(entry_bits, i, entry)
 *         if StaticTuple_GET_SIZE(entry_bits) != width:             # <<<<<<<<<<<<<<
 *             raise AssertionError(
 *                 'Incorrect number of elements (%d vs %d)'
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":313
 *                 'Incorrect number of elements (%d vs %d)'
 *                 % (len(entry_bits)+1, width + 1))
 *         entry_bits = StaticTuple_Intern(entry_bits)             # <<<<<<<<<<<<<<
 *         PyDict_SetItem(items, entry_bits, value)
 *     if len(items) != length:
 */
    __pyx_t_4 = ((PyObject *)StaticTuple_Intern(__pyx_v_entry_bits)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_entry_bits, ((StaticTuple *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":314
 *                 % (len(entry_bits)+1, width + 1))
 *         entry_bits = StaticTuple_Intern(entry_bits)
 *         PyDict_SetItem(items, entry_bits, value)             # <<<<<<<<<<<<<<
 *     if len(items) != length:
 *         raise ValueError("item count (%d) mismatch for key %s,"
 */
    __pyx_t_5 = PyDict_SetItem(__pyx_v_items, ((PyObject *)__pyx_v_entry_bits), __pyx_v_value); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "bzrlib/_chk_map_pyx.pyx":315
 *         entry_bits = StaticTuple_Intern(entry_bits)
 *         PyDict_SetItem(items, entry_bits, value)
 *     if len(items) != length:             # <<<<<<<<<<<<<<
 *         raise ValueError("item count (%d) mismatch for key %s,"
 *                          " bytes %r" % (length, entry_bits, bytes))
 */
  __pyx_t_7 = PyDict_Size(__pyx_v_items); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((__pyx_t_7 != __pyx_v_length) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":317
 *     if len(items) != length:
 *         raise ValueError("item count (%d) mismatch for key %s,"
 *                          " bytes %r" % (length, entry_bits, bytes))             # <<<<<<<<<<<<<<
 *     result._items = items
 *     result._len = length
 */
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (unlikely(!__pyx_v_entry_bits)) { __Pyx_RaiseUnboundLocalError("entry_bits"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_v_entry_bits));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_entry_bits));
    PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_entry_bits));
    __Pyx_INCREF(__pyx_v_bytes);
    __Pyx_GIVEREF(__pyx_v_bytes);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_bytes);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_item_count_d_mismatch_for_key_s, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":316
 *         PyDict_SetItem(items, entry_bits, value)
 *     if len(items) != length:
 *         raise ValueError("item count (%d) mismatch for key %s,"             # <<<<<<<<<<<<<<
 *                          " bytes %r" % (length, entry_bits, bytes))
 *     result._items = items
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":315
 *         entry_bits = StaticTuple_Intern(entry_bits)
 *         PyDict_SetItem(items, entry_bits, value)
 *     if len(items) != length:             # <<<<<<<<<<<<<<
 *         raise ValueError("item count (%d) mismatch for key %s,"
 *                          " bytes %r" % (length, entry_bits, bytes))
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":318
 *         raise ValueError("item count (%d) mismatch for key %s,"
 *                          " bytes %r" % (length, entry_bits, bytes))
 *     result._items = items             # <<<<<<<<<<<<<<
 *     result._len = length
 *     result._maximum_size = maximum_size
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_items, __pyx_v_items) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":319
 *                          " bytes %r" % (length, entry_bits, bytes))
 *     result._items = items
 *     result._len = length             # <<<<<<<<<<<<<<
 *     result._maximum_size = maximum_size
 *     result._key = key
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_len, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":320
 *     result._items = items
 *     result._len = length
 *     result._maximum_size = maximum_size             # <<<<<<<<<<<<<<
 *     result._key = key
 *     result._key_width = width
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_maximum_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_maximum_size_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":321
 *     result._len = length
 *     result._maximum_size = maximum_size
 *     result._key = key             # <<<<<<<<<<<<<<
 *     result._key_width = width
 *     result._raw_size = items_length + length * prefix_length
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_key_2, __pyx_v_key) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":322
 *     result._maximum_size = maximum_size
 *     result._key = key
 *     result._key_width = width             # <<<<<<<<<<<<<<
 *     result._raw_size = items_length + length * prefix_length
 *     if length == 0:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_key_width, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":323
 *     result._key = key
 *     result._key_width = width
 *     result._raw_size = items_length + length * prefix_length             # <<<<<<<<<<<<<<
 *     if length == 0:
 *         result._search_prefix = None
 */
  __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_items_length + (__pyx_v_length * __pyx_v_prefix_length))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_raw_size, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":324
 *     result._key_width = width
 *     result._raw_size = items_length + length * prefix_length
 *     if length == 0:             # <<<<<<<<<<<<<<
 *         result._search_prefix = None
 *         result._common_serialised_prefix = None
 */
  __pyx_t_2 = ((__pyx_v_length == 0) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":325
 *     result._raw_size = items_length + length * prefix_length
 *     if length == 0:
 *         result._search_prefix = None             # <<<<<<<<<<<<<<
 *         result._common_serialised_prefix = None
 *     else:
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_search_prefix, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":326
 *     if length == 0:
 *         result._search_prefix = None
 *         result._common_serialised_prefix = None             # <<<<<<<<<<<<<<
 *     else:
 *         result._search_prefix = _unknown
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_common_serialised_prefix, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":324
 *     result._key_width = width
 *     result._raw_size = items_length + length * prefix_length
 *     if length == 0:             # <<<<<<<<<<<<<<
 *         result._search_prefix = None
 *         result._common_serialised_prefix = None
 */
    goto __pyx_L31;
  }

  /* "bzrlib/_chk_map_pyx.pyx":328
 *         result._common_serialised_prefix = None
 *     else:
 *         result._search_prefix = _unknown             # <<<<<<<<<<<<<<
 *         result._common_serialised_prefix = PyString_FromStringAndSize(prefix,
 *                                                 prefix_length)
 */
  /*else*/ {
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_search_prefix, __pyx_v_6bzrlib_12_chk_map_pyx__unknown) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":329
 *     else:
 *         result._search_prefix = _unknown
 *         result._common_serialised_prefix = PyString_FromStringAndSize(prefix,             # <<<<<<<<<<<<<<
 *                                                 prefix_length)
 *     if c_bytes_len != result._current_size():
 */
    __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_prefix, __pyx_v_prefix_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_common_serialised_prefix, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L31:;

  /* "bzrlib/_chk_map_pyx.pyx":331
 *         result._common_serialised_prefix = PyString_FromStringAndSize(prefix,
 *                                                 prefix_length)
 *     if c_bytes_len != result._current_size():             # <<<<<<<<<<<<<<
 *         raise AssertionError('_current_size computed incorrectly %d != %d',
 *             c_bytes_len, result._current_size())
 */
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_c_bytes_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_current_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_9) {
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else {
    __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":333
 *     if c_bytes_len != result._current_size():
 *         raise AssertionError('_current_size computed incorrectly %d != %d',
 *             c_bytes_len, result._current_size())             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
    __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_c_bytes_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_current_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":332
 *                                                 prefix_length)
 *     if c_bytes_len != result._current_size():
 *         raise AssertionError('_current_size computed incorrectly %d != %d',             # <<<<<<<<<<<<<<
 *             c_bytes_len, result._current_size())
 *     return result
 */
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_kp_s_current_size_computed_incorrect);
    __Pyx_GIVEREF(__pyx_kp_s_current_size_computed_incorrect);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_s_current_size_computed_incorrect);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_8);
    __pyx_t_3 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_AssertionError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_8, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":331
 *         result._common_serialised_prefix = PyString_FromStringAndSize(prefix,
 *                                                 prefix_length)
 *     if c_bytes_len != result._current_size():             # <<<<<<<<<<<<<<
 *         raise AssertionError('_current_size computed incorrectly %d != %d',
 *             c_bytes_len, result._current_size())
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":334
 *         raise AssertionError('_current_size computed incorrectly %d != %d',
 *             c_bytes_len, result._current_size())
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":188
 * 
 * 
 * def _deserialise_leaf_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     """Deserialise bytes, with key key, into a LeafNode.
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._deserialise_leaf_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_entry_bits);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_prefix_bits);
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":337
 * 
 * 
 * def _deserialise_internal_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     cdef char *c_bytes, *cur, *next, *end
 *     cdef char *next_line
 */

/* Python wrapper */
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_7_deserialise_internal_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6bzrlib_12_chk_map_pyx_7_deserialise_internal_node = {"_deserialise_internal_node", (PyCFunction)__pyx_pw_6bzrlib_12_chk_map_pyx_7_deserialise_internal_node, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_7_deserialise_internal_node(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bytes = 0;
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_search_key_func = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_deserialise_internal_node (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bytes,&__pyx_n_s_key,&__pyx_n_s_search_key_func,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bytes)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_key)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_deserialise_internal_node", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_search_key_func);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_deserialise_internal_node") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bytes = values[0];
    __pyx_v_key = values[1];
    __pyx_v_search_key_func = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_deserialise_internal_node", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._deserialise_internal_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6bzrlib_12_chk_map_pyx_6_deserialise_internal_node(__pyx_self, __pyx_v_bytes, __pyx_v_key, __pyx_v_search_key_func);

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

static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_6_deserialise_internal_node(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes, PyObject *__pyx_v_key, PyObject *__pyx_v_search_key_func) {
  char *__pyx_v_c_bytes;
  char *__pyx_v_cur;
  char *__pyx_v_end;
  char *__pyx_v_next_line;
  Py_ssize_t __pyx_v_c_bytes_len;
  Py_ssize_t __pyx_v_prefix_length;
  int __pyx_v_maximum_size;
  int __pyx_v_width;
  int __pyx_v_length;
  char *__pyx_v_prefix;
  char *__pyx_v_next_null;
  char *__pyx_v_c_item_prefix;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_v_item_prefix = NULL;
  PyObject *__pyx_v_flat_key = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_deserialise_internal_node", 0);

  /* "bzrlib/_chk_map_pyx.pyx":344
 *     cdef char *prefix, *line_prefix, *next_null, *c_item_prefix
 * 
 *     if _InternalNode is None:             # <<<<<<<<<<<<<<
 *         _import_globals()
 *     result = _InternalNode(search_key_func=search_key_func)
 */
  __pyx_t_1 = (__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":345
 * 
 *     if _InternalNode is None:
 *         _import_globals()             # <<<<<<<<<<<<<<
 *     result = _InternalNode(search_key_func=search_key_func)
 * 
 */
    __pyx_t_3 = __pyx_f_6bzrlib_12_chk_map_pyx__import_globals(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":344
 *     cdef char *prefix, *line_prefix, *next_null, *c_item_prefix
 * 
 *     if _InternalNode is None:             # <<<<<<<<<<<<<<
 *         _import_globals()
 *     result = _InternalNode(search_key_func=search_key_func)
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":346
 *     if _InternalNode is None:
 *         _import_globals()
 *     result = _InternalNode(search_key_func=search_key_func)             # <<<<<<<<<<<<<<
 * 
 *     if not StaticTuple_CheckExact(key):
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_search_key_func, __pyx_v_search_key_func) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":348
 *     result = _InternalNode(search_key_func=search_key_func)
 * 
 *     if not StaticTuple_CheckExact(key):             # <<<<<<<<<<<<<<
 *         raise TypeError('key %r is not a StaticTuple' % (key,))
 *     if not PyString_CheckExact(bytes):
 */
  __pyx_t_2 = ((!(StaticTuple_CheckExact(__pyx_v_key) != 0)) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":349
 * 
 *     if not StaticTuple_CheckExact(key):
 *         raise TypeError('key %r is not a StaticTuple' % (key,))             # <<<<<<<<<<<<<<
 *     if not PyString_CheckExact(bytes):
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_key);
    __Pyx_GIVEREF(__pyx_v_key);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_key);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_key_r_is_not_a_StaticTuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":348
 *     result = _InternalNode(search_key_func=search_key_func)
 * 
 *     if not StaticTuple_CheckExact(key):             # <<<<<<<<<<<<<<
 *         raise TypeError('key %r is not a StaticTuple' % (key,))
 *     if not PyString_CheckExact(bytes):
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":350
 *     if not StaticTuple_CheckExact(key):
 *         raise TypeError('key %r is not a StaticTuple' % (key,))
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 */
  __pyx_t_2 = ((!(PyString_CheckExact(__pyx_v_bytes) != 0)) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":351
 *         raise TypeError('key %r is not a StaticTuple' % (key,))
 *     if not PyString_CheckExact(bytes):
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))             # <<<<<<<<<<<<<<
 * 
 *     c_bytes = PyString_AS_STRING(bytes)
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_bytes_must_be_a_plain_string_not, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":350
 *     if not StaticTuple_CheckExact(key):
 *         raise TypeError('key %r is not a StaticTuple' % (key,))
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":353
 *         raise TypeError('bytes must be a plain string not %s' % (type(bytes),))
 * 
 *     c_bytes = PyString_AS_STRING(bytes)             # <<<<<<<<<<<<<<
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 */
  __pyx_v_c_bytes = PyString_AS_STRING(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":354
 * 
 *     c_bytes = PyString_AS_STRING(bytes)
 *     c_bytes_len = PyString_GET_SIZE(bytes)             # <<<<<<<<<<<<<<
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:
 */
  __pyx_v_c_bytes_len = PyString_GET_SIZE(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":356
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:             # <<<<<<<<<<<<<<
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 */
  __pyx_t_1 = ((__pyx_v_c_bytes_len < 9) != 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_1 = ((memcmp(__pyx_v_c_bytes, __pyx_k_chknode, 9) != 0) != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":357
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:
 *         raise ValueError("not a serialised internal node: %r" % bytes)             # <<<<<<<<<<<<<<
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")
 */
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_not_a_serialised_internal_node_r, __pyx_v_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":356
 *     c_bytes_len = PyString_GET_SIZE(bytes)
 * 
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:             # <<<<<<<<<<<<<<
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":358
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':             # <<<<<<<<<<<<<<
 *         raise ValueError("bytes does not end in a newline")
 * 
 */
  __pyx_t_2 = (((__pyx_v_c_bytes[(__pyx_v_c_bytes_len - 1)]) != '\n') != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":359
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")             # <<<<<<<<<<<<<<
 * 
 *     items = {}
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":358
 *     if c_bytes_len < 9 or memcmp(c_bytes, "chknode:\n", 9) != 0:
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':             # <<<<<<<<<<<<<<
 *         raise ValueError("bytes does not end in a newline")
 * 
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":361
 *         raise ValueError("bytes does not end in a newline")
 * 
 *     items = {}             # <<<<<<<<<<<<<<
 *     cur = c_bytes + 9
 *     end = c_bytes + c_bytes_len
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_items = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":362
 * 
 *     items = {}
 *     cur = c_bytes + 9             # <<<<<<<<<<<<<<
 *     end = c_bytes + c_bytes_len
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 */
  __pyx_v_cur = (__pyx_v_c_bytes + 9);

  /* "bzrlib/_chk_map_pyx.pyx":363
 *     items = {}
 *     cur = c_bytes + 9
 *     end = c_bytes + c_bytes_len             # <<<<<<<<<<<<<<
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")
 */
  __pyx_v_end = (__pyx_v_c_bytes + __pyx_v_c_bytes_len);

  /* "bzrlib/_chk_map_pyx.pyx":364
 *     cur = c_bytes + 9
 *     end = c_bytes + c_bytes_len
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")             # <<<<<<<<<<<<<<
 *     width = _get_int_from_line(&cur, end, "width")
 *     length = _get_int_from_line(&cur, end, "length")
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_maximum_size); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_maximum_size = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":365
 *     end = c_bytes + c_bytes_len
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")             # <<<<<<<<<<<<<<
 *     length = _get_int_from_line(&cur, end, "length")
 * 
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_width); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_width = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":366
 *     maximum_size = _get_int_from_line(&cur, end, "maximum_size")
 *     width = _get_int_from_line(&cur, end, "width")
 *     length = _get_int_from_line(&cur, end, "length")             # <<<<<<<<<<<<<<
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 */
  __pyx_t_5 = __pyx_f_6bzrlib_12_chk_map_pyx__get_int_from_line((&__pyx_v_cur), __pyx_v_end, __pyx_k_length); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_length = __pyx_t_5;

  /* "bzrlib/_chk_map_pyx.pyx":368
 *     length = _get_int_from_line(&cur, end, "length")
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)             # <<<<<<<<<<<<<<
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')
 */
  __pyx_v_next_line = ((char *)memchr(__pyx_v_cur, '\n', (__pyx_v_end - __pyx_v_cur)));

  /* "bzrlib/_chk_map_pyx.pyx":369
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 */
  __pyx_t_2 = ((__pyx_v_next_line == NULL) != 0);
  if (__pyx_t_2) {

    /* "bzrlib/_chk_map_pyx.pyx":370
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')             # <<<<<<<<<<<<<<
 *     prefix = cur
 *     prefix_length = next_line - cur
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":369
 * 
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":371
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur             # <<<<<<<<<<<<<<
 *     prefix_length = next_line - cur
 *     cur = next_line + 1
 */
  __pyx_v_prefix = __pyx_v_cur;

  /* "bzrlib/_chk_map_pyx.pyx":372
 *         raise ValueError('Missing the prefix line\n')
 *     prefix = cur
 *     prefix_length = next_line - cur             # <<<<<<<<<<<<<<
 *     cur = next_line + 1
 * 
 */
  __pyx_v_prefix_length = (__pyx_v_next_line - __pyx_v_cur);

  /* "bzrlib/_chk_map_pyx.pyx":373
 *     prefix = cur
 *     prefix_length = next_line - cur
 *     cur = next_line + 1             # <<<<<<<<<<<<<<
 * 
 *     while cur < end:
 */
  __pyx_v_cur = (__pyx_v_next_line + 1);

  /* "bzrlib/_chk_map_pyx.pyx":375
 *     cur = next_line + 1
 * 
 *     while cur < end:             # <<<<<<<<<<<<<<
 *         # Find the null separator
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_cur < __pyx_v_end) != 0);
    if (!__pyx_t_2) break;

    /* "bzrlib/_chk_map_pyx.pyx":377
 *     while cur < end:
 *         # Find the null separator
 *         next_line = <char *>memchr(cur, c'\n', end - cur)             # <<<<<<<<<<<<<<
 *         if next_line == NULL:
 *             raise ValueError('missing trailing newline')
 */
    __pyx_v_next_line = ((char *)memchr(__pyx_v_cur, '\n', (__pyx_v_end - __pyx_v_cur)));

    /* "bzrlib/_chk_map_pyx.pyx":378
 *         # Find the null separator
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('missing trailing newline')
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 */
    __pyx_t_2 = ((__pyx_v_next_line == NULL) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":379
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:
 *             raise ValueError('missing trailing newline')             # <<<<<<<<<<<<<<
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":378
 *         # Find the null separator
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('missing trailing newline')
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":380
 *         if next_line == NULL:
 *             raise ValueError('missing trailing newline')
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)             # <<<<<<<<<<<<<<
 *         if next_null == NULL:
 *             raise ValueError('bad no null')
 */
    __pyx_v_next_null = ((char *)__pyx_f_6bzrlib_12_chk_map_pyx__my_memrchr(__pyx_v_cur, '\x00', (__pyx_v_next_line - __pyx_v_cur)));

    /* "bzrlib/_chk_map_pyx.pyx":381
 *             raise ValueError('missing trailing newline')
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('bad no null')
 *         item_prefix = PyString_FromStringAndSize(NULL,
 */
    __pyx_t_2 = ((__pyx_v_next_null == NULL) != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":382
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:
 *             raise ValueError('bad no null')             # <<<<<<<<<<<<<<
 *         item_prefix = PyString_FromStringAndSize(NULL,
 *             prefix_length + next_null - cur)
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "bzrlib/_chk_map_pyx.pyx":381
 *             raise ValueError('missing trailing newline')
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:             # <<<<<<<<<<<<<<
 *             raise ValueError('bad no null')
 *         item_prefix = PyString_FromStringAndSize(NULL,
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":383
 *         if next_null == NULL:
 *             raise ValueError('bad no null')
 *         item_prefix = PyString_FromStringAndSize(NULL,             # <<<<<<<<<<<<<<
 *             prefix_length + next_null - cur)
 *         c_item_prefix = PyString_AS_STRING(item_prefix)
 */
    __pyx_t_4 = PyString_FromStringAndSize(NULL, ((__pyx_v_prefix_length + __pyx_v_next_null) - __pyx_v_cur)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_item_prefix, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":385
 *         item_prefix = PyString_FromStringAndSize(NULL,
 *             prefix_length + next_null - cur)
 *         c_item_prefix = PyString_AS_STRING(item_prefix)             # <<<<<<<<<<<<<<
 *         if prefix_length:
 *             memcpy(c_item_prefix, prefix, prefix_length)
 */
    __pyx_v_c_item_prefix = PyString_AS_STRING(__pyx_v_item_prefix);

    /* "bzrlib/_chk_map_pyx.pyx":386
 *             prefix_length + next_null - cur)
 *         c_item_prefix = PyString_AS_STRING(item_prefix)
 *         if prefix_length:             # <<<<<<<<<<<<<<
 *             memcpy(c_item_prefix, prefix, prefix_length)
 *         memcpy(c_item_prefix + prefix_length, cur, next_null - cur)
 */
    __pyx_t_2 = (__pyx_v_prefix_length != 0);
    if (__pyx_t_2) {

      /* "bzrlib/_chk_map_pyx.pyx":387
 *         c_item_prefix = PyString_AS_STRING(item_prefix)
 *         if prefix_length:
 *             memcpy(c_item_prefix, prefix, prefix_length)             # <<<<<<<<<<<<<<
 *         memcpy(c_item_prefix + prefix_length, cur, next_null - cur)
 *         flat_key = PyString_FromStringAndSize(next_null + 1,
 */
      memcpy(__pyx_v_c_item_prefix, __pyx_v_prefix, __pyx_v_prefix_length);

      /* "bzrlib/_chk_map_pyx.pyx":386
 *             prefix_length + next_null - cur)
 *         c_item_prefix = PyString_AS_STRING(item_prefix)
 *         if prefix_length:             # <<<<<<<<<<<<<<
 *             memcpy(c_item_prefix, prefix, prefix_length)
 *         memcpy(c_item_prefix + prefix_length, cur, next_null - cur)
 */
    }

    /* "bzrlib/_chk_map_pyx.pyx":388
 *         if prefix_length:
 *             memcpy(c_item_prefix, prefix, prefix_length)
 *         memcpy(c_item_prefix + prefix_length, cur, next_null - cur)             # <<<<<<<<<<<<<<
 *         flat_key = PyString_FromStringAndSize(next_null + 1,
 *                                               next_line - next_null - 1)
 */
    memcpy((__pyx_v_c_item_prefix + __pyx_v_prefix_length), __pyx_v_cur, (__pyx_v_next_null - __pyx_v_cur));

    /* "bzrlib/_chk_map_pyx.pyx":389
 *             memcpy(c_item_prefix, prefix, prefix_length)
 *         memcpy(c_item_prefix + prefix_length, cur, next_null - cur)
 *         flat_key = PyString_FromStringAndSize(next_null + 1,             # <<<<<<<<<<<<<<
 *                                               next_line - next_null - 1)
 *         flat_key = StaticTuple(flat_key).intern()
 */
    __pyx_t_4 = PyString_FromStringAndSize((__pyx_v_next_null + 1), ((__pyx_v_next_line - __pyx_v_next_null) - 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_flat_key, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":391
 *         flat_key = PyString_FromStringAndSize(next_null + 1,
 *                                               next_line - next_null - 1)
 *         flat_key = StaticTuple(flat_key).intern()             # <<<<<<<<<<<<<<
 *         PyDict_SetItem(items, item_prefix, flat_key)
 *         cur = next_line + 1
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_flat_key);
    __Pyx_GIVEREF(__pyx_v_flat_key);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_flat_key);
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_intern); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_flat_key, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":392
 *                                               next_line - next_null - 1)
 *         flat_key = StaticTuple(flat_key).intern()
 *         PyDict_SetItem(items, item_prefix, flat_key)             # <<<<<<<<<<<<<<
 *         cur = next_line + 1
 *     assert len(items) > 0
 */
    __pyx_t_5 = PyDict_SetItem(__pyx_v_items, __pyx_v_item_prefix, __pyx_v_flat_key); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":393
 *         flat_key = StaticTuple(flat_key).intern()
 *         PyDict_SetItem(items, item_prefix, flat_key)
 *         cur = next_line + 1             # <<<<<<<<<<<<<<
 *     assert len(items) > 0
 *     result._items = items
 */
    __pyx_v_cur = (__pyx_v_next_line + 1);
  }

  /* "bzrlib/_chk_map_pyx.pyx":394
 *         PyDict_SetItem(items, item_prefix, flat_key)
 *         cur = next_line + 1
 *     assert len(items) > 0             # <<<<<<<<<<<<<<
 *     result._items = items
 *     result._len = length
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_7 = PyDict_Size(__pyx_v_items); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (unlikely(!((__pyx_t_7 > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif

  /* "bzrlib/_chk_map_pyx.pyx":395
 *         cur = next_line + 1
 *     assert len(items) > 0
 *     result._items = items             # <<<<<<<<<<<<<<
 *     result._len = length
 *     result._maximum_size = maximum_size
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_items, __pyx_v_items) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":396
 *     assert len(items) > 0
 *     result._items = items
 *     result._len = length             # <<<<<<<<<<<<<<
 *     result._maximum_size = maximum_size
 *     result._key = key
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_len, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":397
 *     result._items = items
 *     result._len = length
 *     result._maximum_size = maximum_size             # <<<<<<<<<<<<<<
 *     result._key = key
 *     result._key_width = width
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_maximum_size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_maximum_size_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":398
 *     result._len = length
 *     result._maximum_size = maximum_size
 *     result._key = key             # <<<<<<<<<<<<<<
 *     result._key_width = width
 *     # XXX: InternalNodes don't really care about their size, and this will
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_key_2, __pyx_v_key) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":399
 *     result._maximum_size = maximum_size
 *     result._key = key
 *     result._key_width = width             # <<<<<<<<<<<<<<
 *     # XXX: InternalNodes don't really care about their size, and this will
 *     #      change if we add prefix compression
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_key_width, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":402
 *     # XXX: InternalNodes don't really care about their size, and this will
 *     #      change if we add prefix compression
 *     result._raw_size = None # len(bytes)             # <<<<<<<<<<<<<<
 *     result._node_width = len(item_prefix)
 *     result._search_prefix = PyString_FromStringAndSize(prefix, prefix_length)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_raw_size, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":403
 *     #      change if we add prefix compression
 *     result._raw_size = None # len(bytes)
 *     result._node_width = len(item_prefix)             # <<<<<<<<<<<<<<
 *     result._search_prefix = PyString_FromStringAndSize(prefix, prefix_length)
 *     return result
 */
  if (unlikely(!__pyx_v_item_prefix)) { __Pyx_RaiseUnboundLocalError("item_prefix"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_7 = PyObject_Length(__pyx_v_item_prefix); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_node_width, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":404
 *     result._raw_size = None # len(bytes)
 *     result._node_width = len(item_prefix)
 *     result._search_prefix = PyString_FromStringAndSize(prefix, prefix_length)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_prefix, __pyx_v_prefix_length); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_result, __pyx_n_s_search_prefix, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":405
 *     result._node_width = len(item_prefix)
 *     result._search_prefix = PyString_FromStringAndSize(prefix, prefix_length)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":337
 * 
 * 
 * def _deserialise_internal_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     cdef char *c_bytes, *cur, *next, *end
 *     cdef char *next_line
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._deserialise_internal_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_item_prefix);
  __Pyx_XDECREF(__pyx_v_flat_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "bzrlib/_chk_map_pyx.pyx":408
 * 
 * 
 * def _bytes_to_text_key(bytes):             # <<<<<<<<<<<<<<
 *     """Take a CHKInventory value string and return a (file_id, rev_id) tuple"""
 *     cdef StaticTuple key
 */

/* Python wrapper */
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_9_bytes_to_text_key(PyObject *__pyx_self, PyObject *__pyx_v_bytes); /*proto*/
static char __pyx_doc_6bzrlib_12_chk_map_pyx_8_bytes_to_text_key[] = "Take a CHKInventory value string and return a (file_id, rev_id) tuple";
static PyMethodDef __pyx_mdef_6bzrlib_12_chk_map_pyx_9_bytes_to_text_key = {"_bytes_to_text_key", (PyCFunction)__pyx_pw_6bzrlib_12_chk_map_pyx_9_bytes_to_text_key, METH_O, __pyx_doc_6bzrlib_12_chk_map_pyx_8_bytes_to_text_key};
static PyObject *__pyx_pw_6bzrlib_12_chk_map_pyx_9_bytes_to_text_key(PyObject *__pyx_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_bytes_to_text_key (wrapper)", 0);
  __pyx_r = __pyx_pf_6bzrlib_12_chk_map_pyx_8_bytes_to_text_key(__pyx_self, ((PyObject *)__pyx_v_bytes));

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

static PyObject *__pyx_pf_6bzrlib_12_chk_map_pyx_8_bytes_to_text_key(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bytes) {
  StaticTuple *__pyx_v_key = 0;
  char *__pyx_v_byte_str;
  char *__pyx_v_cur_end;
  char *__pyx_v_file_id_str;
  char *__pyx_v_byte_end;
  char *__pyx_v_revision_str;
  Py_ssize_t __pyx_v_byte_size;
  PyObject *__pyx_v_file_id = NULL;
  PyObject *__pyx_v_revision = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_bytes_to_text_key", 0);

  /* "bzrlib/_chk_map_pyx.pyx":415
 *     cdef Py_ssize_t byte_size, pos, file_id_len
 * 
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a string, got %r' % (type(bytes),))
 *     byte_str = PyString_AS_STRING(bytes)
 */
  __pyx_t_1 = ((!(PyString_CheckExact(__pyx_v_bytes) != 0)) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":416
 * 
 *     if not PyString_CheckExact(bytes):
 *         raise TypeError('bytes must be a string, got %r' % (type(bytes),))             # <<<<<<<<<<<<<<
 *     byte_str = PyString_AS_STRING(bytes)
 *     byte_size = PyString_GET_SIZE(bytes)
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_bytes)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)Py_TYPE(__pyx_v_bytes)));
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_bytes_must_be_a_string_got_r, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":415
 *     cdef Py_ssize_t byte_size, pos, file_id_len
 * 
 *     if not PyString_CheckExact(bytes):             # <<<<<<<<<<<<<<
 *         raise TypeError('bytes must be a string, got %r' % (type(bytes),))
 *     byte_str = PyString_AS_STRING(bytes)
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":417
 *     if not PyString_CheckExact(bytes):
 *         raise TypeError('bytes must be a string, got %r' % (type(bytes),))
 *     byte_str = PyString_AS_STRING(bytes)             # <<<<<<<<<<<<<<
 *     byte_size = PyString_GET_SIZE(bytes)
 *     byte_end = byte_str + byte_size
 */
  __pyx_v_byte_str = PyString_AS_STRING(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":418
 *         raise TypeError('bytes must be a string, got %r' % (type(bytes),))
 *     byte_str = PyString_AS_STRING(bytes)
 *     byte_size = PyString_GET_SIZE(bytes)             # <<<<<<<<<<<<<<
 *     byte_end = byte_str + byte_size
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 */
  __pyx_v_byte_size = PyString_GET_SIZE(__pyx_v_bytes);

  /* "bzrlib/_chk_map_pyx.pyx":419
 *     byte_str = PyString_AS_STRING(bytes)
 *     byte_size = PyString_GET_SIZE(bytes)
 *     byte_end = byte_str + byte_size             # <<<<<<<<<<<<<<
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 *     if cur_end == NULL:
 */
  __pyx_v_byte_end = (__pyx_v_byte_str + __pyx_v_byte_size);

  /* "bzrlib/_chk_map_pyx.pyx":420
 *     byte_size = PyString_GET_SIZE(bytes)
 *     byte_end = byte_str + byte_size
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)             # <<<<<<<<<<<<<<
 *     if cur_end == NULL:
 *         raise ValueError('No kind section found.')
 */
  __pyx_v_cur_end = ((char *)memchr(__pyx_v_byte_str, ':', __pyx_v_byte_size));

  /* "bzrlib/_chk_map_pyx.pyx":421
 *     byte_end = byte_str + byte_size
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('No kind section found.')
 *     if cur_end[1] != c' ':
 */
  __pyx_t_1 = ((__pyx_v_cur_end == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":422
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 *     if cur_end == NULL:
 *         raise ValueError('No kind section found.')             # <<<<<<<<<<<<<<
 *     if cur_end[1] != c' ':
 *         raise ValueError(
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":421
 *     byte_end = byte_str + byte_size
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('No kind section found.')
 *     if cur_end[1] != c' ':
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":423
 *     if cur_end == NULL:
 *         raise ValueError('No kind section found.')
 *     if cur_end[1] != c' ':             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             'Kind section should end with ": ", got %r' % str(cur_end[:2],))
 */
  __pyx_t_1 = (((__pyx_v_cur_end[1]) != ' ') != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":425
 *     if cur_end[1] != c' ':
 *         raise ValueError(
 *             'Kind section should end with ": ", got %r' % str(cur_end[:2],))             # <<<<<<<<<<<<<<
 *     file_id_str = cur_end + 2
 *     # file_id is now the data up until the next newline
 */
    __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cur_end + 0, 2 - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Kind_section_should_end_with_got, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "bzrlib/_chk_map_pyx.pyx":424
 *         raise ValueError('No kind section found.')
 *     if cur_end[1] != c' ':
 *         raise ValueError(             # <<<<<<<<<<<<<<
 *             'Kind section should end with ": ", got %r' % str(cur_end[:2],))
 *     file_id_str = cur_end + 2
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":423
 *     if cur_end == NULL:
 *         raise ValueError('No kind section found.')
 *     if cur_end[1] != c' ':             # <<<<<<<<<<<<<<
 *         raise ValueError(
 *             'Kind section should end with ": ", got %r' % str(cur_end[:2],))
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":426
 *         raise ValueError(
 *             'Kind section should end with ": ", got %r' % str(cur_end[:2],))
 *     file_id_str = cur_end + 2             # <<<<<<<<<<<<<<
 *     # file_id is now the data up until the next newline
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)
 */
  __pyx_v_file_id_str = (__pyx_v_cur_end + 2);

  /* "bzrlib/_chk_map_pyx.pyx":428
 *     file_id_str = cur_end + 2
 *     # file_id is now the data up until the next newline
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)             # <<<<<<<<<<<<<<
 *     if cur_end == NULL:
 *         raise ValueError('no newline after file-id')
 */
  __pyx_v_cur_end = ((char *)memchr(__pyx_v_file_id_str, '\n', (__pyx_v_byte_end - __pyx_v_file_id_str)));

  /* "bzrlib/_chk_map_pyx.pyx":429
 *     # file_id is now the data up until the next newline
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after file-id')
 *     file_id = safe_interned_string_from_size(file_id_str,
 */
  __pyx_t_1 = ((__pyx_v_cur_end == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":430
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after file-id')             # <<<<<<<<<<<<<<
 *     file_id = safe_interned_string_from_size(file_id_str,
 *                                              cur_end - file_id_str)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":429
 *     # file_id is now the data up until the next newline
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after file-id')
 *     file_id = safe_interned_string_from_size(file_id_str,
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":431
 *     if cur_end == NULL:
 *         raise ValueError('no newline after file-id')
 *     file_id = safe_interned_string_from_size(file_id_str,             # <<<<<<<<<<<<<<
 *                                              cur_end - file_id_str)
 *     # this is the end of the parent_str
 */
  __pyx_t_2 = __pyx_f_6bzrlib_12_chk_map_pyx_safe_interned_string_from_size(__pyx_v_file_id_str, (__pyx_v_cur_end - __pyx_v_file_id_str)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_file_id = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":434
 *                                              cur_end - file_id_str)
 *     # this is the end of the parent_str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)             # <<<<<<<<<<<<<<
 *     if cur_end == NULL:
 *         raise ValueError('no newline after parent_str')
 */
  __pyx_v_cur_end = ((char *)memchr((__pyx_v_cur_end + 1), '\n', ((__pyx_v_byte_end - __pyx_v_cur_end) - 1)));

  /* "bzrlib/_chk_map_pyx.pyx":435
 *     # this is the end of the parent_str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after parent_str')
 *     # end of the name str
 */
  __pyx_t_1 = ((__pyx_v_cur_end == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":436
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after parent_str')             # <<<<<<<<<<<<<<
 *     # end of the name str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":435
 *     # this is the end of the parent_str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after parent_str')
 *     # end of the name str
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":438
 *         raise ValueError('no newline after parent_str')
 *     # end of the name str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)             # <<<<<<<<<<<<<<
 *     if cur_end == NULL:
 *         raise ValueError('no newline after name str')
 */
  __pyx_v_cur_end = ((char *)memchr((__pyx_v_cur_end + 1), '\n', ((__pyx_v_byte_end - __pyx_v_cur_end) - 1)));

  /* "bzrlib/_chk_map_pyx.pyx":439
 *     # end of the name str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after name str')
 *     # the next section is the revision info
 */
  __pyx_t_1 = ((__pyx_v_cur_end == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":440
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after name str')             # <<<<<<<<<<<<<<
 *     # the next section is the revision info
 *     revision_str = cur_end + 1
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "bzrlib/_chk_map_pyx.pyx":439
 *     # end of the name str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         raise ValueError('no newline after name str')
 *     # the next section is the revision info
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":442
 *         raise ValueError('no newline after name str')
 *     # the next section is the revision info
 *     revision_str = cur_end + 1             # <<<<<<<<<<<<<<
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:
 */
  __pyx_v_revision_str = (__pyx_v_cur_end + 1);

  /* "bzrlib/_chk_map_pyx.pyx":443
 *     # the next section is the revision info
 *     revision_str = cur_end + 1
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)             # <<<<<<<<<<<<<<
 *     if cur_end == NULL:
 *         # This is probably a dir: entry, which has revision as the last item
 */
  __pyx_v_cur_end = ((char *)memchr((__pyx_v_cur_end + 1), '\n', ((__pyx_v_byte_end - __pyx_v_cur_end) - 1)));

  /* "bzrlib/_chk_map_pyx.pyx":444
 *     revision_str = cur_end + 1
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         # This is probably a dir: entry, which has revision as the last item
 *         cur_end = byte_end
 */
  __pyx_t_1 = ((__pyx_v_cur_end == NULL) != 0);
  if (__pyx_t_1) {

    /* "bzrlib/_chk_map_pyx.pyx":446
 *     if cur_end == NULL:
 *         # This is probably a dir: entry, which has revision as the last item
 *         cur_end = byte_end             # <<<<<<<<<<<<<<
 *     revision = safe_interned_string_from_size(revision_str,
 *         cur_end - revision_str)
 */
    __pyx_v_cur_end = __pyx_v_byte_end;

    /* "bzrlib/_chk_map_pyx.pyx":444
 *     revision_str = cur_end + 1
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:             # <<<<<<<<<<<<<<
 *         # This is probably a dir: entry, which has revision as the last item
 *         cur_end = byte_end
 */
  }

  /* "bzrlib/_chk_map_pyx.pyx":447
 *         # This is probably a dir: entry, which has revision as the last item
 *         cur_end = byte_end
 *     revision = safe_interned_string_from_size(revision_str,             # <<<<<<<<<<<<<<
 *         cur_end - revision_str)
 *     key = StaticTuple_New(2)
 */
  __pyx_t_2 = __pyx_f_6bzrlib_12_chk_map_pyx_safe_interned_string_from_size(__pyx_v_revision_str, (__pyx_v_cur_end - __pyx_v_revision_str)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_revision = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":449
 *     revision = safe_interned_string_from_size(revision_str,
 *         cur_end - revision_str)
 *     key = StaticTuple_New(2)             # <<<<<<<<<<<<<<
 *     Py_INCREF(file_id)
 *     StaticTuple_SET_ITEM(key, 0, file_id)
 */
  __pyx_t_2 = ((PyObject *)StaticTuple_New(2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_key = ((StaticTuple *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":450
 *         cur_end - revision_str)
 *     key = StaticTuple_New(2)
 *     Py_INCREF(file_id)             # <<<<<<<<<<<<<<
 *     StaticTuple_SET_ITEM(key, 0, file_id)
 *     Py_INCREF(revision)
 */
  Py_INCREF(__pyx_v_file_id);

  /* "bzrlib/_chk_map_pyx.pyx":451
 *     key = StaticTuple_New(2)
 *     Py_INCREF(file_id)
 *     StaticTuple_SET_ITEM(key, 0, file_id)             # <<<<<<<<<<<<<<
 *     Py_INCREF(revision)
 *     StaticTuple_SET_ITEM(key, 1, revision)
 */
  StaticTuple_SET_ITEM(__pyx_v_key, 0, __pyx_v_file_id);

  /* "bzrlib/_chk_map_pyx.pyx":452
 *     Py_INCREF(file_id)
 *     StaticTuple_SET_ITEM(key, 0, file_id)
 *     Py_INCREF(revision)             # <<<<<<<<<<<<<<
 *     StaticTuple_SET_ITEM(key, 1, revision)
 *     return StaticTuple_Intern(key)
 */
  Py_INCREF(__pyx_v_revision);

  /* "bzrlib/_chk_map_pyx.pyx":453
 *     StaticTuple_SET_ITEM(key, 0, file_id)
 *     Py_INCREF(revision)
 *     StaticTuple_SET_ITEM(key, 1, revision)             # <<<<<<<<<<<<<<
 *     return StaticTuple_Intern(key)
 */
  StaticTuple_SET_ITEM(__pyx_v_key, 1, __pyx_v_revision);

  /* "bzrlib/_chk_map_pyx.pyx":454
 *     Py_INCREF(revision)
 *     StaticTuple_SET_ITEM(key, 1, revision)
 *     return StaticTuple_Intern(key)             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)StaticTuple_Intern(__pyx_v_key)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "bzrlib/_chk_map_pyx.pyx":408
 * 
 * 
 * def _bytes_to_text_key(bytes):             # <<<<<<<<<<<<<<
 *     """Take a CHKInventory value string and return a (file_id, rev_id) tuple"""
 *     cdef StaticTuple key
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("bzrlib._chk_map_pyx._bytes_to_text_key", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_file_id);
  __Pyx_XDECREF(__pyx_v_revision);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "_chk_map_pyx",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  {&__pyx_kp_s_Incorrect_number_of_elements_d_v, __pyx_k_Incorrect_number_of_elements_d_v, sizeof(__pyx_k_Incorrect_number_of_elements_d_v), 0, 0, 1, 0},
  {&__pyx_n_s_InternalNode, __pyx_k_InternalNode, sizeof(__pyx_k_InternalNode), 0, 0, 1, 1},
  {&__pyx_kp_s_Kind_section_should_end_with_got, __pyx_k_Kind_section_should_end_with_got, sizeof(__pyx_k_Kind_section_should_end_with_got), 0, 0, 1, 0},
  {&__pyx_n_s_LeafNode, __pyx_k_LeafNode, sizeof(__pyx_k_LeafNode), 0, 0, 1, 1},
  {&__pyx_kp_s_Missing_s_line, __pyx_k_Missing_s_line, sizeof(__pyx_k_Missing_s_line), 0, 0, 1, 0},
  {&__pyx_kp_s_Missing_the_prefix_line, __pyx_k_Missing_the_prefix_line, sizeof(__pyx_k_Missing_the_prefix_line), 0, 0, 1, 0},
  {&__pyx_kp_s_No_kind_section_found, __pyx_k_No_kind_section_found, sizeof(__pyx_k_No_kind_section_found), 0, 0, 1, 0},
  {&__pyx_kp_s_Prefix_has_too_many_nulls_versus, __pyx_k_Prefix_has_too_many_nulls_versus, sizeof(__pyx_k_Prefix_has_too_many_nulls_versus), 0, 0, 1, 0},
  {&__pyx_kp_s_Too_many_bits_for_entry, __pyx_k_Too_many_bits_for_entry, sizeof(__pyx_k_Too_many_bits_for_entry), 0, 0, 1, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_kp_s_bad_no_null, __pyx_k_bad_no_null, sizeof(__pyx_k_bad_no_null), 0, 0, 1, 0},
  {&__pyx_kp_s_bad_no_null_bad, __pyx_k_bad_no_null_bad, sizeof(__pyx_k_bad_no_null_bad), 0, 0, 1, 0},
  {&__pyx_n_s_byte_end, __pyx_k_byte_end, sizeof(__pyx_k_byte_end), 0, 0, 1, 1},
  {&__pyx_n_s_byte_size, __pyx_k_byte_size, sizeof(__pyx_k_byte_size), 0, 0, 1, 1},
  {&__pyx_n_s_byte_str, __pyx_k_byte_str, sizeof(__pyx_k_byte_str), 0, 0, 1, 1},
  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
  {&__pyx_kp_s_bytes_does_not_end_in_a_newline, __pyx_k_bytes_does_not_end_in_a_newline, sizeof(__pyx_k_bytes_does_not_end_in_a_newline), 0, 0, 1, 0},
  {&__pyx_kp_s_bytes_must_be_a_plain_string_not, __pyx_k_bytes_must_be_a_plain_string_not, sizeof(__pyx_k_bytes_must_be_a_plain_string_not), 0, 0, 1, 0},
  {&__pyx_kp_s_bytes_must_be_a_string_got_r, __pyx_k_bytes_must_be_a_string_got_r, sizeof(__pyx_k_bytes_must_be_a_string_got_r), 0, 0, 1, 0},
  {&__pyx_n_s_bytes_to_text_key, __pyx_k_bytes_to_text_key, sizeof(__pyx_k_bytes_to_text_key), 0, 0, 1, 1},
  {&__pyx_n_s_bzrlib, __pyx_k_bzrlib, sizeof(__pyx_k_bzrlib), 0, 0, 1, 1},
  {&__pyx_n_s_bzrlib__chk_map_pyx, __pyx_k_bzrlib__chk_map_pyx, sizeof(__pyx_k_bzrlib__chk_map_pyx), 0, 0, 1, 1},
  {&__pyx_n_s_c_bytes, __pyx_k_c_bytes, sizeof(__pyx_k_c_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_c_bytes_len, __pyx_k_c_bytes_len, sizeof(__pyx_k_c_bytes_len), 0, 0, 1, 1},
  {&__pyx_n_s_c_entry, __pyx_k_c_entry, sizeof(__pyx_k_c_entry), 0, 0, 1, 1},
  {&__pyx_n_s_c_item_prefix, __pyx_k_c_item_prefix, sizeof(__pyx_k_c_item_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_c_out, __pyx_k_c_out, sizeof(__pyx_k_c_out), 0, 0, 1, 1},
  {&__pyx_n_s_chk_map, __pyx_k_chk_map, sizeof(__pyx_k_chk_map), 0, 0, 1, 1},
  {&__pyx_n_s_common_serialised_prefix, __pyx_k_common_serialised_prefix, sizeof(__pyx_k_common_serialised_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_crc32, __pyx_k_crc32, sizeof(__pyx_k_crc32), 0, 0, 1, 1},
  {&__pyx_n_s_crc_val, __pyx_k_crc_val, sizeof(__pyx_k_crc_val), 0, 0, 1, 1},
  {&__pyx_n_s_cur, __pyx_k_cur, sizeof(__pyx_k_cur), 0, 0, 1, 1},
  {&__pyx_n_s_cur_end, __pyx_k_cur_end, sizeof(__pyx_k_cur_end), 0, 0, 1, 1},
  {&__pyx_n_s_current_size, __pyx_k_current_size, sizeof(__pyx_k_current_size), 0, 0, 1, 1},
  {&__pyx_kp_s_current_size_computed_incorrect, __pyx_k_current_size_computed_incorrect, sizeof(__pyx_k_current_size_computed_incorrect), 0, 0, 1, 0},
  {&__pyx_n_s_deserialise_internal_node, __pyx_k_deserialise_internal_node, sizeof(__pyx_k_deserialise_internal_node), 0, 0, 1, 1},
  {&__pyx_n_s_deserialise_leaf_node, __pyx_k_deserialise_leaf_node, sizeof(__pyx_k_deserialise_leaf_node), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 0, 0, 1, 1},
  {&__pyx_n_s_entry_bits, __pyx_k_entry_bits, sizeof(__pyx_k_entry_bits), 0, 0, 1, 1},
  {&__pyx_n_s_entry_start, __pyx_k_entry_start, sizeof(__pyx_k_entry_start), 0, 0, 1, 1},
  {&__pyx_kp_s_fail_to_find_the_num_value_lines, __pyx_k_fail_to_find_the_num_value_lines, sizeof(__pyx_k_fail_to_find_the_num_value_lines), 0, 0, 1, 0},
  {&__pyx_n_s_file_id, __pyx_k_file_id, sizeof(__pyx_k_file_id), 0, 0, 1, 1},
  {&__pyx_n_s_file_id_len, __pyx_k_file_id_len, sizeof(__pyx_k_file_id_len), 0, 0, 1, 1},
  {&__pyx_n_s_file_id_str, __pyx_k_file_id_str, sizeof(__pyx_k_file_id_str), 0, 0, 1, 1},
  {&__pyx_n_s_flat_key, __pyx_k_flat_key, sizeof(__pyx_k_flat_key), 0, 0, 1, 1},
  {&__pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_k_home_vila_src_bzr_integration_2, sizeof(__pyx_k_home_vila_src_bzr_integration_2), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_intern, __pyx_k_intern, sizeof(__pyx_k_intern), 0, 0, 1, 1},
  {&__pyx_kp_s_item_count_d_mismatch_for_key_s, __pyx_k_item_count_d_mismatch_for_key_s, sizeof(__pyx_k_item_count_d_mismatch_for_key_s), 0, 0, 1, 0},
  {&__pyx_n_s_item_prefix, __pyx_k_item_prefix, sizeof(__pyx_k_item_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_items_2, __pyx_k_items_2, sizeof(__pyx_k_items_2), 0, 0, 1, 1},
  {&__pyx_n_s_items_length, __pyx_k_items_length, sizeof(__pyx_k_items_length), 0, 0, 1, 1},
  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_key_2, __pyx_k_key_2, sizeof(__pyx_k_key_2), 0, 0, 1, 1},
  {&__pyx_kp_s_key_r_is_not_a_StaticTuple, __pyx_k_key_r_is_not_a_StaticTuple, sizeof(__pyx_k_key_r_is_not_a_StaticTuple), 0, 0, 1, 0},
  {&__pyx_n_s_key_width, __pyx_k_key_width, sizeof(__pyx_k_key_width), 0, 0, 1, 1},
  {&__pyx_n_s_last_null, __pyx_k_last_null, sizeof(__pyx_k_last_null), 0, 0, 1, 1},
  {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
  {&__pyx_n_s_line_prefix, __pyx_k_line_prefix, sizeof(__pyx_k_line_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_line_start, __pyx_k_line_start, sizeof(__pyx_k_line_start), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_maximum_size, __pyx_k_maximum_size, sizeof(__pyx_k_maximum_size), 0, 0, 1, 1},
  {&__pyx_n_s_maximum_size_2, __pyx_k_maximum_size_2, sizeof(__pyx_k_maximum_size_2), 0, 0, 1, 1},
  {&__pyx_kp_s_missing_trailing_newline, __pyx_k_missing_trailing_newline, sizeof(__pyx_k_missing_trailing_newline), 0, 0, 1, 0},
  {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1},
  {&__pyx_n_s_next_line, __pyx_k_next_line, sizeof(__pyx_k_next_line), 0, 0, 1, 1},
  {&__pyx_n_s_next_null, __pyx_k_next_null, sizeof(__pyx_k_next_null), 0, 0, 1, 1},
  {&__pyx_kp_s_no_newline_after_file_id, __pyx_k_no_newline_after_file_id, sizeof(__pyx_k_no_newline_after_file_id), 0, 0, 1, 0},
  {&__pyx_kp_s_no_newline_after_name_str, __pyx_k_no_newline_after_name_str, sizeof(__pyx_k_no_newline_after_name_str), 0, 0, 1, 0},
  {&__pyx_kp_s_no_newline_after_parent_str, __pyx_k_no_newline_after_parent_str, sizeof(__pyx_k_no_newline_after_parent_str), 0, 0, 1, 0},
  {&__pyx_n_s_node_width, __pyx_k_node_width, sizeof(__pyx_k_node_width), 0, 0, 1, 1},
  {&__pyx_kp_s_not_a_serialised_internal_node_r, __pyx_k_not_a_serialised_internal_node_r, sizeof(__pyx_k_not_a_serialised_internal_node_r), 0, 0, 1, 0},
  {&__pyx_kp_s_not_a_serialised_leaf_node_r, __pyx_k_not_a_serialised_leaf_node_r, sizeof(__pyx_k_not_a_serialised_leaf_node_r), 0, 0, 1, 0},
  {&__pyx_kp_s_null_line, __pyx_k_null_line, sizeof(__pyx_k_null_line), 0, 0, 1, 0},
  {&__pyx_n_s_num_bits, __pyx_k_num_bits, sizeof(__pyx_k_num_bits), 0, 0, 1, 1},
  {&__pyx_n_s_num_out_bytes, __pyx_k_num_out_bytes, sizeof(__pyx_k_num_out_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_num_prefix_bits, __pyx_k_num_prefix_bits, sizeof(__pyx_k_num_prefix_bits), 0, 0, 1, 1},
  {&__pyx_n_s_num_value_lines_2, __pyx_k_num_value_lines_2, sizeof(__pyx_k_num_value_lines_2), 0, 0, 1, 1},
  {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  {&__pyx_n_s_out_off, __pyx_k_out_off, sizeof(__pyx_k_out_off), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_prefix_bits, __pyx_k_prefix_bits, sizeof(__pyx_k_prefix_bits), 0, 0, 1, 1},
  {&__pyx_n_s_prefix_length, __pyx_k_prefix_length, sizeof(__pyx_k_prefix_length), 0, 0, 1, 1},
  {&__pyx_n_s_prefix_tail, __pyx_k_prefix_tail, sizeof(__pyx_k_prefix_tail), 0, 0, 1, 1},
  {&__pyx_n_s_prefix_tail_len, __pyx_k_prefix_tail_len, sizeof(__pyx_k_prefix_tail_len), 0, 0, 1, 1},
  {&__pyx_n_s_raw_size, __pyx_k_raw_size, sizeof(__pyx_k_raw_size), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_revision, __pyx_k_revision, sizeof(__pyx_k_revision), 0, 0, 1, 1},
  {&__pyx_n_s_revision_str, __pyx_k_revision_str, sizeof(__pyx_k_revision_str), 0, 0, 1, 1},
  {&__pyx_kp_s_s_line_not_a_proper_int, __pyx_k_s_line_not_a_proper_int, sizeof(__pyx_k_s_line_not_a_proper_int), 0, 0, 1, 0},
  {&__pyx_n_s_search_key_16, __pyx_k_search_key_16, sizeof(__pyx_k_search_key_16), 0, 0, 1, 1},
  {&__pyx_n_s_search_key_255, __pyx_k_search_key_255, sizeof(__pyx_k_search_key_255), 0, 0, 1, 1},
  {&__pyx_n_s_search_key_func, __pyx_k_search_key_func, sizeof(__pyx_k_search_key_func), 0, 0, 1, 1},
  {&__pyx_n_s_search_prefix, __pyx_k_search_prefix, sizeof(__pyx_k_search_prefix), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_kp_s_tried_to_create_a_string_with_an, __pyx_k_tried_to_create_a_string_with_an, sizeof(__pyx_k_tried_to_create_a_string_with_an), 0, 0, 1, 0},
  {&__pyx_n_s_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_value_start, __pyx_k_value_start, sizeof(__pyx_k_value_start), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_zlib, __pyx_k_zlib, sizeof(__pyx_k_zlib), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "bzrlib/_chk_map_pyx.pyx":219
 *         raise ValueError("not a serialised leaf node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")             # <<<<<<<<<<<<<<
 * 
 *     end = c_bytes + c_bytes_len
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_bytes_does_not_end_in_a_newline); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "bzrlib/_chk_map_pyx.pyx":229
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')             # <<<<<<<<<<<<<<
 *     prefix = cur
 *     prefix_length = next_line - cur
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Missing_the_prefix_line); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "bzrlib/_chk_map_pyx.pyx":247
 * 
 *     if num_prefix_bits >= width:
 *         raise ValueError('Prefix has too many nulls versus width')             # <<<<<<<<<<<<<<
 * 
 *     items_length = end - cur
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Prefix_has_too_many_nulls_versus); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "bzrlib/_chk_map_pyx.pyx":255
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:
 *             raise ValueError('null line\n')             # <<<<<<<<<<<<<<
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_null_line); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "bzrlib/_chk_map_pyx.pyx":258
 *         last_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if last_null == NULL:
 *             raise ValueError('fail to find the num value lines null')             # <<<<<<<<<<<<<<
 *         next_null = last_null + 1 # move past NULL
 *         num_value_lines = _get_int_from_line(&next_null, next_line + 1,
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_fail_to_find_the_num_value_lines); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "bzrlib/_chk_map_pyx.pyx":268
 *             next_line = <char *>memchr(cur, c'\n', end - cur)
 *             if next_line == NULL:
 *                 raise ValueError('missing trailing newline')             # <<<<<<<<<<<<<<
 *             cur = next_line + 1
 *         entry_bits = StaticTuple_New(width)
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_missing_trailing_newline); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "bzrlib/_chk_map_pyx.pyx":285
 *                                    last_null - entry_start + 1)
 *         if next_null == NULL:
 *             raise ValueError('bad no null, bad')             # <<<<<<<<<<<<<<
 *         entry = PyString_FromStringAndSize(NULL,
 *                     prefix_tail_len + next_null - line_start)
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_bad_no_null_bad); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "bzrlib/_chk_map_pyx.pyx":299
 *             i = i + 1
 *             if i > width:
 *                 raise ValueError("Too many bits for entry")             # <<<<<<<<<<<<<<
 *             entry_start = next_null + 1
 *             next_null = <char *>memchr(entry_start, c'\0',
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Too_many_bits_for_entry); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "bzrlib/_chk_map_pyx.pyx":304
 *                                        last_null - entry_start + 1)
 *             if next_null == NULL:
 *                 raise ValueError('bad no null')             # <<<<<<<<<<<<<<
 *             entry = PyString_FromStringAndSize(entry_start,
 *                                                next_null - entry_start)
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_bad_no_null); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "bzrlib/_chk_map_pyx.pyx":359
 *         raise ValueError("not a serialised internal node: %r" % bytes)
 *     if c_bytes[c_bytes_len - 1] != c'\n':
 *         raise ValueError("bytes does not end in a newline")             # <<<<<<<<<<<<<<
 * 
 *     items = {}
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_bytes_does_not_end_in_a_newline); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "bzrlib/_chk_map_pyx.pyx":370
 *     next_line = <char *>memchr(cur, c'\n', end - cur)
 *     if next_line == NULL:
 *         raise ValueError('Missing the prefix line\n')             # <<<<<<<<<<<<<<
 *     prefix = cur
 *     prefix_length = next_line - cur
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Missing_the_prefix_line); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "bzrlib/_chk_map_pyx.pyx":379
 *         next_line = <char *>memchr(cur, c'\n', end - cur)
 *         if next_line == NULL:
 *             raise ValueError('missing trailing newline')             # <<<<<<<<<<<<<<
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_missing_trailing_newline); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "bzrlib/_chk_map_pyx.pyx":382
 *         next_null = <char *>_my_memrchr(cur, c'\0', next_line - cur)
 *         if next_null == NULL:
 *             raise ValueError('bad no null')             # <<<<<<<<<<<<<<
 *         item_prefix = PyString_FromStringAndSize(NULL,
 *             prefix_length + next_null - cur)
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_bad_no_null); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "bzrlib/_chk_map_pyx.pyx":422
 *     cur_end = <char*>memchr(byte_str, c':', byte_size)
 *     if cur_end == NULL:
 *         raise ValueError('No kind section found.')             # <<<<<<<<<<<<<<
 *     if cur_end[1] != c' ':
 *         raise ValueError(
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_kind_section_found); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "bzrlib/_chk_map_pyx.pyx":430
 *     cur_end = <char*>memchr(file_id_str, c'\n', byte_end - file_id_str)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after file-id')             # <<<<<<<<<<<<<<
 *     file_id = safe_interned_string_from_size(file_id_str,
 *                                              cur_end - file_id_str)
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_newline_after_file_id); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "bzrlib/_chk_map_pyx.pyx":436
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after parent_str')             # <<<<<<<<<<<<<<
 *     # end of the name str
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_newline_after_parent_str); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "bzrlib/_chk_map_pyx.pyx":440
 *     cur_end = <char*>memchr(cur_end + 1, c'\n', byte_end - cur_end - 1)
 *     if cur_end == NULL:
 *         raise ValueError('no newline after name str')             # <<<<<<<<<<<<<<
 *     # the next section is the revision info
 *     revision_str = cur_end + 1
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_newline_after_name_str); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "bzrlib/_chk_map_pyx.pyx":100
 * 
 * 
 * def _search_key_16(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_16."""
 *     cdef Py_ssize_t num_bits
 */
  __pyx_tuple__18 = PyTuple_Pack(9, __pyx_n_s_key, __pyx_n_s_num_bits, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_num_out_bytes, __pyx_n_s_crc_val, __pyx_n_s_out_off, __pyx_n_s_c_out, __pyx_n_s_out); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_n_s_search_key_16, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":125
 * 
 * 
 * def _search_key_255(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_255."""
 *     cdef Py_ssize_t num_bits
 */
  __pyx_tuple__20 = PyTuple_Pack(9, __pyx_n_s_key, __pyx_n_s_num_bits, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_num_out_bytes, __pyx_n_s_crc_val, __pyx_n_s_out_off, __pyx_n_s_c_out, __pyx_n_s_out); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_n_s_search_key_255, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":188
 * 
 * 
 * def _deserialise_leaf_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     """Deserialise bytes, with key key, into a LeafNode.
 * 
 */
  __pyx_tuple__22 = PyTuple_Pack(32, __pyx_n_s_bytes, __pyx_n_s_key, __pyx_n_s_search_key_func, __pyx_n_s_c_bytes, __pyx_n_s_cur, __pyx_n_s_next, __pyx_n_s_end, __pyx_n_s_next_line, __pyx_n_s_c_bytes_len, __pyx_n_s_prefix_length, __pyx_n_s_items_length, __pyx_n_s_maximum_size, __pyx_n_s_width, __pyx_n_s_length, __pyx_n_s_i, __pyx_n_s_prefix_tail_len, __pyx_n_s_num_value_lines_2, __pyx_n_s_num_prefix_bits, __pyx_n_s_prefix, __pyx_n_s_value_start, __pyx_n_s_prefix_tail, __pyx_n_s_next_null, __pyx_n_s_last_null, __pyx_n_s_line_start, __pyx_n_s_c_entry, __pyx_n_s_entry_start, __pyx_n_s_entry_bits, __pyx_n_s_result, __pyx_n_s_prefix_bits, __pyx_n_s_items_2, __pyx_n_s_entry, __pyx_n_s_value); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 32, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_n_s_deserialise_leaf_node, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":337
 * 
 * 
 * def _deserialise_internal_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     cdef char *c_bytes, *cur, *next, *end
 *     cdef char *next_line
 */
  __pyx_tuple__24 = PyTuple_Pack(23, __pyx_n_s_bytes, __pyx_n_s_key, __pyx_n_s_search_key_func, __pyx_n_s_c_bytes, __pyx_n_s_cur, __pyx_n_s_next, __pyx_n_s_end, __pyx_n_s_next_line, __pyx_n_s_c_bytes_len, __pyx_n_s_prefix_length, __pyx_n_s_maximum_size, __pyx_n_s_width, __pyx_n_s_length, __pyx_n_s_i, __pyx_n_s_prefix_tail_len, __pyx_n_s_prefix, __pyx_n_s_line_prefix, __pyx_n_s_next_null, __pyx_n_s_c_item_prefix, __pyx_n_s_result, __pyx_n_s_items_2, __pyx_n_s_item_prefix, __pyx_n_s_flat_key); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 23, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_n_s_deserialise_internal_node, 337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":408
 * 
 * 
 * def _bytes_to_text_key(bytes):             # <<<<<<<<<<<<<<
 *     """Take a CHKInventory value string and return a (file_id, rev_id) tuple"""
 *     cdef StaticTuple key
 */
  __pyx_tuple__26 = PyTuple_Pack(12, __pyx_n_s_bytes, __pyx_n_s_key, __pyx_n_s_byte_str, __pyx_n_s_cur_end, __pyx_n_s_file_id_str, __pyx_n_s_byte_end, __pyx_n_s_revision_str, __pyx_n_s_byte_size, __pyx_n_s_pos, __pyx_n_s_file_id_len, __pyx_n_s_file_id, __pyx_n_s_revision); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_vila_src_bzr_integration_2, __pyx_n_s_bytes_to_text_key, 408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_chk_map_pyx(void); /*proto*/
PyMODINIT_FUNC init_chk_map_pyx(void)
#else
PyMODINIT_FUNC PyInit__chk_map_pyx(void); /*proto*/
PyMODINIT_FUNC PyInit__chk_map_pyx(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__chk_map_pyx(void)", 0);
  if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("_chk_map_pyx", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_bzrlib___chk_map_pyx) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "bzrlib._chk_map_pyx")) {
      if (unlikely(PyDict_SetItemString(modules, "bzrlib._chk_map_pyx", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_6bzrlib_12_chk_map_pyx_crc32 = Py_None; Py_INCREF(Py_None);
  __pyx_v_6bzrlib_12_chk_map_pyx__LeafNode = Py_None; Py_INCREF(Py_None);
  __pyx_v_6bzrlib_12_chk_map_pyx__InternalNode = Py_None; Py_INCREF(Py_None);
  __pyx_v_6bzrlib_12_chk_map_pyx__unknown = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  /*--- Type import code ---*/
  __pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple = __Pyx_ImportType("bzrlib._static_tuple_c", "StaticTuple", sizeof(StaticTuple), 0); if (unlikely(!__pyx_ptype_6bzrlib_15_static_tuple_c_StaticTuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif

  /* "bzrlib/_chk_map_pyx.pyx":57
 * 
 * cdef object crc32
 * from zlib import crc32             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_crc32);
  __Pyx_GIVEREF(__pyx_n_s_crc32);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_crc32);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_zlib, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_crc32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx_crc32);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx_crc32, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":61
 * 
 * # Set up the StaticTuple C_API functionality
 * import_static_tuple_c()             # <<<<<<<<<<<<<<
 * 
 * cdef object _LeafNode
 */
  __pyx_t_3 = import_static_tuple_c(); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "bzrlib/_chk_map_pyx.pyx":64
 * 
 * cdef object _LeafNode
 * _LeafNode = None             # <<<<<<<<<<<<<<
 * cdef object _InternalNode
 * _InternalNode = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__LeafNode, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "bzrlib/_chk_map_pyx.pyx":66
 * _LeafNode = None
 * cdef object _InternalNode
 * _InternalNode = None             # <<<<<<<<<<<<<<
 * cdef object _unknown
 * _unknown = None
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__InternalNode, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "bzrlib/_chk_map_pyx.pyx":68
 * _InternalNode = None
 * cdef object _unknown
 * _unknown = None             # <<<<<<<<<<<<<<
 * 
 * # We shouldn't just copy this from _dirstate_helpers_pyx
 */
  __Pyx_INCREF(Py_None);
  __Pyx_XGOTREF(__pyx_v_6bzrlib_12_chk_map_pyx__unknown);
  __Pyx_DECREF_SET(__pyx_v_6bzrlib_12_chk_map_pyx__unknown, Py_None);
  __Pyx_GIVEREF(Py_None);

  /* "bzrlib/_chk_map_pyx.pyx":100
 * 
 * 
 * def _search_key_16(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_16."""
 *     cdef Py_ssize_t num_bits
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_12_chk_map_pyx_1_search_key_16, NULL, __pyx_n_s_bzrlib__chk_map_pyx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_search_key_16, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":125
 * 
 * 
 * def _search_key_255(key):             # <<<<<<<<<<<<<<
 *     """See chk_map._search_key_255."""
 *     cdef Py_ssize_t num_bits
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_12_chk_map_pyx_3_search_key_255, NULL, __pyx_n_s_bzrlib__chk_map_pyx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_search_key_255, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":188
 * 
 * 
 * def _deserialise_leaf_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     """Deserialise bytes, with key key, into a LeafNode.
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_12_chk_map_pyx_5_deserialise_leaf_node, NULL, __pyx_n_s_bzrlib__chk_map_pyx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_deserialise_leaf_node, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":337
 * 
 * 
 * def _deserialise_internal_node(bytes, key, search_key_func=None):             # <<<<<<<<<<<<<<
 *     cdef char *c_bytes, *cur, *next, *end
 *     cdef char *next_line
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_12_chk_map_pyx_7_deserialise_internal_node, NULL, __pyx_n_s_bzrlib__chk_map_pyx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_deserialise_internal_node, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":408
 * 
 * 
 * def _bytes_to_text_key(bytes):             # <<<<<<<<<<<<<<
 *     """Take a CHKInventory value string and return a (file_id, rev_id) tuple"""
 *     cdef StaticTuple key
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6bzrlib_12_chk_map_pyx_9_bytes_to_text_key, NULL, __pyx_n_s_bzrlib__chk_map_pyx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes_to_text_key, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "bzrlib/_chk_map_pyx.pyx":1
 * # Copyright (C) 2009, 2010 Canonical Ltd             # <<<<<<<<<<<<<<
 * #
 * # This program is free software; you can redistribute it and/or modify
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init bzrlib._chk_map_pyx", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init bzrlib._chk_map_pyx");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

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

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

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
#endif

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0])
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0])
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return __Pyx_NewRef(x);
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
