/* 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>
#include <windows.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_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Exception Exception;
typedef struct tySequence__aNpJjaoUowCQc7fBn3wtDQ tySequence__aNpJjaoUowCQc7fBn3wtDQ;
typedef struct TSafePoint TSafePoint;
typedef struct GcFrameHeader GcFrameHeader;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_SharedList__JI9cx34TL8n3aOKF6tSMBUw tyObject_SharedList__JI9cx34TL8n3aOKF6tSMBUw;
typedef struct tyObject_SharedListNodecolonObjectType___KGw0YAw6W9aSz3Sr9aXGu7zg tyObject_SharedListNodecolonObjectType___KGw0YAw6W9aSz3Sr9aXGu7zg;
typedef struct tyObject_TimezonecolonObjectType___F8OvqlxXyGXRSiK9c1fCDVw tyObject_TimezonecolonObjectType___F8OvqlxXyGXRSiK9c1fCDVw;
typedef struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ tySequence__sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct tyObject_PDispatchercolonObjectType___mNiwh37MfaAP9cG4kqT6kpg tyObject_PDispatchercolonObjectType___mNiwh37MfaAP9cG4kqT6kpg;
typedef struct tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w;

/* section: NIM_merge_TYPES */
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NF tyArray__iV2wVpdhi9coq9cstlcqapXg[2001];
struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg {
tyArray__iV2wVpdhi9coq9cstlcqapXg tls;
};
typedef NI16 tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag[1];
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;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__9axCnCRMUx32AHzFgBrzSMg) (Exception* e);
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI collections;
NI maxThreshold;
NI maxStackSize;
NI freedObjects;
};
struct tyObject_SharedList__JI9cx34TL8n3aOKF6tSMBUw {
tyObject_SharedListNodecolonObjectType___KGw0YAw6W9aSz3Sr9aXGu7zg* head;
tyObject_SharedListNodecolonObjectType___KGw0YAw6W9aSz3Sr9aXGu7zg* tail;
CRITICAL_SECTION lock;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_SharedList__JI9cx34TL8n3aOKF6tSMBUw toDispose;
NI gcThreadId;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
};
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyProc__HzVCwACFYM9cx9aV62PdjtuA cbproc, void* ClE_0);
void* ClE_0;
} tyProc__VHS3NdmbwcdcZKmKV1JWhw;

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__aNpJjaoUowCQc7fBn3wtDQ {
  TGenericSeq Sup;
  tyProc__HzVCwACFYM9cx9aV62PdjtuA data[SEQ_DECL_SIZE];
};
struct tySequence__sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
typedef struct {tyProc__9axCnCRMUx32AHzFgBrzSMg localRaiseHook__EIvMhANBvB9cp2Ezvt29cADg;
NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
tySequence__aNpJjaoUowCQc7fBn3wtDQ* threadDestructionHandlers__8OmU3x0fNdA0DLtOmU3kWw;
NI threadId__wzrdPYhtL9czkCWS4o9an9cRw;
TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
TSafePoint* excHandler__rqLlY5bs9atDw2OXYqJEn5g;
Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
GcFrameHeader* gcFramePtr__ot48iojqko9aFxGhyjjjVaA;
tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
tyObject_TimezonecolonObjectType___F8OvqlxXyGXRSiK9c1fCDVw* utcInstance__oeKVHn4dFpBJO35HhEkelw;
tyObject_TimezonecolonObjectType___F8OvqlxXyGXRSiK9c1fCDVw* localInstance__cLtN9cK9bCe6IPhJ3UFNLNKA;
NIM_BOOL envComputed__LLyFo9bsdu1ZXMDvAe8DhrQ;
tySequence__sM4lkSb7zS6F7OVMvW9cffQ* environment__mlhK49b6YMgc9cgrcYkKq9a3g;
tySequence__sM4lkSb7zS6F7OVMvW9cffQ* ownArgv__WVJ54JSHy7VxacV39bwBPFA;
NIM_BOOL ownParsedArgv__9btHydaUC5pNXxitEZsyzIg;
tyProc__VHS3NdmbwcdcZKmKV1JWhw callSoonProc__9b9b4iUSd60RO2UqC52ifJ6A;
tyObject_PDispatchercolonObjectType___mNiwh37MfaAP9cG4kqT6kpg* gDisp__yIbBArLUsg2pBJkilx4yvg;
tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* defaultSslContext__3GZQajZtKdLpqTTN2RjTzw;
NIM_BOOL isSlave__t9a8wsVVRYqGEKhg1vb49b3g;
NIM_BOOL pyThreadFrameInited__0LBR4zzVR5uWvgtv8SrMjg;
NIM_BOOL gcInited__uuy3PWTwb5gov9ao9bXJYBPg;
} NimThreadVars;

/* section: NIM_merge_PROC_HEADERS */
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___NmQ9ct6KsQm3mcX4z6BEBbA)(NI16* w, NI estimate, NI replacement);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_LIB_PRIVATE N_NIMCALL(NI, ord__N9bsHhIEUMfKbgZ9aJBy6m2A)(NI16 arg);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void*, GetThreadLocalVars)(void);
N_LIB_PRIVATE N_NIMCALL(void*, threadVarGetValue__O8VJSmwa3WY6y9bP6Ht9b7hw)(NI32 dwTlsIndex);
N_LIB_PRIVATE N_NIMCALL(NI16*, newWideCString__K8rR70TBwrP6FNBzDhVVOA)(NCSTRING source, NI L);
static N_NIMCALL(void, Marker_tyRef__4HwedE75WPfqZSQ0Cq2OUg)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
static N_INLINE(NI, nimCStrLen)(NCSTRING a);

/* section: NIM_merge_DATA */
extern TNimType NTI__kDPg4wXyR8DDyA0MeEjIsw_;
N_LIB_PRIVATE TNimType NTI__Tyd4y3haUOOHTj71TPIRag_;
N_LIB_PRIVATE TNimType NTI__4HwedE75WPfqZSQ0Cq2OUg_;

/* section: NIM_merge_VARS */
extern NI32 globalsSlot__ciXDZu9c27pHpCRMoz4RIgw;

/* section: NIM_merge_PROCS */
N_LIB_PRIVATE N_NIMCALL(NI, ord__N9bsHhIEUMfKbgZ9aJBy6m2A)(NI16 arg) {
	NI result;
	result = (NI)0;
	result = ((NI) (((NU16) (arg))));
	return result;
}
static N_INLINE(void*, GetThreadLocalVars)(void) {
	void* result;
	void* T1_;
	result = (void*)0;
	T1_ = (void*)0;
	T1_ = threadVarGetValue__O8VJSmwa3WY6y9bP6Ht9b7hw(globalsSlot__ciXDZu9c27pHpCRMoz4RIgw);
	result = ((void*) ((*((tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg*) (T1_))).tls));
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	NimThreadVars* NimTV_;
	NimTV_ = (NimThreadVars*) GetThreadLocalVars();
	result = (NIM_BOOL*)0;
	result = (&NimTV_->nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___NmQ9ct6KsQm3mcX4z6BEBbA)(NI16* w, NI estimate, NI replacement) {
	NimStringDesc* result;
	NI i;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NimStringDesc*)0;
	result = rawNewString(((NI) ((NI)(estimate + (NI)((NI64)(estimate) >> (NU64)(((NI) 2)))))));
	i = ((NI) 0);
	{
		while (1) {
			NI ch;
			if (!!((w[i] == ((NI16) 0)))) goto LA2;
			ch = ord__N9bsHhIEUMfKbgZ9aJBy6m2A(w[i]);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			i += ((NI) 1);
			{
				NIM_BOOL T5_;
				NI ch2;
				T5_ = (NIM_BOOL)0;
				T5_ = (((NI) 55296) <= ch);
				if (!(T5_)) goto LA6_;
				T5_ = (ch <= ((NI) 56319));
				LA6_: ;
				if (!T5_) goto LA7_;
				ch2 = ord__N9bsHhIEUMfKbgZ9aJBy6m2A(w[i]);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T11_;
					T11_ = (NIM_BOOL)0;
					T11_ = (((NI) 56320) <= ch2);
					if (!(T11_)) goto LA12_;
					T11_ = (ch2 <= ((NI) 57343));
					LA12_: ;
					if (!T11_) goto LA13_;
					ch = (NI)((NI)((NI)((NU64)((NI)(ch & ((NI) 1023))) << (NU64)(((NI) 10))) + (NI)(ch2 & ((NI) 1023))) + ((NI) 65536));
					i += ((NI) 1);
				}
				goto LA9_;
				LA13_: ;
				{
					ch = replacement;
				}
				LA9_: ;
			}
			goto LA3_;
			LA7_: ;
			{
				NIM_BOOL T17_;
				T17_ = (NIM_BOOL)0;
				T17_ = (((NI) 56320) <= ch);
				if (!(T17_)) goto LA18_;
				T17_ = (ch <= ((NI) 57343));
				LA18_: ;
				if (!T17_) goto LA19_;
				ch = replacement;
			}
			goto LA3_;
			LA19_: ;
			LA3_: ;
			{
				if (!(ch < ((NI) 128))) goto LA23_;
				result = addChar(result, ((NIM_CHAR) (((NI) (ch)))));
			}
			goto LA21_;
			LA23_: ;
			{
				if (!(ch < ((NI) 2048))) goto LA26_;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 6))) | ((NI) 192)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)(ch & ((NI) 63)) | ((NI) 128)))))));
			}
			goto LA21_;
			LA26_: ;
			{
				if (!(ch < ((NI) 65536))) goto LA29_;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 12))) | ((NI) 224)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 6))) & ((NI) 63)) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)(ch & ((NI) 63)) | ((NI) 128)))))));
			}
			goto LA21_;
			LA29_: ;
			{
				if (!(ch <= ((NI) 1114111))) goto LA32_;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 18))) | ((NI) 240)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 12))) & ((NI) 63)) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NI)((NI64)(ch) >> (NU64)(((NI) 6))) & ((NI) 63)) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)(ch & ((NI) 63)) | ((NI) 128)))))));
			}
			goto LA21_;
			LA32_: ;
			{
				result = addChar(result, 239);
				result = addChar(result, 191);
				result = addChar(result, 189);
			}
			LA21_: ;
		} LA2: ;
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___NleKxkskBzDhxdrvP1WL7A)(NI16* s) {
	NimStringDesc* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NimStringDesc*)0;
	result = dollar___NmQ9ct6KsQm3mcX4z6BEBbA(s, ((NI) 80), ((NI) 65533));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_NIMCALL(void, Marker_tyRef__4HwedE75WPfqZSQ0Cq2OUg)(void* p, NI op) {
	NI16* a;
	a = (NI16*)p;
}
N_LIB_PRIVATE N_NIMCALL(NI16*, newWideCString__K8rR70TBwrP6FNBzDhVVOA)(NCSTRING source, NI L) {
	NI16* result;
	NI d;
	result = (NI16*)0;
	result = (NI16*) newObj((&NTI__4HwedE75WPfqZSQ0Cq2OUg_), ((NI) ((NI)((NI)(L * ((NI) 2)) + ((NI) 2)))));
	d = ((NI) 0);
	{
		NI ch;
		NI i;
		NI result_2;
		ch = (NI)0;
		i = ((NI) 0);
		result_2 = (NI)0;
		{
			while (1) {
				if (!(i < L)) goto LA3;
				{
					if (!(((NU8)(source[i])) <= ((NI) 127))) goto LA6_;
					result_2 = ((NU8)(source[i]));
					i += ((NI) 1);
				}
				goto LA4_;
				LA6_: ;
				{
					if (!((NI)((NI64)(((NU8)(source[i]))) >> (NU64)(((NI) 5))) == ((NI) 6))) goto LA9_;
					{
						if (!(i <= (NI)(L - ((NI) 2)))) goto LA13_;
						result_2 = (NI)((NI)((NU64)((NI)(((NU8)(source[i])) & ((NI) 31))) << (NU64)(((NI) 6))) | (NI)(((NU8)(source[(NI)(i + ((NI) 1))])) & ((NI) 63)));
						i += ((NI) 2);
					}
					goto LA11_;
					LA13_: ;
					{
						result_2 = ((NI) 65533);
						i += ((NI) 1);
					}
					LA11_: ;
				}
				goto LA4_;
				LA9_: ;
				{
					if (!((NI)((NI64)(((NU8)(source[i]))) >> (NU64)(((NI) 4))) == ((NI) 14))) goto LA17_;
					{
						if (!(i <= (NI)(L - ((NI) 3)))) goto LA21_;
						result_2 = (NI)((NI)((NI)((NU64)((NI)(((NU8)(source[i])) & ((NI) 15))) << (NU64)(((NI) 12))) | (NI)((NU64)((NI)(((NU8)(source[(NI)(i + ((NI) 1))])) & ((NI) 63))) << (NU64)(((NI) 6)))) | (NI)(((NU8)(source[(NI)(i + ((NI) 2))])) & ((NI) 63)));
						i += ((NI) 3);
					}
					goto LA19_;
					LA21_: ;
					{
						result_2 = ((NI) 65533);
						i += ((NI) 1);
					}
					LA19_: ;
				}
				goto LA4_;
				LA17_: ;
				{
					if (!((NI)((NI64)(((NU8)(source[i]))) >> (NU64)(((NI) 3))) == ((NI) 30))) goto LA25_;
					{
						if (!(i <= (NI)(L - ((NI) 4)))) goto LA29_;
						result_2 = (NI)((NI)((NI)((NI)((NU64)((NI)(((NU8)(source[i])) & ((NI) 7))) << (NU64)(((NI) 18))) | (NI)((NU64)((NI)(((NU8)(source[(NI)(i + ((NI) 1))])) & ((NI) 63))) << (NU64)(((NI) 12)))) | (NI)((NU64)((NI)(((NU8)(source[(NI)(i + ((NI) 2))])) & ((NI) 63))) << (NU64)(((NI) 6)))) | (NI)(((NU8)(source[(NI)(i + ((NI) 3))])) & ((NI) 63)));
						i += ((NI) 4);
					}
					goto LA27_;
					LA29_: ;
					{
						result_2 = ((NI) 65533);
						i += ((NI) 1);
					}
					LA27_: ;
				}
				goto LA4_;
				LA25_: ;
				{
					result_2 = ((NI) 65533);
					i += ((NI) 1);
				}
				LA4_: ;
				ch = result_2;
				{
					if (!(ch <= ((NI) 65535))) goto LA35_;
					{
						NIM_BOOL T39_;
						T39_ = (NIM_BOOL)0;
						T39_ = (((NI) 55296) <= ch);
						if (!(T39_)) goto LA40_;
						T39_ = (ch <= ((NI) 57343));
						LA40_: ;
						if (!T39_) goto LA41_;
						result[d] = ((NI16) -3);
					}
					goto LA37_;
					LA41_: ;
					{
						result[d] = ((NI16) (((NU16) (ch))));
					}
					LA37_: ;
				}
				goto LA33_;
				LA35_: ;
				{
					if (!(((NI) 1114111) < ch)) goto LA45_;
					result[d] = ((NI16) -3);
				}
				goto LA33_;
				LA45_: ;
				{
					NI ch_2;
					ch_2 = (NI)(ch - ((NI) 65536));
					result[d] = ((NI16) (((NU16) ((NI)((NI)((NI64)(ch_2) >> (NU64)(((NI) 10))) + ((NI) 55296))))));
					d += ((NI) 1);
					result[d] = ((NI16) (((NU16) ((NI)((NI)(ch_2 & ((NI) 1023)) + ((NI) 56320))))));
				}
				LA33_: ;
				d += ((NI) 1);
			} LA3: ;
		}
	}
	result[d] = ((NI16) 0);
	return result;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
	NCSTRING result;
	result = (NCSTRING)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (s == NIM_NIL);
		if (T3_) goto LA4_;
		T3_ = ((*s).Sup.len == ((NI) 0));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = "";
	}
	goto LA1_;
	LA5_: ;
	{
		result = ((NCSTRING) ((*s).data));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI16*, newWideCString__rFkWhJjmVi0m0Hc9agVEZIQ)(NimStringDesc* s) {
	NI16* result;
	NimStringDesc* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI16*)0;
	T1_ = (NimStringDesc*)0;
	T1_ = s;
	result = newWideCString__K8rR70TBwrP6FNBzDhVVOA(nimToCStringConv(T1_), (s ? s->Sup.len : 0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI, nimCStrLen)(NCSTRING a) {
	NI result;
	size_t T1_;
	result = (NI)0;
	T1_ = (size_t)0;
	T1_ = strlen(a);
	result = ((NI) (T1_));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI16*, newWideCString__G8rSmf9akUNUzuZWlrfFAmA)(NCSTRING s) {
	NI16* result;
	NCSTRING T5_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI16*)0;
	{
		if (!(s == 0)) goto LA3_;
		result = NIM_NIL;
		goto BeforeRet_;
	}
	LA3_: ;
	T5_ = (NCSTRING)0;
	T5_ = s;
	result = newWideCString__K8rR70TBwrP6FNBzDhVVOA(T5_, (s ? nimCStrLen(s) : 0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, stdlib_widestrsDatInit000)(void) {

/* section: NIM_merge_TYPE_INIT3 */
NTI__Tyd4y3haUOOHTj71TPIRag_.size = sizeof(tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag);
NTI__Tyd4y3haUOOHTj71TPIRag_.align = NIM_ALIGNOF(tyUncheckedArray__Tyd4y3haUOOHTj71TPIRag);
NTI__Tyd4y3haUOOHTj71TPIRag_.kind = 49;
NTI__Tyd4y3haUOOHTj71TPIRag_.base = (&NTI__kDPg4wXyR8DDyA0MeEjIsw_);
NTI__Tyd4y3haUOOHTj71TPIRag_.flags = 3;
NTI__4HwedE75WPfqZSQ0Cq2OUg_.size = sizeof(NI16*);
NTI__4HwedE75WPfqZSQ0Cq2OUg_.align = NIM_ALIGNOF(NI16*);
NTI__4HwedE75WPfqZSQ0Cq2OUg_.kind = 22;
NTI__4HwedE75WPfqZSQ0Cq2OUg_.base = (&NTI__Tyd4y3haUOOHTj71TPIRag_);
NTI__4HwedE75WPfqZSQ0Cq2OUg_.flags = 2;
NTI__4HwedE75WPfqZSQ0Cq2OUg_.marker = Marker_tyRef__4HwedE75WPfqZSQ0Cq2OUg;
}

