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

#include "nimbase.h"
#include <string.h>
#include <stdio.h>
typedef struct Tsym225841 Tsym225841;
typedef struct Tnode225809 Tnode225809;
typedef struct Tpass277017 Tpass277017;
typedef struct Tpasscontext277005 Tpasscontext277005;
typedef struct Trodreader268030 Trodreader268030;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct TNimObject TNimObject;
typedef struct Tllstream213204 Tllstream213204;
typedef struct Tparsers253035 Tparsers253035;
typedef struct Tparser241205 Tparser241205;
typedef struct Tlexer216185 Tlexer216185;
typedef struct Tbaselexer214024 Tbaselexer214024;
typedef struct Tlineinfo190352 Tlineinfo190352;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttoken216181 Ttoken216181;
typedef struct Tident198021 Tident198021;
typedef struct Tidobj198015 Tidobj198015;
typedef struct Ttypeseq225843 Ttypeseq225843;
typedef struct Tscope225835 Tscope225835;
typedef struct TY225944 TY225944;
typedef struct Tstrtable225813 Tstrtable225813;
typedef struct Tsymseq225811 Tsymseq225811;
typedef struct Ttype225847 Ttype225847;
typedef struct Tloc225823 Tloc225823;
typedef struct Ropeobj176009 Ropeobj176009;
typedef struct Tlib225827 Tlib225827;
typedef struct TY130408 TY130408;
typedef struct Tnodeseq225803 Tnodeseq225803;
typedef struct TY360220 TY360220;
typedef struct TY225932 TY225932;
typedef struct Tindex268028 Tindex268028;
typedef struct Tiitable233274 Tiitable233274;
typedef struct Tiipairseq233272 Tiipairseq233272;
typedef struct Table268063 Table268063;
typedef struct Keyvaluepairseq268066 Keyvaluepairseq268066;
typedef struct Memfile266208 Memfile266208;
typedef struct Tinstantiation225831 Tinstantiation225831;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tiipair233270 Tiipair233270;
typedef struct Keyvaluepair268069 Keyvaluepair268069;
typedef N_NIMCALL_PTR(Tsym225841*, TY277064) (Tsym225841* m, NI32 fileidx);
typedef N_NIMCALL_PTR(Tnode225809*, TY277069) (Tsym225841* m, NI32 fileidx);
typedef N_NIMCALL_PTR(Tpasscontext277005*, Tpassopen277009) (Tsym225841* module);
typedef N_NIMCALL_PTR(Tpasscontext277005*, Tpassopencached277011) (Tsym225841* module, Trodreader268030* rd);
typedef N_NIMCALL_PTR(Tnode225809*, Tpassprocess277015) (Tpasscontext277005* p, Tnode225809* toplevelstmt);
typedef N_NIMCALL_PTR(Tnode225809*, Tpassclose277013) (Tpasscontext277005* p, Tnode225809* n);
struct Tpass277017 {
Tpassopen277009 Field0;
Tpassopencached277011 Field1;
Tpassprocess277015 Field2;
Tpassclose277013 Field3;
};
typedef Tpass277017 TY277174[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  Tpasscontext277005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Tbaselexer214024  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Tllstream213204* 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) (Tlineinfo190352 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} Terrorhandler216183;
struct  Tlexer216185  {
  Tbaselexer214024 Sup;
NI32 fileidx;
NI indentahead;
NI currlineindent;
NIM_BOOL strongspaces;
Terrorhandler216183 errorhandler;
};
struct  Ttoken216181  {
NU8 toktype;
NI indent;
Tident198021* ident;
NI64 inumber;
NF fnumber;
NU8 base;
NI8 strongspacea;
NI8 strongspaceb;
NimStringDesc* literal;
NI line;
NI col;
};
struct  Tparser241205  {
NI currind;
NIM_BOOL firsttok;
NIM_BOOL strongspaces;
Tlexer216185 lex;
Ttoken216181 tok;
NI inpragma;
NI insemistmtlist;
};
struct  Tparsers253035  {
NU8 skin;
Tparser241205 parser;
};
typedef Tpasscontext277005* Tpasscontextarray277168[10];
struct  Tidobj198015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable225813  {
NI counter;
Tsymseq225811* data;
};
struct  Tlineinfo190352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc225823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype225847* t;
Ropeobj176009* r;
Ropeobj176009* heaproot;
};
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  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  Tllstream213204  {
  TNimObject Sup;
NU8 kind;
FILE* f;
NimStringDesc* s;
NI rd;
NI wr;
NI lineoffset;
};
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 TY360220 {
Tnode225809* Field0;
Tnode225809* Field1;
};
struct  Tiitable233274  {
NI counter;
Tiipairseq233272* data;
};
struct  Tindex268028  {
NI lastidxkey;
NI lastidxval;
Tiitable233274 tab;
NimStringDesc* r;
NI offset;
};
struct  Table268063  {
Keyvaluepairseq268066* data;
NI counter;
};
struct  Memfile266208  {
void* mem;
NI size;
int handle;
};
struct  Trodreader268030  {
  TNimObject Sup;
NI pos;
NCSTRING s;
NU32 options;
NU8 reason;
TY225932* moddeps;
TY225932* files;
NI dataidx;
NI convertersidx;
NI initidx;
NI interfidx;
NI compilerprocsidx;
NI methodsidx;
NimStringDesc* filename;
Tindex268028 index;
Tindex268028 imports;
NI readerindex;
NI line;
NI moduleid;
Table268063 syms;
Memfile266208 memfile;
Tsymseq225811* methods;
NimStringDesc* origfile;
NIM_BOOL inviewmode;
};
struct  Tident198021  {
  Tidobj198015 Sup;
NimStringDesc* s;
Tident198021* next;
NI h;
};
struct  Tscope225835  {
NI depthlevel;
Tstrtable225813 symbols;
Tnodeseq225803* usingsyms;
Tscope225835* parent;
};
struct  Ropeobj176009  {
  TNimObject Sup;
Ropeobj176009* left;
Ropeobj176009* right;
NI length;
NimStringDesc* data;
};
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  Tiipair233270  {
NI key;
NI val;
};
struct Keyvaluepair268069 {
NI Field0;
NI Field1;
Tsym225841* Field2;
};
struct  Tinstantiation225831  {
Tsym225841* sym;
Ttypeseq225843* concretetypes;
TY225932* usedby;
NI compilesid;
};
struct TY130408 {
  TGenericSeq Sup;
  NimStringDesc* 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 Tnodeseq225803 {
  TGenericSeq Sup;
  Tnode225809* data[SEQ_DECL_SIZE];
};
struct TY225932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct Tiipairseq233272 {
  TGenericSeq Sup;
  Tiipair233270 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq268066 {
  TGenericSeq Sup;
  Keyvaluepair268069 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(void, openpasses_277293)(Tpasscontext277005** a, Tsym225841* module);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, tofullpathconsiderdirty_191807)(NI32 fileidx);
N_NIMCALL(Tllstream213204*, llstreamopen_213256)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(void, rawmessage_194636)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, openparsers_253047)(Tparsers253035* p, NI32 fileidx, Tllstream213204* inputstream);
N_NIMCALL(void, processimplicits_277621)(TY130408* implicits, NU8 nodekind, Tpasscontext277005** a);
N_NIMCALL(Tnode225809*, newnodei_227351)(NU8 kind, Tlineinfo190352 info);
N_NIMCALL(Tnode225809*, newstrnode_226643)(NU8 kind, NimStringDesc* strval);
N_NIMCALL(void, addson_227819)(Tnode225809* father, Tnode225809* son);
N_NIMCALL(NIM_BOOL, processtoplevelstmt_277454)(Tnode225809* n, Tpasscontext277005** a);
N_NIMCALL(Tnode225809*, parsetoplevelstmt_253070)(Tparsers253035* p);
N_NIMCALL(void, add_226165)(Tnode225809* father, Tnode225809* son);
N_NIMCALL(void, closeparsers_253056)(Tparsers253035* p);
N_NIMCALL(void, closepasses_277404)(Tpasscontext277005** a);
N_NIMCALL(void, idsynchronizationpoint_224453)(NI idrange);
N_NIMCALL(void, openpassescached_277342)(Tpasscontext277005** a, Tsym225841* module, Trodreader268030* rd);
N_NIMCALL(Tnode225809*, loadinitsection_268100)(Trodreader268030* r);
N_NIMCALL(NI, sonslen_228387)(Tnode225809* n);
N_NIMCALL(void, processtoplevelstmtcached_277513)(Tnode225809* n, Tpasscontext277005** a);
N_NIMCALL(void, closepassescached_277563)(Tpasscontext277005** a);
N_NIMCALL(void, carrypass_277208)(Tpass277017* p, Tsym225841* module, TY360220 m, TY360220* Result);
TY277064 gimportmodule_277068;
TY277069 gincludefile_277073;
TY277174 gpasses_277175;
NI gpasseslen_277176;
extern TNimType NTI4011; /* RootObj */
TNimType NTI277005; /* TPassContext */
extern TNimType NTI138; /* bool */
extern TNimType NTI253035; /* TParsers */
extern Tlineinfo190352 gcmdlineinfo_191321;
extern TY130408* implicitimports_167277;
extern TY130408* implicitincludes_167295;

N_NIMCALL(void, openpasses_277293)(Tpasscontext277005** a, Tsym225841* module) {
	{
		NI i_277310;
		NI HEX3Atmp_277319;
		NI res_277322;
		i_277310 = 0;
		HEX3Atmp_277319 = 0;
		HEX3Atmp_277319 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277322 = ((NI) 0);
		{
			while (1) {
				if (!(res_277322 <= HEX3Atmp_277319)) goto LA3;
				i_277310 = res_277322;
				{
					if (!!(gpasses_277175[(i_277310)- 0].Field0 == 0)) goto LA6;
					unsureAsgnRef((void**) (&a[(i_277310)- 0]), gpasses_277175[(i_277310)- 0].Field0(module));
				}
				goto LA4;
				LA6: ;
				{
					unsureAsgnRef((void**) (&a[(i_277310)- 0]), NIM_NIL);
				}
				LA4: ;
				res_277322 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(NIM_BOOL, processtoplevelstmt_277454)(Tnode225809* n, Tpasscontext277005** a) {
	NIM_BOOL result;
	Tnode225809* m;
{	result = 0;
	m = n;
	{
		NI i_277473;
		NI HEX3Atmp_277490;
		NI res_277493;
		i_277473 = 0;
		HEX3Atmp_277490 = 0;
		HEX3Atmp_277490 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277493 = ((NI) 0);
		{
			while (1) {
				if (!(res_277493 <= HEX3Atmp_277490)) goto LA3;
				i_277473 = res_277493;
				{
					if (!!(gpasses_277175[(i_277473)- 0].Field2 == 0)) goto LA6;
					m = gpasses_277175[(i_277473)- 0].Field2(a[(i_277473)- 0], m);
					{
						if (!m == 0) goto LA10;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA10: ;
				}
				LA6: ;
				res_277493 += ((NI) 1);
			} LA3: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, processimplicits_277621)(TY130408* implicits, NU8 nodekind, Tpasscontext277005** a) {
	{
		NimStringDesc* module_277637;
		NI i_277644;
		NI L_277646;
		module_277637 = 0;
		i_277644 = ((NI) 0);
		L_277646 = (implicits ? implicits->Sup.len : 0);
		{
			while (1) {
				Tnode225809* importstmt;
				Tnode225809* str;
				if (!(i_277644 < L_277646)) goto LA3;
				module_277637 = implicits->data[i_277644];
				importstmt = newnodei_227351(nodekind, gcmdlineinfo_191321);
				str = newstrnode_226643(((NU8) 20), module_277637);
				(*str).info = gcmdlineinfo_191321;
				addson_227819(importstmt, str);
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = processtoplevelstmt_277454(importstmt, a);
					if (!!(LOC6)) goto LA7;
					goto LA1;
				}
				LA7: ;
				i_277644 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
}

N_NIMCALL(void, closepasses_277404)(Tpasscontext277005** a) {
	Tnode225809* m;
	m = NIM_NIL;
	{
		NI i_277421;
		NI HEX3Atmp_277431;
		NI res_277434;
		i_277421 = 0;
		HEX3Atmp_277431 = 0;
		HEX3Atmp_277431 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277434 = ((NI) 0);
		{
			while (1) {
				if (!(res_277434 <= HEX3Atmp_277431)) goto LA3;
				i_277421 = res_277434;
				{
					if (!!(gpasses_277175[(i_277421)- 0].Field3 == 0)) goto LA6;
					m = gpasses_277175[(i_277421)- 0].Field3(a[(i_277421)- 0], m);
				}
				LA6: ;
				unsureAsgnRef((void**) (&a[(i_277421)- 0]), NIM_NIL);
				res_277434 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, openpassescached_277342)(Tpasscontext277005** a, Tsym225841* module, Trodreader268030* rd) {
	{
		NI i_277360;
		NI HEX3Atmp_277381;
		NI res_277384;
		i_277360 = 0;
		HEX3Atmp_277381 = 0;
		HEX3Atmp_277381 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277384 = ((NI) 0);
		{
			while (1) {
				if (!(res_277384 <= HEX3Atmp_277381)) goto LA3;
				i_277360 = res_277384;
				{
					if (!!(gpasses_277175[(i_277360)- 0].Field1 == 0)) goto LA6;
					unsureAsgnRef((void**) (&a[(i_277360)- 0]), gpasses_277175[(i_277360)- 0].Field1(module, rd));
					{
						if (!!((a[(i_277360)- 0] == NIM_NIL))) goto LA10;
						(*a[(i_277360)- 0]).fromcache = NIM_TRUE;
					}
					LA10: ;
				}
				goto LA4;
				LA6: ;
				{
					unsureAsgnRef((void**) (&a[(i_277360)- 0]), NIM_NIL);
				}
				LA4: ;
				res_277384 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, processtoplevelstmtcached_277513)(Tnode225809* n, Tpasscontext277005** a) {
	Tnode225809* m;
	m = n;
	{
		NI i_277531;
		NI HEX3Atmp_277540;
		NI res_277543;
		i_277531 = 0;
		HEX3Atmp_277540 = 0;
		HEX3Atmp_277540 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277543 = ((NI) 0);
		{
			while (1) {
				if (!(res_277543 <= HEX3Atmp_277540)) goto LA3;
				i_277531 = res_277543;
				{
					if (!!(gpasses_277175[(i_277531)- 0].Field1 == 0)) goto LA6;
					m = gpasses_277175[(i_277531)- 0].Field2(a[(i_277531)- 0], m);
				}
				LA6: ;
				res_277543 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, closepassescached_277563)(Tpasscontext277005** a) {
	Tnode225809* m;
	m = NIM_NIL;
	{
		NI i_277580;
		NI HEX3Atmp_277597;
		NI res_277600;
		i_277580 = 0;
		HEX3Atmp_277597 = 0;
		HEX3Atmp_277597 = (NI)(gpasseslen_277176 - ((NI) 1));
		res_277600 = ((NI) 0);
		{
			while (1) {
				if (!(res_277600 <= HEX3Atmp_277597)) goto LA3;
				i_277580 = res_277600;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = !(gpasses_277175[(i_277580)- 0].Field1 == 0);
					if (!(LOC6)) goto LA7;
					LOC6 = !(gpasses_277175[(i_277580)- 0].Field3 == 0);
					LA7: ;
					if (!LOC6) goto LA8;
					m = gpasses_277175[(i_277580)- 0].Field3(a[(i_277580)- 0], m);
				}
				LA8: ;
				unsureAsgnRef((void**) (&a[(i_277580)- 0]), NIM_NIL);
				res_277600 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, processmodule_277056)(Tsym225841* module, Tllstream213204* stream, Trodreader268030* rd) {
	Tparsers253035 p;
	Tpasscontextarray277168 a;
	Tllstream213204* s;
	NI32 fileidx;
{	memset((void*)(&p), 0, sizeof(p));
	objectInit((&p), (&NTI253035));
	memset((void*)a, 0, sizeof(a));
	s = 0;
	fileidx = ((NI32) ((*module).position));
	{
		if (!(rd == NIM_NIL)) goto LA3;
		openpasses_277293(a, module);
		{
			NimStringDesc* filename;
			if (!(stream == NIM_NIL)) goto LA7;
			filename = tofullpathconsiderdirty_191807(fileidx);
			s = llstreamopen_213256(filename, ((NU8) 0));
			{
				if (!(s == NIM_NIL)) goto LA11;
				rawmessage_194636(((NU16) 3), filename);
				goto BeforeRet;
			}
			LA11: ;
		}
		goto LA5;
		LA7: ;
		{
			s = stream;
		}
		LA5: ;
		{
			while (1) {
				openparsers_253047((&p), fileidx, s);
				{
					if (!!((((*module).flags &(1<<((((NU8) 13))&31)))!=0))) goto LA18;
					processimplicits_277621(implicitimports_167277, ((NU8) 116), a);
					processimplicits_277621(implicitincludes_167295, ((NU8) 121), a);
				}
				LA18: ;
				{
					while (1) {
						Tnode225809* n_277727;
						n_277727 = parsetoplevelstmt_253070((&p));
						{
							if (!((*n_277727).kind == ((NU8) 1))) goto LA24;
							goto LA20;
						}
						LA24: ;
						{
							Tnode225809* sl;
							NIM_BOOL LOC36;
							if (!(((*module).flags &(1<<((((NU8) 8))&31)))!=0)) goto LA28;
							sl = newnodei_227351(((NU8) 115), (*n_277727).info);
							add_226165(sl, n_277727);
							{
								while (1) {
									Tnode225809* n;
									n = parsetoplevelstmt_253070((&p));
									{
										if (!((*n).kind == ((NU8) 1))) goto LA34;
										goto LA30;
									}
									LA34: ;
									add_226165(sl, n);
								}
							} LA30: ;
							LOC36 = 0;
							LOC36 = processtoplevelstmt_277454(sl, a);
							goto LA20;
						}
						goto LA26;
						LA28: ;
						{
							NIM_BOOL LOC38;
							LOC38 = 0;
							LOC38 = processtoplevelstmt_277454(n_277727, a);
							if (!!(LOC38)) goto LA39;
							goto LA20;
						}
						goto LA26;
						LA39: ;
						LA26: ;
					}
				} LA20: ;
				closeparsers_253056((&p));
				{
					if (!!(((*s).kind == ((NU8) 3)))) goto LA43;
					goto LA14;
				}
				LA43: ;
			}
		} LA14: ;
		closepasses_277404(a);
		idsynchronizationpoint_224453(((NI) 1000));
	}
	goto LA1;
	LA3: ;
	{
		Tnode225809* n;
		openpassescached_277342(a, module, rd);
		n = loadinitsection_268100(rd);
		{
			NI i_277790;
			NI HEX3Atmp_277801;
			NI LOC47;
			NI res_277804;
			i_277790 = 0;
			HEX3Atmp_277801 = 0;
			LOC47 = 0;
			LOC47 = sonslen_228387(n);
			HEX3Atmp_277801 = (NI)(LOC47 - ((NI) 1));
			res_277804 = ((NI) 0);
			{
				while (1) {
					if (!(res_277804 <= HEX3Atmp_277801)) goto LA49;
					i_277790 = res_277804;
					processtoplevelstmtcached_277513((*n).kindU.S6.sons->data[i_277790], a);
					res_277804 += ((NI) 1);
				} LA49: ;
			}
		}
		closepassescached_277563(a);
	}
	LA1: ;
	}BeforeRet: ;
}

N_NIMCALL(void, registerpass_277190)(Tpass277017* p) {
	gpasses_277175[(gpasseslen_277176)- 0] = (*p);
	gpasseslen_277176 += ((NI) 1);
}

N_NIMCALL(void, clearpasses_277182)(void) {
	gpasseslen_277176 = ((NI) 0);
}

N_NIMCALL(NIM_BOOL, astneeded_277093)(Tsym225841* 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_277208)(Tpass277017* p, Tsym225841* module, TY360220 m, TY360220* Result) {
	Tpasscontext277005* 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_277231)(Tnode225809* nodes, Tsym225841* module, Tpass277017* passes, NI passesLen0) {
	TY360220 passdata;
	memset((void*)(&passdata), 0, sizeof(passdata));
	passdata.Field0 = nodes;
	{
		Tpass277017 pass_277272;
		NI i_277277;
		memset((void*)(&pass_277272), 0, sizeof(pass_277272));
		i_277277 = ((NI) 0);
		{
			while (1) {
				TY360220 LOC4;
				if (!(i_277277 < passesLen0)) goto LA3;
				pass_277272 = passes[i_277277];
				memset((void*)(&LOC4), 0, sizeof(LOC4));
				carrypass_277208((&pass_277272), module, passdata, (&LOC4));
				passdata.Field0 = LOC4.Field0;
				passdata.Field1 = LOC4.Field1;
				i_277277 += ((NI) 1);
			} LA3: ;
		}
	}
}
NIM_EXTERNC N_NOINLINE(void, compiler_passesInit000)(void) {
}

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

