/* Generated by Nim Compiler v1.3.5 */
/*   (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64

/* section: NIM_merge_HEADERS */

#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

/* section: NIM_merge_FRAME_DEFINES */
#define nimfr_(x, y)
#define nimln_(x, y)

/* section: NIM_merge_FORWARD_TYPES */
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g;
typedef struct tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg;
typedef struct tyObject_PyLibcolonObjectType___bTw708kK89b8Vj9cmSu9a4zig tyObject_PyLibcolonObjectType___bTw708kK89b8Vj9cmSu9a4zig;
typedef struct tyObject_RawPyBuffer__0qyRdSZKtLACJ1u4qMMP2w tyObject_RawPyBuffer__0qyRdSZKtLACJ1u4qMMP2w;
typedef struct tyObject_Complex__zWadV1X9aMO7qS9bsQFB0JFA tyObject_Complex__zWadV1X9aMO7qS9bsQFB0JFA;
typedef struct tyObject_PyMethodDef__9aWi1PsmvCuTKIYDHHnhfcw tyObject_PyMethodDef__9aWi1PsmvCuTKIYDHHnhfcw;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;

/* section: NIM_merge_TYPES */
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg {
NI ob_refcnt;
void* ob_type;
};
typedef N_CDECL_PTR(void*, tyProc__SsjMo29bx9bP5kwe2xgM3Scg) (NCSTRING f, ...);
typedef N_CDECL_PTR(void*, tyProc__4wJmT85lsn175X0dPNQv7w) (NI sz);
typedef N_CDECL_PTR(NI, tyProc__YRQqZC12s3573tRGP8MV3g) (void* f);
typedef N_CDECL_PTR(void*, tyProc__oPIasAghCTvCKmvkMeB1xQ) (void* f, NI i);
typedef N_CDECL_PTR(int, tyProc__6slETyyIDJuDOSqkO0hUXA) (void* f, NI i, void* v);
typedef N_CDECL_PTR(int, tyProc__tgpXIILGoVcO9bvYnz9azTVQ) (tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* f);
typedef N_CDECL_PTR(void*, tyProc__eYT4U6bGFqFBUxk9b15mfOA) (tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* f, void* a, void* b);
typedef N_CDECL_PTR(int, tyProc__T08W9bgbY4bOv2q64h6irpw) (void* m, NCSTRING n, void* o);
typedef N_CDECL_PTR(void*, tyProc__uQWqJp3WAx8fOY1h9aCwjIg) (void* callable_object, void* args, void* kw);
typedef N_CDECL_PTR(int, tyProc__fbYpjfe38x3ujjAmVRbI1Q) (void* o);
typedef N_CDECL_PTR(void*, tyProc__YezmFzxOOyM9cb11Eoq1Elg) (void* o, NCSTRING name);
typedef N_CDECL_PTR(void*, tyProc__jvPpjMAkI9bwM1B9apOphnlA) (void* o);
typedef N_CDECL_PTR(void*, tyProc__VQ1ysQk017myXMGb79cPTVw) (void* o, void* k);
typedef N_CDECL_PTR(int, tyProc__7LMjBc4zOHVIsNdulNv7QQ) (void* o, void* k, void* v);
typedef N_CDECL_PTR(int, tyProc__eoRP3F9aLT3mtHj6OkcMSyQ) (void* a, void* b, int op);
typedef N_CDECL_PTR(int, tyProc__8hR9arLDkUs9ag3Pt9bWtjfsg) (void* o, tyObject_RawPyBuffer__0qyRdSZKtLACJ1u4qMMP2w* b, int flags);
typedef N_CDECL_PTR(void, tyProc__vFvpnKOere9bRFN9czzMRlTA) (tyObject_RawPyBuffer__0qyRdSZKtLACJ1u4qMMP2w* b);
typedef N_CDECL_PTR(void*, tyProc__BZ6N5NNdHcK05FTDxQbEWw) (NCSTRING name, void* base, void* dict);
typedef N_CDECL_PTR(NI64, tyProc__mIlNZ9aGaphVJCyIIofK8mg) (void* l);
typedef N_CDECL_PTR(double, tyProc__2su9b9chqHYibM7sMkbSaSkA) (void* l);
typedef N_CDECL_PTR(void*, tyProc__RKlUmjvtmKGnc01PbvZaRQ) (long v);
typedef N_CDECL_PTR(int, tyProc__i2exZ7Vtp648U9crOFcq9beQ) (tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* t1, tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* t2);
struct tyObject_Complex__zWadV1X9aMO7qS9bsQFB0JFA {
NF re;
NF im;
};
typedef N_CDECL_PTR(tyObject_Complex__zWadV1X9aMO7qS9bsQFB0JFA, tyProc__N1A5ZvDSgO9c9aRXmVqfn9bAw) (void* op);
typedef N_CDECL_PTR(int, tyProc__3FKLKFzOaK7FD6dRLWM6Jw) (void* o, NIM_CHAR** s, NI* len);
typedef N_CDECL_PTR(void*, tyProc__YDKrw1adv61oVQkQhbYyaA) (NCSTRING s);
typedef N_CDECL_PTR(int, tyProc__B2MjSeo07a72ynTQRVYFKw) (void* o, NCSTRING s);
typedef N_CDECL_PTR(NCSTRING, tyProc__p1X2BwWx9a3wsChhykvf29aA) (void* o);
typedef N_CDECL_PTR(void*, tyProc__NzboHqZVJcbdtVGYrOosXQ) (void);
typedef N_CDECL_PTR(int, tyProc__MTei9bsKjha0o1cISO9aLMDg) (void* o, void* k);
typedef N_NIMCALL_PTR(void, tyProc__4SVlZZPmetqBimNsH9cHcOA) (void* o);
typedef N_CDECL_PTR(void, tyProc__ln4kdL5W9bbX4a1xl8nnVXQ) (void);
typedef N_CDECL_PTR(void, tyProc__WYY8i0I79agBofnUcEGCfig) (void* o, NCSTRING s);
typedef N_CDECL_PTR(void, tyProc__32w2ZypAyMWuajvi2Jt79cg) (void* o);
typedef N_CDECL_PTR(void*, tyProc__jcEovQ2rZUNUsYxohT50Ug) (void* p, NCSTRING name, tyProc__32w2ZypAyMWuajvi2Jt79cg destr);
typedef N_CDECL_PTR(void*, tyProc__9b2qzlf3LCKK0JvThQT1atg) (tyObject_PyMethodDef__9aWi1PsmvCuTKIYDHHnhfcw* md, void* self, void* module);
typedef N_CDECL_PTR(void, tyProc__U0oVFt576Ze44Q9a3eZc5wg) (void** ptype, void** pvalue, void** ptraceback);
struct tyObject_PyLibcolonObjectType___bTw708kK89b8Vj9cmSu9a4zig {
void* module;
tyProc__SsjMo29bx9bP5kwe2xgM3Scg Py_BuildValue;
tyProc__4wJmT85lsn175X0dPNQv7w PyTuple_New;
tyProc__YRQqZC12s3573tRGP8MV3g PyTuple_Size;
tyProc__oPIasAghCTvCKmvkMeB1xQ PyTuple_GetItem;
tyProc__6slETyyIDJuDOSqkO0hUXA PyTuple_SetItem;
void* Py_None;
tyProc__tgpXIILGoVcO9bvYnz9azTVQ PyType_Ready;
tyProc__eYT4U6bGFqFBUxk9b15mfOA PyType_GenericNew;
tyProc__T08W9bgbY4bOv2q64h6irpw PyModule_AddObject;
tyProc__4wJmT85lsn175X0dPNQv7w PyList_New;
tyProc__YRQqZC12s3573tRGP8MV3g PyList_Size;
tyProc__oPIasAghCTvCKmvkMeB1xQ PyList_GetItem;
tyProc__6slETyyIDJuDOSqkO0hUXA PyList_SetItem;
tyProc__uQWqJp3WAx8fOY1h9aCwjIg PyObject_Call;
tyProc__fbYpjfe38x3ujjAmVRbI1Q PyObject_IsTrue;
tyProc__YezmFzxOOyM9cb11Eoq1Elg PyObject_GetAttrString;
tyProc__T08W9bgbY4bOv2q64h6irpw PyObject_SetAttrString;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyObject_Dir;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyObject_Str;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyObject_GetIter;
tyProc__VQ1ysQk017myXMGb79cPTVw PyObject_GetItem;
tyProc__7LMjBc4zOHVIsNdulNv7QQ PyObject_SetItem;
tyProc__eoRP3F9aLT3mtHj6OkcMSyQ PyObject_RichCompareBool;
tyProc__8hR9arLDkUs9ag3Pt9bWtjfsg PyObject_GetBuffer;
tyProc__vFvpnKOere9bRFN9czzMRlTA PyBuffer_Release;
tyProc__BZ6N5NNdHcK05FTDxQbEWw PyErr_NewException;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyIter_Next;
tyProc__mIlNZ9aGaphVJCyIIofK8mg PyLong_AsLongLong;
tyProc__2su9b9chqHYibM7sMkbSaSkA PyFloat_AsDouble;
tyProc__RKlUmjvtmKGnc01PbvZaRQ PyBool_FromLong;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyBool_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyFloat_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyComplex_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyCapsule_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyTuple_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyList_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyBytes_Type;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyUnicode_Type;
tyProc__i2exZ7Vtp648U9crOFcq9beQ PyType_IsSubtype;
tyProc__N1A5ZvDSgO9c9aRXmVqfn9bAw PyComplex_AsCComplex;
tyProc__2su9b9chqHYibM7sMkbSaSkA PyComplex_RealAsDouble;
tyProc__2su9b9chqHYibM7sMkbSaSkA PyComplex_ImagAsDouble;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyUnicode_AsUTF8String;
tyProc__3FKLKFzOaK7FD6dRLWM6Jw PyBytes_AsStringAndSize;
tyProc__YDKrw1adv61oVQkQhbYyaA PyUnicode_FromString;
tyProc__B2MjSeo07a72ynTQRVYFKw PyUnicode_CompareWithASCIIString;
tyProc__p1X2BwWx9a3wsChhykvf29aA PyString_AsString;
tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* PyDict_Type;
tyProc__NzboHqZVJcbdtVGYrOosXQ PyDict_New;
tyProc__YRQqZC12s3573tRGP8MV3g PyDict_Size;
tyProc__YezmFzxOOyM9cb11Eoq1Elg PyDict_GetItemString;
tyProc__T08W9bgbY4bOv2q64h6irpw PyDict_SetItemString;
tyProc__VQ1ysQk017myXMGb79cPTVw PyDict_GetItem;
tyProc__7LMjBc4zOHVIsNdulNv7QQ PyDict_SetItem;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyDict_Keys;
tyProc__jvPpjMAkI9bwM1B9apOphnlA PyDict_Values;
tyProc__MTei9bsKjha0o1cISO9aLMDg PyDict_Contains;
tyProc__4SVlZZPmetqBimNsH9cHcOA PyDealloc;
tyProc__ln4kdL5W9bbX4a1xl8nnVXQ PyErr_Clear;
tyProc__WYY8i0I79agBofnUcEGCfig PyErr_SetString;
tyProc__NzboHqZVJcbdtVGYrOosXQ PyErr_Occurred;
void* PyExc_TypeError;
tyProc__jcEovQ2rZUNUsYxohT50Ug PyCapsule_New;
tyProc__YezmFzxOOyM9cb11Eoq1Elg PyCapsule_GetPointer;
tyProc__YDKrw1adv61oVQkQhbYyaA PyImport_ImportModule;
tyProc__NzboHqZVJcbdtVGYrOosXQ PyEval_GetBuiltins;
tyProc__NzboHqZVJcbdtVGYrOosXQ PyEval_GetGlobals;
tyProc__NzboHqZVJcbdtVGYrOosXQ PyEval_GetLocals;
tyProc__9b2qzlf3LCKK0JvThQT1atg PyCFunction_NewEx;
NI pythonVersion;
tyProc__U0oVFt576Ze44Q9a3eZc5wg PyErr_Fetch;
tyProc__U0oVFt576Ze44Q9a3eZc5wg PyErr_NormalizeException;
tyProc__MTei9bsKjha0o1cISO9aLMDg PyErr_GivenExceptionMatches;
void* PyExc_BaseException;
void* PyExc_Exception;
void* PyExc_ArithmeticError;
void* PyExc_FloatingPointError;
void* PyExc_OverflowError;
void* PyExc_ZeroDivisionError;
void* PyExc_AssertionError;
void* PyExc_OSError;
void* PyExc_IOError;
void* PyExc_ValueError;
void* PyExc_EOFError;
void* PyExc_MemoryError;
void* PyExc_IndexError;
void* PyExc_KeyError;
void* NimPyException;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct RootObj {
TNimType* m_type;
};
struct Exception {
  RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
tySequence__uB9b75OUPRENsBAu4AnoePA* trace;
Exception* up;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
NCSTRING procname;
NI line;
NCSTRING filename;
};

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__uB9b75OUPRENsBAu4AnoePA {
  TGenericSeq Sup;
  tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];
};

/* section: NIM_merge_PROC_HEADERS */
static N_INLINE(NIM_BOOL, checkObjSubclass__dy3LelvW4G2VSkE8TdlDDgpy_utils)(void* o, tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* ty);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, conversionToStringError__2YA4NXAzmPMdXt3hDLwaKQ)(void);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
static N_INLINE(void, decRef__CnqcscfOCAX2jCHv3dRPDw_2py_utils)(void* p);
static N_INLINE(tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg*, to__4gaYCHYBaCTIs6wfSrqsEApy_lib)(void* p);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);

/* section: NIM_merge_DATA */
extern TNimType NTI__vU9aO9cTqOMn6CBzhV8rX7Sw_;
extern TNimType NTI__XEycrCsme5C8CVWAYEcdBQ_;
STRING_LITERAL(TM__yNJ2G9b01RlVILlUjgj0ESA_2, "Can\'t convert python obj to string", 34);

/* section: NIM_merge_VARS */
extern tyObject_PyLibcolonObjectType___bTw708kK89b8Vj9cmSu9a4zig* pyLib__nxKBiAukGMNwnUq9bpn9adyw;
extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern NU pyObjectStartOffset__g20dGCi2MffsHqmxIpqX7Q;

/* section: NIM_merge_PROCS */
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
static N_INLINE(NIM_BOOL, checkObjSubclass__dy3LelvW4G2VSkE8TdlDDgpy_utils)(void* o, tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* ty) {
	NIM_BOOL result;
	tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g* typ;
	NIM_BOOL T1_;
	int T3_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	typ = ((tyObject_PyTypeObject3Obj__cRsC9bGvH9bX6A9aVx8UB6I5g*) ((*((tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg*) (o))).ob_type));
	T1_ = (NIM_BOOL)0;
	T1_ = (ty == typ);
	if (T1_) goto LA2_;
	T3_ = (int)0;
	T3_ = (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyType_IsSubtype(typ, ty);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T1_ = !((T3_ == ((NI32) 0)));
	LA2_: ;
	result = T1_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, conversionToStringError__2YA4NXAzmPMdXt3hDLwaKQ)(void) {
	Exception* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	(*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyErr_Clear();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T1_ = (Exception*)0;
	T1_ = (Exception*) newObj((&NTI__vU9aO9cTqOMn6CBzhV8rX7Sw_), sizeof(Exception));
	(*T1_).Sup.m_type = (&NTI__XEycrCsme5C8CVWAYEcdBQ_);
	(*T1_).name = "Exception";
	(*T1_).message = copyString(((NimStringDesc*) &TM__yNJ2G9b01RlVILlUjgj0ESA_2));
	(*T1_).parent = NIM_NIL;
	raiseExceptionEx((Exception*)T1_, "Exception", "conversionToStringError", "py_utils.nim", 25);
	goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg*, to__4gaYCHYBaCTIs6wfSrqsEApy_lib)(void* p) {
	tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg* result;
	result = (tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg*)0;
	result = ((tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg*) ((NU)((NU64)(((NU) (ptrdiff_t) (p))) + (NU64)(pyObjectStartOffset__g20dGCi2MffsHqmxIpqX7Q))));
	return result;
}
static N_INLINE(void, decRef__CnqcscfOCAX2jCHv3dRPDw_2py_utils)(void* p) {
	tyObject_PyObjectObj__aD5pkFWInXrZXinZ42cDEg* o;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	o = to__4gaYCHYBaCTIs6wfSrqsEApy_lib(p);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*o).ob_refcnt -= ((NI) 1);
	{
		if (!((*o).ob_refcnt == ((NI) 0))) goto LA3_;
		(*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyDealloc(p);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	}BeforeRet_: ;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, pyStringToNim__9cjH8eaYe0aMdbQ9bg4rwiDw)(void* o, NimStringDesc** output) {
	NIM_BOOL result;
	NIM_CHAR* s;
	NI l;
	void* b;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	s = (NIM_CHAR*)0;
	l = (NI)0;
	b = (void*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = checkObjSubclass__dy3LelvW4G2VSkE8TdlDDgpy_utils(o, (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyUnicode_Type);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T3_) goto LA4_;
		b = (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyUnicode_AsUTF8String(o);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		{
			if (!(b == 0)) goto LA8_;
			conversionToStringError__2YA4NXAzmPMdXt3hDLwaKQ();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA8_: ;
		{
			int T12_;
			T12_ = (int)0;
			T12_ = (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyBytes_AsStringAndSize(b, &s, (&l));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!((T12_ == ((NI32) 0)))) goto LA13_;
			decRef__CnqcscfOCAX2jCHv3dRPDw_2py_utils(b);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			conversionToStringError__2YA4NXAzmPMdXt3hDLwaKQ();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA13_: ;
	}
	goto LA1_;
	LA4_: ;
	{
		NIM_BOOL T16_;
		T16_ = (NIM_BOOL)0;
		T16_ = checkObjSubclass__dy3LelvW4G2VSkE8TdlDDgpy_utils(o, (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyBytes_Type);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T16_) goto LA17_;
		{
			int T21_;
			T21_ = (int)0;
			T21_ = (*pyLib__nxKBiAukGMNwnUq9bpn9adyw).PyBytes_AsStringAndSize(o, &s, (&l));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!((T21_ == ((NI32) 0)))) goto LA22_;
			conversionToStringError__2YA4NXAzmPMdXt3hDLwaKQ();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA22_: ;
	}
	goto LA1_;
	LA17_: ;
	{
		goto BeforeRet_;
	}
	LA1_: ;
	(*output) = mnewString(((NI) (l)));
	{
		if (!!((l == ((NI) 0)))) goto LA27_;
		copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&(*output)->data[((NI) 0)]))), ((void*) (s)), ((NI) (l)));
	}
	LA27_: ;
	{
		if (!!((b == 0))) goto LA31_;
		decRef__CnqcscfOCAX2jCHv3dRPDw_2py_utils(b);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA31_: ;
	result = NIM_TRUE;
	}BeforeRet_: ;
	return result;
}
