/* 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 <string.h>
#include <stdio.h>
typedef struct Tsym224841 Tsym224841;
typedef struct Tnode224809 Tnode224809;
typedef struct Tpass276017 Tpass276017;
typedef struct Tpasscontext276005 Tpasscontext276005;
typedef struct Trodreader267030 Trodreader267030;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct TNimObject TNimObject;
typedef struct Tllstream212204 Tllstream212204;
typedef struct Tparsers252035 Tparsers252035;
typedef struct Tparser240205 Tparser240205;
typedef struct Tlexer215185 Tlexer215185;
typedef struct Tbaselexer213024 Tbaselexer213024;
typedef struct Tlineinfo189352 Tlineinfo189352;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttoken215181 Ttoken215181;
typedef struct Tident197021 Tident197021;
typedef struct Tidobj197015 Tidobj197015;
typedef struct Ttypeseq224843 Ttypeseq224843;
typedef struct Tscope224835 Tscope224835;
typedef struct TY224944 TY224944;
typedef struct Tstrtable224813 Tstrtable224813;
typedef struct Tsymseq224811 Tsymseq224811;
typedef struct Ttype224847 Ttype224847;
typedef struct Tloc224823 Tloc224823;
typedef struct Ropeobj175009 Ropeobj175009;
typedef struct Tlib224827 Tlib224827;
typedef struct TY130408 TY130408;
typedef struct Tnodeseq224803 Tnodeseq224803;
typedef struct TY359220 TY359220;
typedef struct TY224932 TY224932;
typedef struct Tindex267028 Tindex267028;
typedef struct Tiitable232274 Tiitable232274;
typedef struct Tiipairseq232272 Tiipairseq232272;
typedef struct Table267063 Table267063;
typedef struct Keyvaluepairseq267066 Keyvaluepairseq267066;
typedef struct Memfile265208 Memfile265208;
typedef struct Tinstantiation224831 Tinstantiation224831;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tiipair232270 Tiipair232270;
typedef struct Keyvaluepair267069 Keyvaluepair267069;
typedef N_NIMCALL_PTR(Tsym224841*, TY276064) (Tsym224841* m, NI32 fileidx);
typedef N_NIMCALL_PTR(Tnode224809*, TY276069) (Tsym224841* m, NI32 fileidx);
typedef N_NIMCALL_PTR(Tpasscontext276005*, Tpassopen276009) (Tsym224841* module);
typedef N_NIMCALL_PTR(Tpasscontext276005*, Tpassopencached276011) (Tsym224841* module, Trodreader267030* rd);
typedef N_NIMCALL_PTR(Tnode224809*, Tpassprocess276015) (Tpasscontext276005* p, Tnode224809* toplevelstmt);
typedef N_NIMCALL_PTR(Tnode224809*, Tpassclose276013) (Tpasscontext276005* p, Tnode224809* n);
struct Tpass276017 {
Tpassopen276009 Field0;
Tpassopencached276011 Field1;
Tpassprocess276015 Field2;
Tpassclose276013 Field3;
};
typedef Tpass276017 TY276174[10];
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  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tpasscontext276005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tbaselexer213024  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Tllstream212204* stream;
NI linenumber;
NI sentinel;
NI linestart;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Tlineinfo189352 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} Terrorhandler215183;
struct  Tlexer215185  {
  Tbaselexer213024 Sup;
NI32 fileidx;
NI indentahead;
NI currlineindent;
NIM_BOOL strongspaces;
Terrorhandler215183 errorhandler;
};
struct  Ttoken215181  {
NU8 toktype;
NI indent;
Tident197021* ident;
NI64 inumber;
NF fnumber;
NU8 base;
NI8 strongspacea;
NI8 strongspaceb;
NimStringDesc* literal;
NI line;
NI col;
};
struct  Tparser240205  {
NI currind;
NIM_BOOL firsttok;
NIM_BOOL strongspaces;
Tlexer215185 lex;
Ttoken215181 tok;
NI inpragma;
NI insemistmtlist;
};
struct  Tparsers252035  {
NU8 skin;
Tparser240205 parser;
};
typedef Tpasscontext276005* Tpasscontextarray276168[10];
struct  Tidobj197015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable224813  {
NI counter;
Tsymseq224811* data;
};
struct  Tlineinfo189352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc224823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype224847* t;
Ropeobj175009* r;
Ropeobj175009* heaproot;
};
struct  Tsym224841  {
  Tidobj197015 Sup;
NU8 kind;
union{
struct {Ttypeseq224843* typeinstcache;
Tscope224835* typscope;
} S1;
struct {TY224944* procinstcache;
Tsym224841* gcunsafetyreason;
} S2;
struct {TY224944* usedgenerics;
Tstrtable224813 tab;
} S3;
struct {Tsym224841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype224847* typ;
Tident197021* name;
Tlineinfo189352 info;
Tsym224841* owner;
NU32 flags;
Tnode224809* ast;
NU32 options;
NI position;
NI offset;
Tloc224823 loc;
Tlib224827* annex;
Tnode224809* constraint;
};
struct  Tnode224809  {
Ttype224847* typ;
Tlineinfo189352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym224841* sym;
} S4;
struct {Tident197021* ident;
} S5;
struct {Tnodeseq224803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tllstream212204  {
  TNimObject Sup;
NU8 kind;
FILE* f;
NimStringDesc* s;
NI rd;
NI wr;
NI lineoffset;
};
struct  Ttype224847  {
  Tidobj197015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq224843* sons;
Tnode224809* n;
Tsym224841* owner;
Tsym224841* sym;
Tsym224841* destructor;
Tsym224841* deepcopy;
Tsym224841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc224823 loc;
};
struct TY359220 {
Tnode224809* Field0;
Tnode224809* Field1;
};
struct  Tiitable232274  {
NI counter;
Tiipairseq232272* data;
};
struct  Tindex267028  {
NI lastidxkey;
NI lastidxval;
Tiitable232274 tab;
NimStringDesc* r;
NI offset;
};
struct  Table267063  {
Keyvaluepairseq267066* data;
NI counter;
};
struct  Memfile265208  {
void* mem;
NI size;
int handle;
};
struct  Trodreader267030  {
  TNimObject Sup;
NI pos;
NCSTRING s;
NU32 options;
NU8 reason;
TY224932* moddeps;
TY224932* files;
NI dataidx;
NI convertersidx;
NI initidx;
NI interfidx;
NI compilerprocsidx;
NI methodsidx;
NimStringDesc* filename;
Tindex267028 index;
Tindex267028 imports;
NI readerindex;
NI line;
NI moduleid;
Table267063 syms;
Memfile265208 memfile;
Tsymseq224811* methods;
NimStringDesc* origfile;
NIM_BOOL inviewmode;
};
struct  Tident197021  {
  Tidobj197015 Sup;
NimStringDesc* s;
Tident197021* next;
NI h;
};
struct  Tscope224835  {
NI depthlevel;
Tstrtable224813 symbols;
Tnodeseq224803* usingsyms;
Tscope224835* parent;
};
struct  Ropeobj175009  {
  TNimObject Sup;
Ropeobj175009* left;
Ropeobj175009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib224827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj175009* name;
Tnode224809* path;
};
struct  Tiipair232270  {
NI key;
NI val;
};
struct Keyvaluepair267069 {
NI Field0;
NI Field1;
Tsym224841* Field2;
};
struct  Tinstantiation224831  {
Tsym224841* sym;
Ttypeseq224843* concretetypes;
TY224932* usedby;
NI compilesid;
};
struct TY130408 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct Ttypeseq224843 {
  TGenericSeq Sup;
  Ttype224847* data[SEQ_DECL_SIZE];
};
struct TY224944 {
  TGenericSeq Sup;
  Tinstantiation224831* data[SEQ_DECL_SIZE];
};
struct Tsymseq224811 {
  TGenericSeq Sup;
  Tsym224841* data[SEQ_DECL_SIZE];
};
struct Tnodeseq224803 {
  TGenericSeq Sup;
  Tnode224809* data[SEQ_DECL_SIZE];
};
struct TY224932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct Tiipairseq232272 {
  TGenericSeq Sup;
  Tiipair232270 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq267066 {
  TGenericSeq Sup;
  Keyvaluepair267069 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(void, openpasses_276293)(Tpasscontext276005** a, Tsym224841* module);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, tofullpathconsiderdirty_190807)(NI32 fileidx);
N_NIMCALL(Tllstream212204*, llstreamopen_212256)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(void, rawmessage_193636)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, openparsers_252047)(Tparsers252035* p, NI32 fileidx, Tllstream212204* inputstream);
N_NIMCALL(void, processimplicits_276621)(TY130408* implicits, NU8 nodekind, Tpasscontext276005** a);
N_NIMCALL(Tnode224809*, newnodei_226351)(NU8 kind, Tlineinfo189352 info);
N_NIMCALL(Tnode224809*, newstrnode_225644)(NU8 kind, NimStringDesc* strval);
N_NIMCALL(void, addson_226819)(Tnode224809* father, Tnode224809* son);
N_NIMCALL(NIM_BOOL, processtoplevelstmt_276454)(Tnode224809* n, Tpasscontext276005** a);
N_NIMCALL(Tnode224809*, parsetoplevelstmt_252070)(Tparsers252035* p);
N_NIMCALL(void, add_225165)(Tnode224809* father, Tnode224809* son);
N_NIMCALL(void, closeparsers_252056)(Tparsers252035* p);
N_NIMCALL(void, closepasses_276404)(Tpasscontext276005** a);
N_NIMCALL(void, idsynchronizationpoint_223453)(NI idrange);
N_NIMCALL(void, openpassescached_276342)(Tpasscontext276005** a, Tsym224841* module, Trodreader267030* rd);
N_NIMCALL(Tnode224809*, loadinitsection_267100)(Trodreader267030* r);
N_NIMCALL(NI, sonslen_227387)(Tnode224809* n);
N_NIMCALL(void, processtoplevelstmtcached_276513)(Tnode224809* n, Tpasscontext276005** a);
N_NIMCALL(void, closepassescached_276563)(Tpasscontext276005** a);
N_NIMCALL(void, carrypass_276208)(Tpass276017 p, Tsym224841* module, TY359220 m, TY359220* Result);
TY276064 gimportmodule_276068;
TY276069 gincludefile_276073;
TY276174 gpasses_276175;
NI gpasseslen_276176;
extern TNimType NTI4011; /* RootObj */
TNimType NTI276005; /* TPassContext */
extern TNimType NTI138; /* bool */
extern TNimType NTI252035; /* TParsers */
extern Tlineinfo189352 gcmdlineinfo_190322;
extern TY130408* implicitimports_166277;
extern TY130408* implicitincludes_166295;

N_NIMCALL(void, openpasses_276293)(Tpasscontext276005** a, Tsym224841* module) {
	{
		NI i_276310;
		NI HEX3Atmp_276319;
		NI res_276322;
		i_276310 = 0;
		HEX3Atmp_276319 = 0;
		HEX3Atmp_276319 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276322 = ((NI) 0);
		{
			while (1) {
				if (!(res_276322 <= HEX3Atmp_276319)) goto LA3;
				i_276310 = res_276322;
				{
					if (!!(gpasses_276175[(i_276310)- 0].Field0 == 0)) goto LA6;
					unsureAsgnRef((void**) (&a[(i_276310)- 0]), gpasses_276175[(i_276310)- 0].Field0(module));
				}
				goto LA4;
				LA6: ;
				{
					unsureAsgnRef((void**) (&a[(i_276310)- 0]), NIM_NIL);
				}
				LA4: ;
				res_276322 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(NIM_BOOL, processtoplevelstmt_276454)(Tnode224809* n, Tpasscontext276005** a) {
	NIM_BOOL result;
	Tnode224809* m;
{	result = 0;
	m = n;
	{
		NI i_276473;
		NI HEX3Atmp_276490;
		NI res_276493;
		i_276473 = 0;
		HEX3Atmp_276490 = 0;
		HEX3Atmp_276490 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276493 = ((NI) 0);
		{
			while (1) {
				if (!(res_276493 <= HEX3Atmp_276490)) goto LA3;
				i_276473 = res_276493;
				{
					if (!!(gpasses_276175[(i_276473)- 0].Field2 == 0)) goto LA6;
					m = gpasses_276175[(i_276473)- 0].Field2(a[(i_276473)- 0], m);
					{
						if (!m == 0) goto LA10;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA10: ;
				}
				LA6: ;
				res_276493 += ((NI) 1);
			} LA3: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, processimplicits_276621)(TY130408* implicits, NU8 nodekind, Tpasscontext276005** a) {
	{
		NimStringDesc* module_276637;
		NI i_276644;
		NI L_276646;
		module_276637 = 0;
		i_276644 = ((NI) 0);
		L_276646 = (implicits ? implicits->Sup.len : 0);
		{
			while (1) {
				Tnode224809* importstmt;
				Tnode224809* str;
				if (!(i_276644 < L_276646)) goto LA3;
				module_276637 = implicits->data[i_276644];
				importstmt = newnodei_226351(nodekind, gcmdlineinfo_190322);
				str = newstrnode_225644(((NU8) 20), module_276637);
				(*str).info = gcmdlineinfo_190322;
				addson_226819(importstmt, str);
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = processtoplevelstmt_276454(importstmt, a);
					if (!!(LOC6)) goto LA7;
					goto LA1;
				}
				LA7: ;
				i_276644 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
}

N_NIMCALL(void, closepasses_276404)(Tpasscontext276005** a) {
	Tnode224809* m;
	m = NIM_NIL;
	{
		NI i_276421;
		NI HEX3Atmp_276431;
		NI res_276434;
		i_276421 = 0;
		HEX3Atmp_276431 = 0;
		HEX3Atmp_276431 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276434 = ((NI) 0);
		{
			while (1) {
				if (!(res_276434 <= HEX3Atmp_276431)) goto LA3;
				i_276421 = res_276434;
				{
					if (!!(gpasses_276175[(i_276421)- 0].Field3 == 0)) goto LA6;
					m = gpasses_276175[(i_276421)- 0].Field3(a[(i_276421)- 0], m);
				}
				LA6: ;
				unsureAsgnRef((void**) (&a[(i_276421)- 0]), NIM_NIL);
				res_276434 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, openpassescached_276342)(Tpasscontext276005** a, Tsym224841* module, Trodreader267030* rd) {
	{
		NI i_276360;
		NI HEX3Atmp_276381;
		NI res_276384;
		i_276360 = 0;
		HEX3Atmp_276381 = 0;
		HEX3Atmp_276381 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276384 = ((NI) 0);
		{
			while (1) {
				if (!(res_276384 <= HEX3Atmp_276381)) goto LA3;
				i_276360 = res_276384;
				{
					if (!!(gpasses_276175[(i_276360)- 0].Field1 == 0)) goto LA6;
					unsureAsgnRef((void**) (&a[(i_276360)- 0]), gpasses_276175[(i_276360)- 0].Field1(module, rd));
					{
						if (!!((a[(i_276360)- 0] == NIM_NIL))) goto LA10;
						(*a[(i_276360)- 0]).fromcache = NIM_TRUE;
					}
					LA10: ;
				}
				goto LA4;
				LA6: ;
				{
					unsureAsgnRef((void**) (&a[(i_276360)- 0]), NIM_NIL);
				}
				LA4: ;
				res_276384 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, processtoplevelstmtcached_276513)(Tnode224809* n, Tpasscontext276005** a) {
	Tnode224809* m;
	m = n;
	{
		NI i_276531;
		NI HEX3Atmp_276540;
		NI res_276543;
		i_276531 = 0;
		HEX3Atmp_276540 = 0;
		HEX3Atmp_276540 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276543 = ((NI) 0);
		{
			while (1) {
				if (!(res_276543 <= HEX3Atmp_276540)) goto LA3;
				i_276531 = res_276543;
				{
					if (!!(gpasses_276175[(i_276531)- 0].Field1 == 0)) goto LA6;
					m = gpasses_276175[(i_276531)- 0].Field2(a[(i_276531)- 0], m);
				}
				LA6: ;
				res_276543 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, closepassescached_276563)(Tpasscontext276005** a) {
	Tnode224809* m;
	m = NIM_NIL;
	{
		NI i_276580;
		NI HEX3Atmp_276597;
		NI res_276600;
		i_276580 = 0;
		HEX3Atmp_276597 = 0;
		HEX3Atmp_276597 = (NI)(gpasseslen_276176 - ((NI) 1));
		res_276600 = ((NI) 0);
		{
			while (1) {
				if (!(res_276600 <= HEX3Atmp_276597)) goto LA3;
				i_276580 = res_276600;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = !(gpasses_276175[(i_276580)- 0].Field1 == 0);
					if (!(LOC6)) goto LA7;
					LOC6 = !(gpasses_276175[(i_276580)- 0].Field3 == 0);
					LA7: ;
					if (!LOC6) goto LA8;
					m = gpasses_276175[(i_276580)- 0].Field3(a[(i_276580)- 0], m);
				}
				LA8: ;
				unsureAsgnRef((void**) (&a[(i_276580)- 0]), NIM_NIL);
				res_276600 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, processmodule_276056)(Tsym224841* module, Tllstream212204* stream, Trodreader267030* rd) {
	Tparsers252035 p;
	Tpasscontextarray276168 a;
	Tllstream212204* s;
	NI32 fileidx;
{	memset((void*)(&p), 0, sizeof(p));
	objectInit((&p), (&NTI252035));
	memset((void*)a, 0, sizeof(a));
	s = 0;
	fileidx = ((NI32) ((*module).position));
	{
		if (!(rd == NIM_NIL)) goto LA3;
		openpasses_276293(a, module);
		{
			NimStringDesc* filename;
			if (!(stream == NIM_NIL)) goto LA7;
			filename = tofullpathconsiderdirty_190807(fileidx);
			s = llstreamopen_212256(filename, ((NU8) 0));
			{
				if (!(s == NIM_NIL)) goto LA11;
				rawmessage_193636(((NU16) 3), filename);
				goto BeforeRet;
			}
			LA11: ;
		}
		goto LA5;
		LA7: ;
		{
			s = stream;
		}
		LA5: ;
		{
			while (1) {
				openparsers_252047((&p), fileidx, s);
				{
					if (!!((((*module).flags &(1<<((((NU8) 13))&31)))!=0))) goto LA18;
					processimplicits_276621(implicitimports_166277, ((NU8) 116), a);
					processimplicits_276621(implicitincludes_166295, ((NU8) 121), a);
				}
				LA18: ;
				{
					while (1) {
						Tnode224809* n_276727;
						n_276727 = parsetoplevelstmt_252070((&p));
						{
							if (!((*n_276727).kind == ((NU8) 1))) goto LA24;
							goto LA20;
						}
						LA24: ;
						{
							Tnode224809* sl;
							NIM_BOOL LOC36;
							if (!(((*module).flags &(1<<((((NU8) 8))&31)))!=0)) goto LA28;
							sl = newnodei_226351(((NU8) 115), (*n_276727).info);
							add_225165(sl, n_276727);
							{
								while (1) {
									Tnode224809* n;
									n = parsetoplevelstmt_252070((&p));
									{
										if (!((*n).kind == ((NU8) 1))) goto LA34;
										goto LA30;
									}
									LA34: ;
									add_225165(sl, n);
								}
							} LA30: ;
							LOC36 = 0;
							LOC36 = processtoplevelstmt_276454(sl, a);
							goto LA20;
						}
						goto LA26;
						LA28: ;
						{
							NIM_BOOL LOC38;
							LOC38 = 0;
							LOC38 = processtoplevelstmt_276454(n_276727, a);
							if (!!(LOC38)) goto LA39;
							goto LA20;
						}
						goto LA26;
						LA39: ;
						LA26: ;
					}
				} LA20: ;
				closeparsers_252056((&p));
				{
					if (!!(((*s).kind == ((NU8) 3)))) goto LA43;
					goto LA14;
				}
				LA43: ;
			}
		} LA14: ;
		closepasses_276404(a);
		idsynchronizationpoint_223453(((NI) 1000));
	}
	goto LA1;
	LA3: ;
	{
		Tnode224809* n;
		openpassescached_276342(a, module, rd);
		n = loadinitsection_267100(rd);
		{
			NI i_276790;
			NI HEX3Atmp_276802;
			NI LOC47;
			NI res_276805;
			i_276790 = 0;
			HEX3Atmp_276802 = 0;
			LOC47 = 0;
			LOC47 = sonslen_227387(n);
			HEX3Atmp_276802 = (NI)(LOC47 - ((NI) 1));
			res_276805 = ((NI) 0);
			{
				while (1) {
					if (!(res_276805 <= HEX3Atmp_276802)) goto LA49;
					i_276790 = res_276805;
					processtoplevelstmtcached_276513((*n).kindU.S6.sons->data[i_276790], a);
					res_276805 += ((NI) 1);
				} LA49: ;
			}
		}
		closepassescached_276563(a);
	}
	LA1: ;
	}BeforeRet: ;
}

N_NIMCALL(void, registerpass_276190)(Tpass276017 p) {
	gpasses_276175[(gpasseslen_276176)- 0] = p;
	gpasseslen_276176 += ((NI) 1);
}

N_NIMCALL(void, clearpasses_276182)(void) {
	gpasseslen_276176 = ((NI) 0);
}

N_NIMCALL(NIM_BOOL, astneeded_276093)(Tsym224841* s) {
	NIM_BOOL result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NIM_BOOL LOC5;
		LOC3 = 0;
		LOC4 = 0;
		LOC5 = 0;
		LOC5 = ((12288 &(1<<(((*s).kind)&31)))!=0);
		if (!(LOC5)) goto LA6;
		LOC5 = ((8454144 & (*s).flags) == 0);
		LA6: ;
		LOC4 = LOC5;
		if (!(LOC4)) goto LA7;
		LOC4 = !(((*(*s).typ).callconv == ((NU8) 5)));
		LA7: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA8;
		LOC3 = ((*(*(*s).ast).kindU.S6.sons->data[((NI) 2)]).kind == ((NU8) 1));
		LA8: ;
		if (!LOC3) goto LA9;
		result = NIM_FALSE;
	}
	goto LA1;
	LA9: ;
	{
		result = NIM_TRUE;
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, carrypass_276208)(Tpass276017 p, Tsym224841* module, TY359220 m, TY359220* Result) {
	Tpasscontext276005* c;
	c = p.Field0(module);
	unsureAsgnRef((void**) (&(*Result).Field0), p.Field2(c, m.Field0));
	{
		if (!!((p.Field3 == NIM_NIL))) goto LA3;
		unsureAsgnRef((void**) (&(*Result).Field1), p.Field3(c, m.Field1));
	}
	goto LA1;
	LA3: ;
	{
		unsureAsgnRef((void**) (&(*Result).Field1), m.Field1);
	}
	LA1: ;
}

N_NIMCALL(void, carrypasses_276231)(Tnode224809* nodes, Tsym224841* module, Tpass276017* passes, NI passesLen0) {
	TY359220 passdata;
	memset((void*)(&passdata), 0, sizeof(passdata));
	passdata.Field0 = nodes;
	{
		Tpass276017 pass_276272;
		NI i_276277;
		memset((void*)(&pass_276272), 0, sizeof(pass_276272));
		i_276277 = ((NI) 0);
		{
			while (1) {
				TY359220 LOC4;
				if (!(i_276277 < passesLen0)) goto LA3;
				pass_276272 = passes[i_276277];
				memset((void*)(&LOC4), 0, sizeof(LOC4));
				carrypass_276208(pass_276272, module, passdata, (&LOC4));
				passdata.Field0 = LOC4.Field0;
				passdata.Field1 = LOC4.Field1;
				i_276277 += ((NI) 1);
			} LA3: ;
		}
	}
}
NIM_EXTERNC N_NOINLINE(void, compiler_passesInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_passesDatInit000)(void) {
static TNimNode TMP917[1];
NTI276005.size = sizeof(Tpasscontext276005);
NTI276005.kind = 17;
NTI276005.base = (&NTI4011);
NTI276005.flags = 1;
TMP917[0].kind = 1;
TMP917[0].offset = offsetof(Tpasscontext276005, fromcache);
TMP917[0].typ = (&NTI138);
TMP917[0].name = "fromCache";
NTI276005.node = &TMP917[0];
}

