/* Generated by Nim Compiler v0.13.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 Tnode213790 Tnode213790;
typedef struct Ttype213828 Ttype213828;
typedef struct Tlineinfo181337 Tlineinfo181337;
typedef struct Tidobj188006 Tidobj188006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq213824 Ttypeseq213824;
typedef struct Tsym213822 Tsym213822;
typedef struct Tloc213804 Tloc213804;
typedef struct Ropeobj168006 Ropeobj168006;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tident188012 Tident188012;
typedef struct Tscope213816 Tscope213816;
typedef struct TY213925 TY213925;
typedef struct Tstrtable213794 Tstrtable213794;
typedef struct Tsymseq213792 Tsymseq213792;
typedef struct Tlib213808 Tlib213808;
typedef struct Cell47705 Cell47705;
typedef struct Cellseq47721 Cellseq47721;
typedef struct Gcheap50018 Gcheap50018;
typedef struct Gcstack50016 Gcstack50016;
typedef struct Cellset47717 Cellset47717;
typedef struct Pagedesc47713 Pagedesc47713;
typedef struct Memregion29887 Memregion29887;
typedef struct Smallchunk29839 Smallchunk29839;
typedef struct Llchunk29881 Llchunk29881;
typedef struct Bigchunk29841 Bigchunk29841;
typedef struct Intset29814 Intset29814;
typedef struct Trunk29810 Trunk29810;
typedef struct Avlnode29885 Avlnode29885;
typedef struct Gcstat50014 Gcstat50014;
typedef struct Tnodeseq213784 Tnodeseq213784;
typedef struct Exception Exception;
typedef struct TSafePoint TSafePoint;
typedef struct Processobj149404 Processobj149404;
typedef struct Stringtableobj140209 Stringtableobj140209;
typedef struct Streamobj144418 Streamobj144418;
typedef struct Tinstantiation213812 Tinstantiation213812;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Basechunk29837 Basechunk29837;
typedef struct Freecell29829 Freecell29829;
typedef struct Keyvaluepairseq140207 Keyvaluepairseq140207;
typedef struct TY213913 TY213913;
typedef struct Keyvaluepair140205 Keyvaluepair140205;
struct  Tlineinfo181337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj188006  {
  TNimObject Sup;
NI id;
};
struct  Tloc213804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype213828* t;
Ropeobj168006* r;
Ropeobj168006* heaproot;
};
struct  Ttype213828  {
  Tidobj188006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq213824* sons;
Tnode213790* n;
Tsym213822* owner;
Tsym213822* sym;
Tsym213822* destructor;
Tsym213822* deepcopy;
Tsym213822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc213804 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tstrtable213794  {
NI counter;
Tsymseq213792* data;
};
struct  Tsym213822  {
  Tidobj188006 Sup;
NU8 kind;
union{
struct {Ttypeseq213824* typeinstcache;
Tscope213816* typscope;
} S1;
struct {TY213925* procinstcache;
Tsym213822* gcunsafetyreason;
} S2;
struct {TY213925* usedgenerics;
Tstrtable213794 tab;
} S3;
struct {Tsym213822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype213828* typ;
Tident188012* name;
Tlineinfo181337 info;
Tsym213822* owner;
NU32 flags;
Tnode213790* ast;
NU32 options;
NI position;
NI offset;
Tloc213804 loc;
Tlib213808* annex;
Tnode213790* constraint;
};
struct  Cell47705  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47721  {
NI len;
NI cap;
Cell47705** d;
};
struct  Cellset47717  {
NI counter;
NI max;
Pagedesc47713* head;
Pagedesc47713** data;
};
typedef Smallchunk29839* TY29902[512];
typedef Trunk29810* Trunkbuckets29812[256];
struct  Intset29814  {
Trunkbuckets29812 data;
};
struct  Memregion29887  {
NI minlargeobj;
NI maxlargeobj;
TY29902 freesmallchunks;
Llchunk29881* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29841* freechunkslist;
Intset29814 chunkstarts;
Avlnode29885* root;
Avlnode29885* deleted;
Avlnode29885* last;
Avlnode29885* freeavlnodes;
};
struct  Gcstat50014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap50018  {
Gcstack50016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47721 zct;
Cellseq47721 decstack;
Cellset47717 cycleroots;
Cellseq47721 tempstack;
NI recgclock;
Memregion29887 region;
Gcstat50014 stat;
};
struct  Tnode213790  {
Ttype213828* typ;
Tlineinfo181337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym213822* sym;
} S4;
struct {Tident188012* ident;
} S5;
struct {Tnodeseq213784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident188012  {
  Tidobj188006 Sup;
NimStringDesc* s;
Tident188012* 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;
} TY18011;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY18011 raiseAction;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef Tnode213790* TY229280[1];
typedef NU8 Sha1digest191003[20];
typedef NimStringDesc* TY237694[1];
struct  Ropeobj168006  {
  TNimObject Sup;
Ropeobj168006* left;
Ropeobj168006* right;
NI length;
NimStringDesc* data;
};
struct  Tscope213816  {
NI depthlevel;
Tstrtable213794 symbols;
Tnodeseq213784* usingsyms;
Tscope213816* parent;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib213808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj168006* name;
Tnode213790* path;
};
struct  Gcstack50016  {
Gcstack50016* prev;
Gcstack50016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29818[16];
struct  Pagedesc47713  {
Pagedesc47713* next;
NI key;
TY29818 bits;
};
struct  Basechunk29837  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29839  {
  Basechunk29837 Sup;
Smallchunk29839* next;
Smallchunk29839* prev;
Freecell29829* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29881  {
NI size;
NI acc;
Llchunk29881* next;
};
struct  Bigchunk29841  {
  Basechunk29837 Sup;
Bigchunk29841* next;
Bigchunk29841* prev;
NI align;
NF data;
};
struct  Trunk29810  {
Trunk29810* next;
NI key;
TY29818 bits;
};
typedef Avlnode29885* TY29892[2];
struct  Avlnode29885  {
TY29892 link;
NI key;
NI upperbound;
NI level;
};
struct  Processobj149404  {
  TNimObject Sup;
int inhandle;
int outhandle;
int errhandle;
Streamobj144418* instream;
Streamobj144418* outstream;
Streamobj144418* errstream;
pid_t id;
int exitcode;
NU8 options;
};
struct  Stringtableobj140209  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq140207* data;
NU8 mode;
};
typedef N_NIMCALL_PTR(void, TY144419) (Streamobj144418* s);
typedef N_NIMCALL_PTR(NIM_BOOL, TY144423) (Streamobj144418* s);
typedef N_NIMCALL_PTR(void, TY144427) (Streamobj144418* s, NI pos);
typedef N_NIMCALL_PTR(NI, TY144432) (Streamobj144418* s);
typedef N_NIMCALL_PTR(NI, TY144436) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(NI, TY144442) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY144448) (Streamobj144418* s, void* buffer, NI buflen);
typedef N_NIMCALL_PTR(void, TY144454) (Streamobj144418* s);
struct  Streamobj144418  {
  TNimObject Sup;
TY144419 closeimpl;
TY144423 atendimpl;
TY144427 setpositionimpl;
TY144432 getpositionimpl;
TY144436 readdataimpl;
TY144442 peekdataimpl;
TY144448 writedataimpl;
TY144454 flushimpl;
};
struct  Tinstantiation213812  {
Tsym213822* sym;
Ttypeseq213824* concretetypes;
TY213913* usedby;
NI compilesid;
};
struct  Freecell29829  {
Freecell29829* next;
NI zerofield;
};
struct Keyvaluepair140205 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct Tnodeseq213784 {
  TGenericSeq Sup;
  Tnode213790* data[SEQ_DECL_SIZE];
};
struct Ttypeseq213824 {
  TGenericSeq Sup;
  Ttype213828* data[SEQ_DECL_SIZE];
};
struct TY213925 {
  TGenericSeq Sup;
  Tinstantiation213812* data[SEQ_DECL_SIZE];
};
struct Tsymseq213792 {
  TGenericSeq Sup;
  Tsym213822* data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq140207 {
  TGenericSeq Sup;
  Keyvaluepair140205 data[SEQ_DECL_SIZE];
};
struct TY213913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tnode213790*, maptypetoast_396053)(Ttype213828* t, Tlineinfo181337 info, NIM_BOOL allowrecursion);
N_NIMCALL(Tnode213790*, atomictypex_396045)(NimStringDesc* name, Ttype213828* t, Tlineinfo181337 info);
N_NIMCALL(Tsym213822*, newsym_214684)(NU8 symkind, Tident188012* name, Tsym213822* owner, Tlineinfo181337 info);
N_NIMCALL(Tident188012*, getident_188441)(NimStringDesc* identifier);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Cell47705*, usrtocell_51640)(void* usr);
static N_INLINE(void, rtladdzct_53201)(Cell47705* c);
N_NOINLINE(void, addzct_51617)(Cellseq47721* s, Cell47705* c);
N_NIMCALL(Tnode213790*, newsymnode_215234)(Tsym213822* sym);
N_NIMCALL(Tnode213790*, newnodeit_215801)(NU8 kind, Tlineinfo181337 info, Ttype213828* typ);
N_NIMCALL(void, add_214114)(Tnode213790* father, Tnode213790* son);
N_NIMCALL(Ttype213828*, base_239021)(Ttype213828* t);
N_NIMCALL(NI, len_216339)(Ttype213828* n);
N_NIMCALL(Ttype213828*, lastson_216377)(Ttype213828* n);
N_NIMCALL(Tnode213790*, maptypetobracket_396058)(NimStringDesc* name, Ttype213828* t, Tlineinfo181337 info);
N_NIMCALL(Ttype213828*, newtype_216107)(NU8 kind, Tsym213822* owner);
N_NIMCALL(Tnode213790*, copytree_217822)(Tnode213790* src);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_NIMCALL(NimStringDesc*, findfile_160480)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, readfile_15666)(NimStringDesc* filename);
N_NIMCALL(void, appendtomodule_214869)(Tsym213822* m, Tnode213790* n);
N_NIMCALL(Tnode213790*, newnode_215601)(NU8 kind, Tlineinfo181337 info, Tnodeseq213784* sons, Ttype213828* typ);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(Tnode213790*, newstrnode_214678)(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_186080)(Tlineinfo181337 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_54019)(Cell47705* c);
static N_INLINE(NIM_BOOL, canbecycleroot_51658)(Cell47705* c);
static N_INLINE(void, rtladdcycleroot_52420)(Cell47705* c);
N_NOINLINE(void, incl_48447)(Cellset47717* s, Cell47705* cell);
static N_INLINE(void, decref_53601)(Cell47705* c);
N_NIMCALL(void, reraiseException)(void);
N_NIMCALL(void, securehash_191011)(NimStringDesc* str, Sha1digest191003* 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_160082)(NimStringDesc* path, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, HEX24_191020)(Sha1digest191003 self);
N_NIMCALL(NIM_BOOL, open_15603)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(NimStringDesc*, readall_15663)(FILE* file);
N_NIMCALL(Processobj149404*, nospstartProcess)(NimStringDesc* command, NimStringDesc* workingdir, NimStringDesc** args, NI argsLen0, Stringtableobj140209* env, NU8 options);
N_NIMCALL(void, write_144569)(Streamobj144418* s, NimStringDesc* x);
N_NIMCALL(Streamobj144418*, nospinputStream)(Processobj149404* p);
N_NIMCALL(void, close_144470)(Streamobj144418* s);
N_NIMCALL(NimStringDesc*, readoutput_396003)(Processobj149404* p);
N_NIMCALL(Streamobj144418*, nospoutputStream)(Processobj149404* p);
N_NIMCALL(NIM_BOOL, atend_144484)(Streamobj144418* s);
N_NIMCALL(NimStringDesc*, readline_145133)(Streamobj144418* s);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
N_NIMCALL(NI, nospwaitForExit)(Processobj149404* p, NI timeout);
N_NIMCALL(void, writefile_15669)(NimStringDesc* filename, NimStringDesc* content);
STRING_LITERAL(TMP2984, "none", 4);
STRING_LITERAL(TMP2985, "bool", 4);
STRING_LITERAL(TMP2986, "char", 4);
STRING_LITERAL(TMP2987, "nil", 3);
STRING_LITERAL(TMP2988, "expr", 4);
STRING_LITERAL(TMP2989, "stmt", 4);
STRING_LITERAL(TMP2990, "void", 4);
STRING_LITERAL(TMP2991, "array", 5);
STRING_LITERAL(TMP2992, "typeDesc", 8);
STRING_LITERAL(TMP2993, "typeDesc", 8);
STRING_LITERAL(TMP2994, "void", 4);
STRING_LITERAL(TMP2995, "distinct", 8);
STRING_LITERAL(TMP2996, "tuple", 5);
STRING_LITERAL(TMP2997, "set", 3);
STRING_LITERAL(TMP2998, "ptr", 3);
STRING_LITERAL(TMP2999, "ref", 3);
STRING_LITERAL(TMP3000, "var", 3);
STRING_LITERAL(TMP3001, "seq", 3);
STRING_LITERAL(TMP3002, "proc", 4);
STRING_LITERAL(TMP3003, "openArray", 9);
STRING_LITERAL(TMP3004, "range", 5);
STRING_LITERAL(TMP3005, "pointer", 7);
STRING_LITERAL(TMP3006, "string", 6);
STRING_LITERAL(TMP3007, "cstring", 7);
STRING_LITERAL(TMP3008, "int", 3);
STRING_LITERAL(TMP3009, "int8", 4);
STRING_LITERAL(TMP3010, "int16", 5);
STRING_LITERAL(TMP3011, "int32", 5);
STRING_LITERAL(TMP3012, "int64", 5);
STRING_LITERAL(TMP3013, "float", 5);
STRING_LITERAL(TMP3014, "float32", 7);
STRING_LITERAL(TMP3015, "float64", 7);
STRING_LITERAL(TMP3016, "float128", 8);
STRING_LITERAL(TMP3017, "uint", 4);
STRING_LITERAL(TMP3018, "uint8", 5);
STRING_LITERAL(TMP3019, "uint16", 6);
STRING_LITERAL(TMP3020, "uint32", 6);
STRING_LITERAL(TMP3021, "uint64", 6);
STRING_LITERAL(TMP3022, "bignum", 6);
STRING_LITERAL(TMP3023, "const", 5);
STRING_LITERAL(TMP3024, "mutable", 7);
STRING_LITERAL(TMP3025, "varargs", 7);
STRING_LITERAL(TMP3026, "iter", 4);
STRING_LITERAL(TMP3027, "error", 5);
STRING_LITERAL(TMP3028, "builtinTypeClass", 16);
STRING_LITERAL(TMP3029, "concept", 7);
STRING_LITERAL(TMP3030, "compositeTypeClass", 18);
STRING_LITERAL(TMP3031, "and", 3);
STRING_LITERAL(TMP3032, "or", 2);
STRING_LITERAL(TMP3033, "not", 3);
STRING_LITERAL(TMP3034, "anything", 8);
STRING_LITERAL(TMP3035, "static", 6);
STRING_LITERAL(TMP3039, "", 0);
STRING_LITERAL(TMP3040, "\011", 1);
STRING_LITERAL(TMP3041, "gorge_", 6);
STRING_LITERAL(TMP3042, "txt", 3);
STRING_LITERAL(TMP3057, "\012", 1);
extern Gcheap50018 gch_50059;
extern Tnode213790* emptynode_214801;
extern TSafePoint* exchandler_19637;
extern TNimType NTI213784; /* TNodeSeq */
extern TNimType NTI3628; /* IOError */
extern Exception* currexception_19639;
extern TNimType NTI3630; /* OSError */

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

static N_INLINE(void, rtladdzct_53201)(Cell47705* c) {
	addzct_51617((&gch_50059.zct), c);
}

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

N_NIMCALL(Tnode213790*, atomictypex_396045)(NimStringDesc* name, Ttype213828* t, Tlineinfo181337 info) {
	Tnode213790* result;
	Tsym213822* sym;
	Tident188012* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = getident_188441(name);
	sym = newsym_214684(((NU8) 7), LOC1, (*t).owner, info);
	asgnRefNoCycle((void**) (&(*sym).typ), t);
	result = newsymnode_215234(sym);
	asgnRefNoCycle((void**) (&(*result).typ), t);
	return result;
}

N_NIMCALL(Tnode213790*, maptypetobracket_396058)(NimStringDesc* name, Ttype213828* t, Tlineinfo181337 info) {
	Tnode213790* result;
	Tlineinfo181337 LOC1;
	Tnode213790* LOC7;
	result = 0;
	{
		if (!(*t).n == 0) goto LA4;
		LOC1 = info;
	}
	goto LA2;
	LA4: ;
	{
		LOC1 = (*(*t).n).info;
	}
	LA2: ;
	result = newnodeit_215801(((NU8) 42), LOC1, t);
	LOC7 = 0;
	LOC7 = atomictypex_396045(name, t, info);
	add_214114(result, LOC7);
	{
		NI i_396091;
		NI HEX3Atmp_396108;
		NI LOC9;
		NI res_396111;
		i_396091 = 0;
		HEX3Atmp_396108 = 0;
		LOC9 = 0;
		LOC9 = len_216339(t);
		HEX3Atmp_396108 = (LOC9 - 1);
		res_396111 = ((NI) 0);
		{
			while (1) {
				if (!(res_396111 <= HEX3Atmp_396108)) goto LA11;
				i_396091 = res_396111;
				{
					Tnode213790* void_396104;
					if (!((*t).sons->data[i_396091] == NIM_NIL)) goto LA14;
					void_396104 = atomictypex_396045(((NimStringDesc*) &TMP2994), t, info);
					asgnRefNoCycle((void**) (&(*void_396104).typ), newtype_216107(((NU8) 3), (*t).owner));
					add_214114(result, void_396104);
				}
				goto LA12;
				LA14: ;
				{
					Tnode213790* LOC17;
					LOC17 = 0;
					LOC17 = maptypetoast_396053((*t).sons->data[i_396091], info, NIM_FALSE);
					add_214114(result, LOC17);
				}
				LA12: ;
				res_396111 += ((NI) 1);
			} LA11: ;
		}
	}
	return result;
}

N_NIMCALL(Tnode213790*, maptypetoast_396053)(Ttype213828* t, Tlineinfo181337 info, NIM_BOOL allowrecursion) {
	Tnode213790* result;
	result = 0;
	switch ((*t).kind) {
	case ((NU8) 0):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2984), t, info);
	}
	break;
	case ((NU8) 1):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2985), t, info);
	}
	break;
	case ((NU8) 2):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2986), t, info);
	}
	break;
	case ((NU8) 5):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2987), t, info);
	}
	break;
	case ((NU8) 6):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2988), t, info);
	}
	break;
	case ((NU8) 7):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2989), t, info);
	}
	break;
	case ((NU8) 3):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP2990), t, info);
	}
	break;
	case ((NU8) 4):
	case ((NU8) 16):
	{
		Tlineinfo181337 LOC9;
		Tnode213790* LOC15;
		Tnode213790* LOC16;
		Tnode213790* LOC17;
		{
			if (!(*t).n == 0) goto LA12;
			LOC9 = info;
		}
		goto LA10;
		LA12: ;
		{
			LOC9 = (*(*t).n).info;
		}
		LA10: ;
		result = newnodeit_215801(((NU8) 42), LOC9, t);
		LOC15 = 0;
		LOC15 = atomictypex_396045(((NimStringDesc*) &TMP2991), t, info);
		add_214114(result, LOC15);
		LOC16 = 0;
		LOC16 = maptypetoast_396053((*t).sons->data[((NI) 0)], info, NIM_FALSE);
		add_214114(result, LOC16);
		LOC17 = 0;
		LOC17 = maptypetoast_396053((*t).sons->data[((NI) 1)], info, NIM_FALSE);
		add_214114(result, LOC17);
	}
	break;
	case ((NU8) 8):
	{
		{
			Ttype213828* LOC21;
			Tlineinfo181337 LOC24;
			Tnode213790* LOC30;
			Ttype213828* LOC31;
			Tnode213790* LOC32;
			LOC21 = 0;
			LOC21 = base_239021(t);
			if (!!((LOC21 == NIM_NIL))) goto LA22;
			{
				if (!(*t).n == 0) goto LA27;
				LOC24 = info;
			}
			goto LA25;
			LA27: ;
			{
				LOC24 = (*(*t).n).info;
			}
			LA25: ;
			result = newnodeit_215801(((NU8) 42), LOC24, t);
			LOC30 = 0;
			LOC30 = atomictypex_396045(((NimStringDesc*) &TMP2992), t, info);
			add_214114(result, LOC30);
			LOC31 = 0;
			LOC31 = base_239021(t);
			LOC32 = 0;
			LOC32 = maptypetoast_396053(LOC31, info, NIM_FALSE);
			add_214114(result, LOC32);
		}
		goto LA19;
		LA22: ;
		{
			result = atomictypex_396045(((NimStringDesc*) &TMP2993), t, info);
		}
		LA19: ;
	}
	break;
	case ((NU8) 9):
	{
		Tlineinfo181337 LOC35;
		{
			if (!(*t).n == 0) goto LA38;
			LOC35 = info;
		}
		goto LA36;
		LA38: ;
		{
			LOC35 = (*(*t).n).info;
		}
		LA36: ;
		result = newnodeit_215801(((NU8) 42), LOC35, t);
		{
			NI i_396186;
			NI HEX3Atmp_396268;
			NI LOC42;
			NI res_396271;
			i_396186 = 0;
			HEX3Atmp_396268 = 0;
			LOC42 = 0;
			LOC42 = len_216339(t);
			HEX3Atmp_396268 = (LOC42 - 1);
			res_396271 = ((NI) 0);
			{
				while (1) {
					Tnode213790* LOC45;
					if (!(res_396271 <= HEX3Atmp_396268)) goto LA44;
					i_396186 = res_396271;
					LOC45 = 0;
					LOC45 = maptypetoast_396053((*t).sons->data[i_396186], info, NIM_FALSE);
					add_214114(result, LOC45);
					res_396271 += ((NI) 1);
				} LA44: ;
			}
		}
	}
	break;
	case ((NU8) 11):
	case ((NU8) 10):
	case ((NU8) 15):
	case ((NU8) 53):
	{
		Ttype213828* LOC47;
		LOC47 = 0;
		LOC47 = lastson_216377(t);
		result = maptypetoast_396053(LOC47, info, NIM_FALSE);
	}
	break;
	case ((NU8) 13):
	{
		{
			if (!allowrecursion) goto LA51;
			result = maptypetobracket_396058(((NimStringDesc*) &TMP2995), t, info);
		}
		goto LA49;
		LA51: ;
		{
			result = atomictypex_396045((*(*(*t).sym).name).s, t, info);
		}
		LA49: ;
	}
	break;
	case ((NU8) 12):
	case ((NU8) 30):
	{
		result = atomictypex_396045((*(*(*t).sym).name).s, t, info);
	}
	break;
	case ((NU8) 17):
	{
		{
			Tlineinfo181337 LOC60;
			Tnode213790* LOC72;
			if (!allowrecursion) goto LA58;
			{
				if (!(*t).n == 0) goto LA63;
				LOC60 = info;
			}
			goto LA61;
			LA63: ;
			{
				LOC60 = (*(*t).n).info;
			}
			LA61: ;
			result = newnodeit_215801(((NU8) 133), LOC60, t);
			{
				if (!((*t).sons->data[((NI) 0)] == NIM_NIL)) goto LA68;
				add_214114(result, emptynode_214801);
			}
			goto LA66;
			LA68: ;
			{
				Tnode213790* LOC71;
				LOC71 = 0;
				LOC71 = maptypetoast_396053((*t).sons->data[((NI) 0)], info, NIM_FALSE);
				add_214114(result, LOC71);
			}
			LA66: ;
			LOC72 = 0;
			LOC72 = copytree_217822((*t).n);
			add_214114(result, LOC72);
		}
		goto LA56;
		LA58: ;
		{
			result = atomictypex_396045((*(*(*t).sym).name).s, t, info);
		}
		LA56: ;
	}
	break;
	case ((NU8) 14):
	{
		Tlineinfo181337 LOC75;
		Tnode213790* LOC81;
		{
			if (!(*t).n == 0) goto LA78;
			LOC75 = info;
		}
		goto LA76;
		LA78: ;
		{
			LOC75 = (*(*t).n).info;
		}
		LA76: ;
		result = newnodeit_215801(((NU8) 150), LOC75, t);
		LOC81 = 0;
		LOC81 = copytree_217822((*t).n);
		add_214114(result, LOC81);
	}
	break;
	case ((NU8) 18):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP2996), t, info);
	}
	break;
	case ((NU8) 19):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP2997), t, info);
	}
	break;
	case ((NU8) 21):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP2998), t, info);
	}
	break;
	case ((NU8) 22):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP2999), t, info);
	}
	break;
	case ((NU8) 23):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3000), t, info);
	}
	break;
	case ((NU8) 24):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3001), t, info);
	}
	break;
	case ((NU8) 25):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3002), t, info);
	}
	break;
	case ((NU8) 27):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3003), t, info);
	}
	break;
	case ((NU8) 20):
	{
		Tlineinfo181337 LOC91;
		Tnode213790* LOC97;
		Tnode213790* LOC98;
		Tnode213790* LOC99;
		{
			if (!(*t).n == 0) goto LA94;
			LOC91 = info;
		}
		goto LA92;
		LA94: ;
		{
			LOC91 = (*(*t).n).info;
		}
		LA92: ;
		result = newnodeit_215801(((NU8) 42), LOC91, t);
		LOC97 = 0;
		LOC97 = atomictypex_396045(((NimStringDesc*) &TMP3004), t, info);
		add_214114(result, LOC97);
		LOC98 = 0;
		LOC98 = copytree_217822((*(*t).n).kindU.S6.sons->data[((NI) 0)]);
		add_214114(result, LOC98);
		LOC99 = 0;
		LOC99 = copytree_217822((*(*t).n).kindU.S6.sons->data[((NI) 1)]);
		add_214114(result, LOC99);
	}
	break;
	case ((NU8) 26):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3005), t, info);
	}
	break;
	case ((NU8) 28):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3006), t, info);
	}
	break;
	case ((NU8) 29):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3007), t, info);
	}
	break;
	case ((NU8) 31):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3008), t, info);
	}
	break;
	case ((NU8) 32):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3009), t, info);
	}
	break;
	case ((NU8) 33):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3010), t, info);
	}
	break;
	case ((NU8) 34):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3011), t, info);
	}
	break;
	case ((NU8) 35):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3012), t, info);
	}
	break;
	case ((NU8) 36):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3013), t, info);
	}
	break;
	case ((NU8) 37):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3014), t, info);
	}
	break;
	case ((NU8) 38):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3015), t, info);
	}
	break;
	case ((NU8) 39):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3016), t, info);
	}
	break;
	case ((NU8) 40):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3017), t, info);
	}
	break;
	case ((NU8) 41):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3018), t, info);
	}
	break;
	case ((NU8) 42):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3019), t, info);
	}
	break;
	case ((NU8) 43):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3020), t, info);
	}
	break;
	case ((NU8) 44):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3021), t, info);
	}
	break;
	case ((NU8) 45):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3022), t, info);
	}
	break;
	case ((NU8) 46):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3023), t, info);
	}
	break;
	case ((NU8) 47):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3024), t, info);
	}
	break;
	case ((NU8) 48):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3025), t, info);
	}
	break;
	case ((NU8) 49):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3026), t, info);
	}
	break;
	case ((NU8) 50):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3027), t, info);
	}
	break;
	case ((NU8) 51):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3028), t, info);
	}
	break;
	case ((NU8) 52):
	{
		Tnode213790* LOC125;
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3029), t, info);
		LOC125 = 0;
		LOC125 = copytree_217822((*t).n);
		add_214114(result, LOC125);
	}
	break;
	case ((NU8) 54):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3030), t, info);
	}
	break;
	case ((NU8) 55):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3031), t, info);
	}
	break;
	case ((NU8) 56):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3032), t, info);
	}
	break;
	case ((NU8) 57):
	{
		result = maptypetobracket_396058(((NimStringDesc*) &TMP3033), t, info);
	}
	break;
	case ((NU8) 58):
	{
		result = atomictypex_396045(((NimStringDesc*) &TMP3034), t, info);
	}
	break;
	case ((NU8) 59):
	case ((NU8) 60):
	case ((NU8) 61):
	{
		Tlineinfo181337 LOC132;
		Tnode213790* LOC138;
		{
			if (!(*t).n == 0) goto LA135;
			LOC132 = info;
		}
		goto LA133;
		LA135: ;
		{
			LOC132 = (*(*t).n).info;
		}
		LA133: ;
		result = newnodeit_215801(((NU8) 42), LOC132, t);
		LOC138 = 0;
		LOC138 = atomictypex_396045(((NimStringDesc*) &TMP3035), t, info);
		add_214114(result, LOC138);
		{
			Tnode213790* LOC143;
			if (!!(((*t).n == NIM_NIL))) goto LA141;
			LOC143 = 0;
			LOC143 = copytree_217822((*t).n);
			add_214114(result, LOC143);
		}
		LA141: ;
	}
	break;
	}
	return result;
}

N_NIMCALL(Tnode213790*, opmaptypetoast_396275)(Ttype213828* t, Tlineinfo181337 info) {
	Tnode213790* result;
	result = 0;
	result = maptypetoast_396053(t, info, NIM_TRUE);
	return result;
}

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

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

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

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

static N_INLINE(void, rtladdcycleroot_52420)(Cell47705* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_48447((&gch_50059.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_54019)(Cell47705* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_51658(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_52420(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_53601)(Cell47705* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_53201(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_51658(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_52420(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Cell47705* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_51640(src);
		incref_54019(LOC5);
	}
	LA3: ;
	{
		Cell47705* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_51640((*dest));
		decref_53601(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

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

N_NIMCALL(NimStringDesc*, opslurp_396025)(NimStringDesc* file, Tlineinfo181337 info, Tsym213822* module) {
	NimStringDesc* volatile result;
	TSafePoint TMP3038;
	result = 0;
	pushSafePoint(&TMP3038);
	TMP3038.status = _setjmp(TMP3038.context);
	if (TMP3038.status == 0) {
		NimStringDesc* filename;
		Tnodeseq213784* LOC2;
		TY229280 LOC3;
		Tnode213790* LOC4;
		filename = findfile_160480(file);
		result = readfile_15666(filename);
		LOC2 = 0;
		LOC2 = (Tnodeseq213784*) newSeq((&NTI213784), 1);
		memset((void*)LOC3, 0, sizeof(LOC3));
		LOC3[0] = newstrnode_214678(((NU8) 20), filename);
		asgnRefNoCycle((void**) (&LOC2->data[0]), LOC3[0]);
		LOC4 = 0;
		LOC4 = newnode_215601(((NU8) 121), info, LOC2, NIM_NIL);
		appendtomodule_214869(module, LOC4);
		popSafePoint();
	}
	else {
		popSafePoint();
		if (isObj(getCurrentException()->Sup.m_type, (&NTI3628))) {
			TMP3038.status = 0;
			localerror_186080(info, ((NU16) 3), file);
			result = copyString(((NimStringDesc*) &TMP3039));
			popCurrentException();
		}
	}
	if (TMP3038.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_396003)(Processobj149404* p) {
	NimStringDesc* result;
	Streamobj144418* output;
	NI LOC9;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP3039));
	output = nospoutputStream(p);
	{
		while (1) {
			NIM_BOOL LOC3;
			NimStringDesc* LOC4;
			LOC3 = 0;
			LOC3 = atend_144484(output);
			if (!!(LOC3)) goto LA2;
			LOC4 = 0;
			LOC4 = readline_145133(output);
			result = resizeString(result, LOC4->Sup.len + 0);
appendString(result, LOC4);
			result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP3057));
		} 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_396009)(NimStringDesc* cmd, NimStringDesc* input, NimStringDesc* cache) {
	NimStringDesc* volatile result;
{	result = 0;
	{
		Sha1digest191003 h;
		NimStringDesc* LOC5;
		NimStringDesc* filename;
		NimStringDesc* LOC6;
		NimStringDesc* LOC7;
		FILE* f;
		NIM_BOOL volatile readsuccessful;
		TSafePoint TMP3043;
		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*) &TMP3040));
appendString(LOC5, input);
appendString(LOC5, ((NimStringDesc*) &TMP3040));
appendString(LOC5, cache);
		chckNil((void*)h);
		memset((void*)h, 0, sizeof(h));
		securehash_191011(LOC5, h);
		LOC6 = 0;
		LOC7 = 0;
		LOC7 = HEX24_191020(h);
		LOC6 = rawNewString(LOC7->Sup.len + 6);
appendString(LOC6, ((NimStringDesc*) &TMP3041));
appendString(LOC6, LOC7);
		filename = togeneratedfile_160082(LOC6, ((NimStringDesc*) &TMP3042));
		f = 0;
		{
			NIM_BOOL LOC10;
			LOC10 = 0;
			LOC10 = open_15603(&f, filename, ((NU8) 0), ((NI) -1));
			if (!LOC10) goto LA11;
			result = readall_15663(f);
			fclose(f);
			goto BeforeRet;
		}
		LA11: ;
		readsuccessful = NIM_FALSE;
		pushSafePoint(&TMP3043);
		TMP3043.status = _setjmp(TMP3043.context);
		if (TMP3043.status == 0) {
			Processobj149404* p;
			TY237694 LOC14;
			memset((void*)LOC14, 0, sizeof(LOC14));
			p = nospstartProcess(cmd, ((NimStringDesc*) &TMP3039), LOC14, 0, NIM_NIL, 12);
			{
				Streamobj144418* LOC19;
				Streamobj144418* LOC20;
				if (!!(((input ? input->Sup.len : 0) == ((NI) 0)))) goto LA17;
				LOC19 = 0;
				LOC19 = nospinputStream(p);
				write_144569(LOC19, input);
				LOC20 = 0;
				LOC20 = nospinputStream(p);
				close_144470(LOC20);
			}
			LA17: ;
			result = readoutput_396003(p);
			readsuccessful = NIM_TRUE;
			writefile_15669(filename, result);
			popSafePoint();
		}
		else {
			popSafePoint();
			if (isObj(getCurrentException()->Sup.m_type, (&NTI3628))||isObj(getCurrentException()->Sup.m_type, (&NTI3630))) {
				TMP3043.status = 0;
				{
					if (!!(readsuccessful)) goto LA25;
					result = copyString(((NimStringDesc*) &TMP3039));
				}
				LA25: ;
				popCurrentException();
			}
		}
		if (TMP3043.status != 0) reraiseException();
	}
	goto LA1;
	LA3: ;
	{
		TSafePoint TMP3058;
		pushSafePoint(&TMP3058);
		TMP3058.status = _setjmp(TMP3058.context);
		if (TMP3058.status == 0) {
			Processobj149404* p;
			TY237694 LOC29;
			memset((void*)LOC29, 0, sizeof(LOC29));
			p = nospstartProcess(cmd, ((NimStringDesc*) &TMP3039), LOC29, 0, NIM_NIL, 12);
			{
				Streamobj144418* LOC34;
				Streamobj144418* LOC35;
				if (!!(((input ? input->Sup.len : 0) == ((NI) 0)))) goto LA32;
				LOC34 = 0;
				LOC34 = nospinputStream(p);
				write_144569(LOC34, input);
				LOC35 = 0;
				LOC35 = nospinputStream(p);
				close_144470(LOC35);
			}
			LA32: ;
			result = readoutput_396003(p);
			popSafePoint();
		}
		else {
			popSafePoint();
			if (isObj(getCurrentException()->Sup.m_type, (&NTI3628))||isObj(getCurrentException()->Sup.m_type, (&NTI3630))) {
				TMP3058.status = 0;
				result = copyString(((NimStringDesc*) &TMP3039));
				popCurrentException();
			}
		}
		if (TMP3058.status != 0) reraiseException();
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_vmdepsInit000)(void) {
}

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

