/* Generated by Nim Compiler v0.12.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <setjmp.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
typedef struct Tnode225809 Tnode225809;
typedef struct Ttype225847 Ttype225847;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct Tidobj198015 Tidobj198015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq225843 Ttypeseq225843;
typedef struct Tsym225841 Tsym225841;
typedef struct Tloc225823 Tloc225823;
typedef struct Ropeobj176009 Ropeobj176009;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident198021 Tident198021;
typedef struct Tscope225835 Tscope225835;
typedef struct TY225944 TY225944;
typedef struct Tstrtable225813 Tstrtable225813;
typedef struct Tsymseq225811 Tsymseq225811;
typedef struct Tlib225827 Tlib225827;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Tnodeseq225803 Tnodeseq225803;
typedef struct Exception Exception;
typedef struct TSafePoint TSafePoint;
typedef struct Processobj156407 Processobj156407;
typedef struct Stringtableobj145212 Stringtableobj145212;
typedef struct Streamobj149427 Streamobj149427;
typedef struct Tinstantiation225831 Tinstantiation225831;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Keyvaluepairseq145210 Keyvaluepairseq145210;
typedef struct TY225932 TY225932;
typedef struct Keyvaluepair145208 Keyvaluepair145208;
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tloc225823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype225847* t;
Ropeobj176009* r;
Ropeobj176009* heaproot;
};
struct  Ttype225847  {
  Tidobj198015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq225843* sons;
Tnode225809* n;
Tsym225841* owner;
Tsym225841* sym;
Tsym225841* destructor;
Tsym225841* deepcopy;
Tsym225841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc225823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tstrtable225813  {
NI counter;
Tsymseq225811* data;
};
struct  Tsym225841  {
  Tidobj198015 Sup;
NU8 kind;
union{
struct {Ttypeseq225843* typeinstcache;
Tscope225835* typscope;
} S1;
struct {TY225944* procinstcache;
Tsym225841* gcunsafetyreason;
} S2;
struct {TY225944* usedgenerics;
Tstrtable225813 tab;
} S3;
struct {Tsym225841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype225847* typ;
Tident198021* name;
Tlineinfo190352 info;
Tsym225841* owner;
NU32 flags;
Tnode225809* ast;
NU32 options;
NI position;
NI offset;
Tloc225823 loc;
Tlib225827* annex;
Tnode225809* constraint;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  Tnode225809  {
Ttype225847* typ;
Tlineinfo190352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym225841* sym;
} S4;
struct {Tident198021* ident;
} S5;
struct {Tnodeseq225803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Exception* e, void* ClEnv);
void* ClEnv;
} TY19211;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY19211 raiseAction;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Tnode225809* TY243880[1];
typedef NU8 Sha1digest201009[20];
typedef NimStringDesc* TY253724[1];
struct  Ropeobj176009  {
  TNimObject Sup;
Ropeobj176009* left;
Ropeobj176009* right;
NI length;
NimStringDesc* data;
};
struct  Tscope225835  {
NI depthlevel;
Tstrtable225813 symbols;
Tnodeseq225803* usingsyms;
Tscope225835* parent;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib225827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj176009* name;
Tnode225809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Processobj156407  {
  TNimObject Sup;
int inhandle;
int outhandle;
int errhandle;
Streamobj149427* instream;
Streamobj149427* outstream;
Streamobj149427* errstream;
pid_t id;
int exitcode;
NU8 options;
};
struct  Stringtableobj145212  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq145210* data;
NU8 mode;
};
typedef N_NIMCALL_PTR(void, TY149428) (Streamobj149427* s);
typedef N_NIMCALL_PTR(NIM_BOOL, TY149432) (Streamobj149427* s);
typedef N_NIMCALL_PTR(void, TY149436) (Streamobj149427* s, NI pos);
typedef N_NIMCALL_PTR(NI, TY149441) (Streamobj149427* s);
typedef N_NIMCALL_PTR(NI, TY149445) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(NI, TY149451) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY149457) (Streamobj149427* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY149463) (Streamobj149427* s);
struct  Streamobj149427  {
  TNimObject Sup;
TY149428 closeimpl;
TY149432 atendimpl;
TY149436 setpositionimpl;
TY149441 getpositionimpl;
TY149445 readdataimpl;
TY149451 peekdataimpl;
TY149457 writedataimpl;
TY149463 flushimpl;
};
struct  Tinstantiation225831  {
Tsym225841* sym;
Ttypeseq225843* concretetypes;
TY225932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct Keyvaluepair145208 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct Tnodeseq225803 {
  TGenericSeq Sup;
  Tnode225809* data[SEQ_DECL_SIZE];
};
struct Ttypeseq225843 {
  TGenericSeq Sup;
  Ttype225847* data[SEQ_DECL_SIZE];
};
struct TY225944 {
  TGenericSeq Sup;
  Tinstantiation225831* data[SEQ_DECL_SIZE];
};
struct Tsymseq225811 {
  TGenericSeq Sup;
  Tsym225841* data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq145210 {
  TGenericSeq Sup;
  Keyvaluepair145208 data[SEQ_DECL_SIZE];
};
struct TY225932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tnode225809*, maptypetoast_428089)(Ttype225847* t, Tlineinfo190352 info, NIM_BOOL allowrecursion);
N_NIMCALL(Tnode225809*, atomictypex_428075)(NimStringDesc* name, Ttype225847* t, Tlineinfo190352 info);
N_NIMCALL(Tsym225841*, newsym_226656)(NU8 symkind, Tident198021* name, Tsym225841* owner, Tlineinfo190352 info);
N_NIMCALL(Tident198021*, getident_198463)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(Tnode225809*, newsymnode_227325)(Tsym225841* sym);
N_NIMCALL(Tnode225809*, newnodeit_227807)(NU8 kind, Tlineinfo190352 info, Ttype225847* typ);
N_NIMCALL(void, add_226165)(Tnode225809* father, Tnode225809* son);
N_NIMCALL(Ttype225847*, base_255039)(Ttype225847* t);
N_NIMCALL(NI, len_228369)(Ttype225847* n);
N_NIMCALL(Ttype225847*, lastson_228426)(Ttype225847* n);
N_NIMCALL(Tnode225809*, maptypetobracket_428097)(NimStringDesc* name, Ttype225847* t, Tlineinfo190352 info);
N_NIMCALL(Ttype225847*, newtype_228140)(NU8 kind, Tsym225841* owner);
N_NIMCALL(Tnode225809*, copytree_230028)(Tnode225809* src);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_NIMCALL(NimStringDesc*, findfile_168539)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, readfile_16872)(NimStringDesc* filename);
N_NIMCALL(void, appendtomodule_226911)(Tsym225841* m, Tnode225809* n);
N_NIMCALL(Tnode225809*, newnode_227607)(NU8 kind, Tlineinfo190352 info, Tnodeseq225803* sons, Ttype225847* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(Tnode225809*, newstrnode_226644)(NU8 kind, NimStringDesc* strval);
static N_INLINE(void, popSafePoint)(void);
N_NIMCALL(NIM_BOOL, isObj)(TNimType* obj, TNimType* subclass);
static N_INLINE(Exception*, getCurrentException)(void);
N_NIMCALL(void, localerror_196128)(Tlineinfo190352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
static N_INLINE(void, popCurrentException)(void);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_55022)(Cell48947* c);
static N_INLINE(NIM_BOOL, canbecycleroot_52667)(Cell48947* c);
static N_INLINE(void, rtladdcycleroot_53423)(Cell48947* c);
N_NOINLINE(void, incl_49665)(Cellset48959* s, Cell48947* cell);
static N_INLINE(void, decref_54604)(Cell48947* c);
N_NIMCALL(void, reraiseException)(void);
N_NIMCALL(void, securehash_201023)(NimStringDesc* str, Sha1digest201009* Result);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(NimStringDesc*, togeneratedfile_168158)(NimStringDesc* path, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, HEX24_201044)(Sha1digest201009 self);
N_NIMCALL(NIM_BOOL, open_16803)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(NimStringDesc*, readall_16869)(FILE* file);
N_NIMCALL(Processobj156407*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingdir, NimStringDesc** args, NI argsLen0, Stringtableobj145212* env, NU8 options);
N_NIMCALL(void, write_149683)(Streamobj149427* s, NimStringDesc* x);
N_NIMCALL(Streamobj149427*, nospinputStream)(Processobj156407* p);
N_NIMCALL(void, close_149491)(Streamobj149427* s);
N_NIMCALL(NimStringDesc*, readoutput_428009)(Processobj156407* p);
N_NIMCALL(Streamobj149427*, nospoutputStream)(Processobj156407* p);
N_NIMCALL(NIM_BOOL, atend_149517)(Streamobj149427* s);
N_NIMCALL(NimStringDesc*, readline_150477)(Streamobj149427* s);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
N_NIMCALL(NI, nospwaitForExit)(Processobj156407* p, NI timeout);
N_NIMCALL(void, writefile_16875)(NimStringDesc* filename, NimStringDesc* content);
STRING_LITERAL(TMP2946, "none", 4);
STRING_LITERAL(TMP2947, "bool", 4);
STRING_LITERAL(TMP2948, "char", 4);
STRING_LITERAL(TMP2949, "nil", 3);
STRING_LITERAL(TMP2950, "expr", 4);
STRING_LITERAL(TMP2951, "stmt", 4);
STRING_LITERAL(TMP2952, "void", 4);
STRING_LITERAL(TMP2953, "array", 5);
STRING_LITERAL(TMP2954, "typeDesc", 8);
STRING_LITERAL(TMP2955, "typeDesc", 8);
STRING_LITERAL(TMP2956, "void", 4);
STRING_LITERAL(TMP2957, "distinct", 8);
STRING_LITERAL(TMP2958, "tuple", 5);
STRING_LITERAL(TMP2959, "set", 3);
STRING_LITERAL(TMP2960, "ptr", 3);
STRING_LITERAL(TMP2961, "ref", 3);
STRING_LITERAL(TMP2962, "var", 3);
STRING_LITERAL(TMP2963, "seq", 3);
STRING_LITERAL(TMP2964, "proc", 4);
STRING_LITERAL(TMP2965, "openArray", 9);
STRING_LITERAL(TMP2966, "range", 5);
STRING_LITERAL(TMP2967, "pointer", 7);
STRING_LITERAL(TMP2968, "string", 6);
STRING_LITERAL(TMP2969, "cstring", 7);
STRING_LITERAL(TMP2970, "int", 3);
STRING_LITERAL(TMP2971, "int8", 4);
STRING_LITERAL(TMP2972, "int16", 5);
STRING_LITERAL(TMP2973, "int32", 5);
STRING_LITERAL(TMP2974, "int64", 5);
STRING_LITERAL(TMP2975, "float", 5);
STRING_LITERAL(TMP2976, "float32", 7);
STRING_LITERAL(TMP2977, "float64", 7);
STRING_LITERAL(TMP2978, "float128", 8);
STRING_LITERAL(TMP2979, "uint", 4);
STRING_LITERAL(TMP2980, "uint8", 5);
STRING_LITERAL(TMP2981, "uint16", 6);
STRING_LITERAL(TMP2982, "uint32", 6);
STRING_LITERAL(TMP2983, "uint64", 6);
STRING_LITERAL(TMP2984, "bignum", 6);
STRING_LITERAL(TMP2985, "const", 5);
STRING_LITERAL(TMP2986, "mutable", 7);
STRING_LITERAL(TMP2987, "varargs", 7);
STRING_LITERAL(TMP2988, "iter", 4);
STRING_LITERAL(TMP2989, "error", 5);
STRING_LITERAL(TMP2990, "builtinTypeClass", 16);
STRING_LITERAL(TMP2991, "concept", 7);
STRING_LITERAL(TMP2992, "compositeTypeClass", 18);
STRING_LITERAL(TMP2993, "and", 3);
STRING_LITERAL(TMP2994, "or", 2);
STRING_LITERAL(TMP2995, "not", 3);
STRING_LITERAL(TMP2996, "anything", 8);
STRING_LITERAL(TMP2997, "static", 6);
STRING_LITERAL(TMP3001, "", 0);
STRING_LITERAL(TMP3002, "\011", 1);
STRING_LITERAL(TMP3003, "gorge_", 6);
STRING_LITERAL(TMP3004, "txt", 3);
STRING_LITERAL(TMP3021, "\012", 1);
extern Gcheap51018 gch_51059;
extern Tnode225809* emptynode_226807;
extern TSafePoint* exchandler_20843;
extern TNimType NTI225803; /* TNodeSeq */
extern TNimType NTI4031; /* IOError */
extern Exception* currexception_20845;
extern TNimType NTI4033; /* OSError */

static N_INLINE(Cell48947*, usrtocell_52646)(void* usr) {
	Cell48947* result;
	result = 0;
	result = ((Cell48947*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Cell48947))))));
	return result;
}

static N_INLINE(void, rtladdzct_54204)(Cell48947* c) {
	addzct_52617((&gch_51059.zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Cell48947* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_52646(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell48947* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_52646((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(Tnode225809*, atomictypex_428075)(NimStringDesc* name, Ttype225847* t, Tlineinfo190352 info) {
	Tnode225809* result;
	Tsym225841* sym;
	Tident198021* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_198463(name);
	sym = newsym_226656(((NU8) 7), LOC1, (*t).owner, info);
	asgnRefNoCycle((void**) (&(*sym).typ), t);
	result = newsymnode_227325(sym);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	return result;
}

N_NIMCALL(Tnode225809*, maptypetobracket_428097)(NimStringDesc* name, Ttype225847* t, Tlineinfo190352 info) {
	Tnode225809* result;
	Tnode225809* LOC1;
	result = 0;
	result = newnodeit_227807(((NU8) 42), info, t);
	LOC1 = 0;
	LOC1 = atomictypex_428075(name, t, info);
	add_226165(result, LOC1);
	{
		NI i_428122;
		NI HEX3Atmp_428139;
		NI LOC3;
		NI res_428142;
		i_428122 = 0;
		HEX3Atmp_428139 = 0;
		LOC3 = 0;
		LOC3 = len_228369(t);
		HEX3Atmp_428139 = (LOC3 - 1);
		res_428142 = ((NI) 0);
		{
			while (1) {
				if (!(res_428142 <= HEX3Atmp_428139)) goto LA5;
				i_428122 = res_428142;
				{
					Tnode225809* void_428135;
					if (!((*t).sons->data[i_428122] == NIM_NIL)) goto LA8;
					void_428135 = atomictypex_428075(((NimStringDesc*) &TMP2956), t, info);
					asgnRefNoCycle((void**) (&(*void_428135).typ), newtype_228140(((NU8) 3), (*t).owner));
					add_226165(result, void_428135);
				}
				goto LA6;
				LA8: ;
				{
					Tnode225809* LOC11;
					LOC11 = 0;
					LOC11 = maptypetoast_428089((*t).sons->data[i_428122], info, NIM_FALSE);
					add_226165(result, LOC11);
				}
				LA6: ;
				res_428142 += ((NI) 1);
			} LA5: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode225809*, maptypetoast_428089)(Ttype225847* t, Tlineinfo190352 info, NIM_BOOL allowrecursion) {
	Tnode225809* result;
	result = 0;
	switch ((*t).kind) {
	case ((NU8) 0):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2946), t, info);
	}
	break;
	case ((NU8) 1):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2947), t, info);
	}
	break;
	case ((NU8) 2):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2948), t, info);
	}
	break;
	case ((NU8) 5):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2949), t, info);
	}
	break;
	case ((NU8) 6):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2950), t, info);
	}
	break;
	case ((NU8) 7):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2951), t, info);
	}
	break;
	case ((NU8) 3):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2952), t, info);
	}
	break;
	case ((NU8) 4):
	case ((NU8) 16):
	{
		Tnode225809* LOC9;
		Tnode225809* LOC10;
		Tnode225809* LOC11;
		result = newnodeit_227807(((NU8) 42), info, t);
		LOC9 = 0;
		LOC9 = atomictypex_428075(((NimStringDesc*) &TMP2953), t, info);
		add_226165(result, LOC9);
		LOC10 = 0;
		LOC10 = maptypetoast_428089((*t).sons->data[((NI) 0)], info, NIM_FALSE);
		add_226165(result, LOC10);
		LOC11 = 0;
		LOC11 = maptypetoast_428089((*t).sons->data[((NI) 1)], info, NIM_FALSE);
		add_226165(result, LOC11);
	}
	break;
	case ((NU8) 8):
	{
		{
			Ttype225847* LOC15;
			Tnode225809* LOC18;
			Ttype225847* LOC19;
			Tnode225809* LOC20;
			LOC15 = 0;
			LOC15 = base_255039(t);
			if (!!((LOC15 == NIM_NIL))) goto LA16;
			result = newnodeit_227807(((NU8) 42), info, t);
			LOC18 = 0;
			LOC18 = atomictypex_428075(((NimStringDesc*) &TMP2954), t, info);
			add_226165(result, LOC18);
			LOC19 = 0;
			LOC19 = base_255039(t);
			LOC20 = 0;
			LOC20 = maptypetoast_428089(LOC19, info, NIM_FALSE);
			add_226165(result, LOC20);
		}
		goto LA13;
		LA16: ;
		{
			result = atomictypex_428075(((NimStringDesc*) &TMP2955), t, info);
		}
		LA13: ;
	}
	break;
	case ((NU8) 9):
	{
		result = newnodeit_227807(((NU8) 42), info, t);
		{
			NI i_428206;
			NI HEX3Atmp_428252;
			NI LOC24;
			NI res_428255;
			i_428206 = 0;
			HEX3Atmp_428252 = 0;
			LOC24 = 0;
			LOC24 = len_228369(t);
			HEX3Atmp_428252 = (LOC24 - 1);
			res_428255 = ((NI) 0);
			{
				while (1) {
					Tnode225809* LOC27;
					if (!(res_428255 <= HEX3Atmp_428252)) goto LA26;
					i_428206 = res_428255;
					LOC27 = 0;
					LOC27 = maptypetoast_428089((*t).sons->data[i_428206], info, NIM_FALSE);
					add_226165(result, LOC27);
					res_428255 += ((NI) 1);
				} LA26: ;
			}
		}
	}
	break;
	case ((NU8) 11):
	case ((NU8) 10):
	case ((NU8) 15):
	case ((NU8) 53):
	{
		Ttype225847* LOC29;
		LOC29 = 0;
		LOC29 = lastson_228426(t);
		result = maptypetoast_428089(LOC29, info, NIM_FALSE);
	}
	break;
	case ((NU8) 13):
	{
		{
			if (!allowrecursion) goto LA33;
			result = maptypetobracket_428097(((NimStringDesc*) &TMP2957), t, info);
		}
		goto LA31;
		LA33: ;
		{
			result = atomictypex_428075((*(*(*t).sym).name).s, t, info);
		}
		LA31: ;
	}
	break;
	case ((NU8) 12):
	case ((NU8) 30):
	{
		result = atomictypex_428075((*(*(*t).sym).name).s, t, info);
	}
	break;
	case ((NU8) 17):
	{
		{
			Tnode225809* LOC48;
			if (!allowrecursion) goto LA40;
			result = newnodeit_227807(((NU8) 133), info, t);
			{
				if (!((*t).sons->data[((NI) 0)] == NIM_NIL)) goto LA44;
				add_226165(result, emptynode_226807);
			}
			goto LA42;
			LA44: ;
			{
				Tnode225809* LOC47;
				LOC47 = 0;
				LOC47 = maptypetoast_428089((*t).sons->data[((NI) 0)], info, NIM_FALSE);
				add_226165(result, LOC47);
			}
			LA42: ;
			LOC48 = 0;
			LOC48 = copytree_230028((*t).n);
			add_226165(result, LOC48);
		}
		goto LA38;
		LA40: ;
		{
			result = atomictypex_428075((*(*(*t).sym).name).s, t, info);
		}
		LA38: ;
	}
	break;
	case ((NU8) 14):
	{
		Tnode225809* LOC51;
		result = newnodeit_227807(((NU8) 150), info, t);
		LOC51 = 0;
		LOC51 = copytree_230028((*t).n);
		add_226165(result, LOC51);
	}
	break;
	case ((NU8) 18):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2958), t, info);
	}
	break;
	case ((NU8) 19):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2959), t, info);
	}
	break;
	case ((NU8) 21):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2960), t, info);
	}
	break;
	case ((NU8) 22):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2961), t, info);
	}
	break;
	case ((NU8) 23):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2962), t, info);
	}
	break;
	case ((NU8) 24):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2963), t, info);
	}
	break;
	case ((NU8) 25):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2964), t, info);
	}
	break;
	case ((NU8) 27):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2965), t, info);
	}
	break;
	case ((NU8) 20):
	{
		Tnode225809* LOC61;
		Tnode225809* LOC62;
		Tnode225809* LOC63;
		result = newnodeit_227807(((NU8) 42), info, t);
		LOC61 = 0;
		LOC61 = atomictypex_428075(((NimStringDesc*) &TMP2966), t, info);
		add_226165(result, LOC61);
		LOC62 = 0;
		LOC62 = copytree_230028((*(*t).n).kindU.S6.sons->data[((NI) 0)]);
		add_226165(result, LOC62);
		LOC63 = 0;
		LOC63 = copytree_230028((*(*t).n).kindU.S6.sons->data[((NI) 1)]);
		add_226165(result, LOC63);
	}
	break;
	case ((NU8) 26):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2967), t, info);
	}
	break;
	case ((NU8) 28):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2968), t, info);
	}
	break;
	case ((NU8) 29):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2969), t, info);
	}
	break;
	case ((NU8) 31):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2970), t, info);
	}
	break;
	case ((NU8) 32):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2971), t, info);
	}
	break;
	case ((NU8) 33):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2972), t, info);
	}
	break;
	case ((NU8) 34):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2973), t, info);
	}
	break;
	case ((NU8) 35):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2974), t, info);
	}
	break;
	case ((NU8) 36):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2975), t, info);
	}
	break;
	case ((NU8) 37):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2976), t, info);
	}
	break;
	case ((NU8) 38):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2977), t, info);
	}
	break;
	case ((NU8) 39):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2978), t, info);
	}
	break;
	case ((NU8) 40):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2979), t, info);
	}
	break;
	case ((NU8) 41):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2980), t, info);
	}
	break;
	case ((NU8) 42):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2981), t, info);
	}
	break;
	case ((NU8) 43):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2982), t, info);
	}
	break;
	case ((NU8) 44):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2983), t, info);
	}
	break;
	case ((NU8) 45):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2984), t, info);
	}
	break;
	case ((NU8) 46):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2985), t, info);
	}
	break;
	case ((NU8) 47):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2986), t, info);
	}
	break;
	case ((NU8) 48):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2987), t, info);
	}
	break;
	case ((NU8) 49):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2988), t, info);
	}
	break;
	case ((NU8) 50):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2989), t, info);
	}
	break;
	case ((NU8) 51):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2990), t, info);
	}
	break;
	case ((NU8) 52):
	{
		Tnode225809* LOC89;
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2991), t, info);
		LOC89 = 0;
		LOC89 = copytree_230028((*t).n);
		add_226165(result, LOC89);
	}
	break;
	case ((NU8) 54):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2992), t, info);
	}
	break;
	case ((NU8) 55):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2993), t, info);
	}
	break;
	case ((NU8) 56):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2994), t, info);
	}
	break;
	case ((NU8) 57):
	{
		result = maptypetobracket_428097(((NimStringDesc*) &TMP2995), t, info);
	}
	break;
	case ((NU8) 58):
	{
		result = atomictypex_428075(((NimStringDesc*) &TMP2996), t, info);
	}
	break;
	case ((NU8) 59):
	case ((NU8) 60):
	case ((NU8) 61):
	{
		Tnode225809* LOC96;
		result = newnodeit_227807(((NU8) 42), info, t);
		LOC96 = 0;
		LOC96 = atomictypex_428075(((NimStringDesc*) &TMP2997), t, info);
		add_226165(result, LOC96);
		{
			Tnode225809* LOC101;
			if (!!(((*t).n == NIM_NIL))) goto LA99;
			LOC101 = 0;
			LOC101 = copytree_230028((*t).n);
			add_226165(result, LOC101);
		}
		LA99: ;
	}
	break;
	}
	return result;
}

N_NIMCALL(Tnode225809*, opmaptypetoast_428274)(Ttype225847* t, Tlineinfo190352 info) {
	Tnode225809* result;
	result = 0;
	result = maptypetoast_428089(t, info, NIM_TRUE);
	return result;
}

static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).hasRaiseAction = NIM_FALSE;
	(*s).prev = exchandler_20843;
	exchandler_20843 = s;
}

static N_INLINE(void, popSafePoint)(void) {
	exchandler_20843 = (*exchandler_20843).prev;
}

static N_INLINE(Exception*, getCurrentException)(void) {
	Exception* result;
	result = 0;
	result = currexception_20845;
	return result;
}

static N_INLINE(NIM_BOOL, canbecycleroot_52667)(Cell48947* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_53423)(Cell48947* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_49665((&gch_51059.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_55022)(Cell48947* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_52667(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_53423(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_54604)(Cell48947* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_54204(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_52667(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_53423(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Cell48947* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_52646(src);
		incref_55022(LOC5);
	}
	LA3: ;
	{
		Cell48947* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_52646((*dest));
		decref_54604(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

static N_INLINE(void, popCurrentException)(void) {
	asgnRef((void**) (&currexception_20845), NIM_NIL);
}

N_NIMCALL(NimStringDesc*, opslurp_428049)(NimStringDesc* file, Tlineinfo190352 info, Tsym225841* module) {
	NimStringDesc* volatile result;
	TSafePoint TMP3000;
	result = 0;
	pushSafePoint(&TMP3000);
	TMP3000.status = setjmp(TMP3000.context);
	if (TMP3000.status == 0) {
		NimStringDesc* filename;
		Tnodeseq225803* LOC2;
		TY243880 LOC3;
		Tnode225809* LOC4;
		filename = findfile_168539(file);
		result = readfile_16872(filename);
		LOC2 = 0;
		LOC2 = (Tnodeseq225803*) newSeq((&NTI225803), 1);
		memset((void*)LOC3, 0, sizeof(LOC3));
		LOC3[0] = newstrnode_226644(((NU8) 20), filename);
		asgnRefNoCycle((void**) (&LOC2->data[0]), LOC3[0]);
		LOC4 = 0;
		LOC4 = newnode_227607(((NU8) 121), info, LOC2, NIM_NIL);
		appendtomodule_226911(module, LOC4);
		popSafePoint();
	}
	else {
		popSafePoint();
		if (isObj(getCurrentException()->Sup.m_type, (&NTI4031))) {
			TMP3000.status = 0;
			localerror_196128(info, ((NU16) 3), file);
			result = copyString(((NimStringDesc*) &TMP3001));
			popCurrentException();
		}
	}
	if (TMP3000.status != 0) reraiseException();
	return result;
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	memcpy(((NCSTRING) ((&(*dest).data[((*dest).Sup.len)- 0]))), ((NCSTRING) ((*src).data)), (NI)((*src).Sup.len + ((NI) 1)));
	(*dest).Sup.len += (*src).Sup.len;
}

N_NIMCALL(NimStringDesc*, readoutput_428009)(Processobj156407* p) {
	NimStringDesc* result;
	Streamobj149427* output;
	NI LOC9;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP3001));
	output = nospoutputStream(p);
	{
		while (1) {
			NIM_BOOL LOC3;
			NimStringDesc* LOC4;
			LOC3 = 0;
			LOC3 = atend_149517(output);
			if (!!(LOC3)) goto LA2;
			LOC4 = 0;
			LOC4 = readline_150477(output);
			result = resizeString(result, LOC4->Sup.len + 0);
appendString(result, LOC4);
			result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP3021));
		} LA2: ;
	}
	{
		if (!(((NI) 0) < (result ? result->Sup.len : 0))) goto LA7;
		result = setLengthStr(result, ((NI) ((NI)((result ? result->Sup.len : 0) - ((NI) 1)))));
	}
	LA7: ;
	LOC9 = 0;
	LOC9 = nospwaitForExit(p, ((NI) -1));
	return result;
}

N_NIMCALL(NimStringDesc*, opgorge_428027)(NimStringDesc* cmd, NimStringDesc* input, NimStringDesc* cache) {
	NimStringDesc* volatile result;
{	result = 0;
	{
		Sha1digest201009 h;
		NimStringDesc* LOC5;
		NimStringDesc* filename;
		NimStringDesc* LOC6;
		NimStringDesc* LOC7;
		FILE* f;
		NIM_BOOL volatile readsuccessful;
		TSafePoint TMP3005;
		if (!(((NI) 0) < (cache ? cache->Sup.len : 0))) goto LA3;
		memset((void*)h, 0, sizeof(h));
		LOC5 = 0;
		LOC5 = rawNewString(cmd->Sup.len + input->Sup.len + cache->Sup.len + 2);
appendString(LOC5, cmd);
appendString(LOC5, ((NimStringDesc*) &TMP3002));
appendString(LOC5, input);
appendString(LOC5, ((NimStringDesc*) &TMP3002));
appendString(LOC5, cache);
		chckNil((void*)h);
		memset((void*)h, 0, sizeof(h));
		securehash_201023(LOC5, h);
		LOC6 = 0;
		LOC7 = 0;
		LOC7 = HEX24_201044(h);
		LOC6 = rawNewString(LOC7->Sup.len + 6);
appendString(LOC6, ((NimStringDesc*) &TMP3003));
appendString(LOC6, LOC7);
		filename = togeneratedfile_168158(LOC6, ((NimStringDesc*) &TMP3004));
		f = 0;
		{
			NIM_BOOL LOC10;
			LOC10 = 0;
			LOC10 = open_16803(&f, filename, ((NU8) 0), ((NI) -1));
			if (!LOC10) goto LA11;
			result = readall_16869(f);
			fclose(f);
			goto BeforeRet;
		}
		LA11: ;
		readsuccessful = NIM_FALSE;
		pushSafePoint(&TMP3005);
		TMP3005.status = setjmp(TMP3005.context);
		if (TMP3005.status == 0) {
			Processobj156407* p;
			TY253724 LOC14;
			memset((void*)LOC14, 0, sizeof(LOC14));
			p = nospstartProcess(cmd, ((NimStringDesc*) &TMP3001), LOC14, 0, NIM_NIL, 12);
			{
				Streamobj149427* LOC19;
				Streamobj149427* LOC20;
				if (!!(((input ? input->Sup.len : 0) == ((NI) 0)))) goto LA17;
				LOC19 = 0;
				LOC19 = nospinputStream(p);
				write_149683(LOC19, input);
				LOC20 = 0;
				LOC20 = nospinputStream(p);
				close_149491(LOC20);
			}
			LA17: ;
			result = readoutput_428009(p);
			readsuccessful = NIM_TRUE;
			writefile_16875(filename, result);
			popSafePoint();
		}
		else {
			popSafePoint();
			if (isObj(getCurrentException()->Sup.m_type, (&NTI4031))||isObj(getCurrentException()->Sup.m_type, (&NTI4033))) {
				TMP3005.status = 0;
				{
					if (!!(readsuccessful)) goto LA25;
					result = copyString(((NimStringDesc*) &TMP3001));
				}
				LA25: ;
				popCurrentException();
			}
		}
		if (TMP3005.status != 0) reraiseException();
	}
	goto LA1;
	LA3: ;
	{
		TSafePoint TMP3022;
		pushSafePoint(&TMP3022);
		TMP3022.status = setjmp(TMP3022.context);
		if (TMP3022.status == 0) {
			Processobj156407* p;
			TY253724 LOC29;
			memset((void*)LOC29, 0, sizeof(LOC29));
			p = nospstartProcess(cmd, ((NimStringDesc*) &TMP3001), LOC29, 0, NIM_NIL, 12);
			{
				Streamobj149427* LOC34;
				Streamobj149427* LOC35;
				if (!!(((input ? input->Sup.len : 0) == ((NI) 0)))) goto LA32;
				LOC34 = 0;
				LOC34 = nospinputStream(p);
				write_149683(LOC34, input);
				LOC35 = 0;
				LOC35 = nospinputStream(p);
				close_149491(LOC35);
			}
			LA32: ;
			result = readoutput_428009(p);
			popSafePoint();
		}
		else {
			popSafePoint();
			if (isObj(getCurrentException()->Sup.m_type, (&NTI4031))||isObj(getCurrentException()->Sup.m_type, (&NTI4033))) {
				TMP3022.status = 0;
				result = copyString(((NimStringDesc*) &TMP3001));
				popCurrentException();
			}
		}
		if (TMP3022.status != 0) reraiseException();
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_vmdepsInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_vmdepsDatInit000)(void) {
}

