/* 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>
typedef struct Tsym227841 Tsym227841;
typedef struct Tcontext282023 Tcontext282023;
typedef struct Tscope227835 Tscope227835;
typedef struct Tidentiter235141 Tidentiter235141;
typedef struct Tident200021 Tident200021;
typedef struct Tstrtable227813 Tstrtable227813;
typedef struct Tsymseq227811 Tsymseq227811;
typedef struct Tnodeseq227803 Tnodeseq227803;
typedef struct Tidobj200015 Tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq227843 Ttypeseq227843;
typedef struct TY227944 TY227944;
typedef struct Ttype227847 Ttype227847;
typedef struct Tlineinfo192352 Tlineinfo192352;
typedef struct Tnode227809 Tnode227809;
typedef struct Tloc227823 Tloc227823;
typedef struct Ropeobj178009 Ropeobj178009;
typedef struct Tlib227827 Tlib227827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tpasscontext279005 Tpasscontext279005;
typedef struct Tproccon282011 Tproccon282011;
typedef struct Intset224056 Intset224056;
typedef struct Trunk224052 Trunk224052;
typedef struct Trunkseq224054 Trunkseq224054;
typedef struct Tlinkedlist143028 Tlinkedlist143028;
typedef struct Tlistentry143022 Tlistentry143022;
typedef struct Tidtable227859 Tidtable227859;
typedef struct Tidpairseq227857 Tidpairseq227857;
typedef struct Tctx281048 Tctx281048;
typedef struct TY282143 TY282143;
typedef struct Tinstantiation227831 Tinstantiation227831;
typedef struct Tidpair227855 Tidpair227855;
typedef struct TY281254 TY281254;
typedef struct TY193420 TY193420;
typedef struct PprocHEX3Aobjecttype281233 PprocHEX3Aobjecttype281233;
typedef struct TY281273 TY281273;
typedef struct Tinstantiationpair282013 Tinstantiationpair282013;
typedef struct TY227932 TY227932;
typedef struct TY281234 TY281234;
typedef struct TY281239 TY281239;
typedef struct TY281274 TY281274;
typedef struct Vmargs281042 Vmargs281042;
typedef struct Tblock281030 Tblock281030;
typedef struct TY281214 TY281214;
struct  Tidentiter235141  {
NI h;
Tident200021* name;
};
struct  Tstrtable227813  {
NI counter;
Tsymseq227811* data;
};
struct  Tscope227835  {
NI depthlevel;
Tstrtable227813 symbols;
Tnodeseq227803* usingsyms;
Tscope227835* parent;
};
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  Tidobj200015  {
  TNimObject Sup;
NI id;
};
struct  Tlineinfo192352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc227823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype227847* t;
Ropeobj178009* r;
Ropeobj178009* heaproot;
};
struct  Tsym227841  {
  Tidobj200015 Sup;
NU8 kind;
union{
struct {Ttypeseq227843* typeinstcache;
Tscope227835* typscope;
} S1;
struct {TY227944* procinstcache;
Tsym227841* gcunsafetyreason;
} S2;
struct {TY227944* usedgenerics;
Tstrtable227813 tab;
} S3;
struct {Tsym227841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype227847* typ;
Tident200021* name;
Tlineinfo192352 info;
Tsym227841* owner;
NU32 flags;
Tnode227809* ast;
NU32 options;
NI position;
NI offset;
Tloc227823 loc;
Tlib227827* annex;
Tnode227809* constraint;
};
struct  Ttype227847  {
  Tidobj200015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq227843* sons;
Tnode227809* n;
Tsym227841* owner;
Tsym227841* sym;
Tsym227841* destructor;
Tsym227841* deepcopy;
Tsym227841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc227823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* TY195306[2];
struct  Tident200021  {
  Tidobj200015 Sup;
NimStringDesc* s;
Tident200021* next;
NI h;
};
struct  Tpasscontext279005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset224056  {
NI counter;
NI max;
Trunk224052* head;
Trunkseq224054* data;
};
struct  Tlinkedlist143028  {
Tlistentry143022* head;
Tlistentry143022* tail;
NI counter;
};
struct  Tidtable227859  {
NI counter;
Tidpairseq227857* data;
};
typedef N_NIMCALL_PTR(Tnode227809*, TY282074) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282079) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282087) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282095) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282100) (Tcontext282023* c, Tnode227809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode227809*, TY282108) (Tcontext282023* c, Tnode227809* n);
typedef N_NIMCALL_PTR(Tnode227809*, TY282113) (Tcontext282023* c, Tnode227809* n, Tnode227809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype227847*, TY282120) (Tcontext282023* c, Tnode227809* n, Ttype227847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode227809*, ClPrc) (Tcontext282023* c, Tidtable227859 pt, Tnode227809* n, void* ClEnv);
void* ClEnv;
} TY282126;
typedef struct {
N_NIMCALL_PTR(Tsym227841*, ClPrc) (Tcontext282023* c, Tsym227841* fn, Tidtable227859 pt, Tlineinfo192352 info, void* ClEnv);
void* ClEnv;
} TY282132;
typedef N_NIMCALL_PTR(Tsym227841*, TY282148) (Tcontext282023* c, Tsym227841* dc, Ttype227847* t, Tlineinfo192352 info, NU8 op);
struct  Tcontext282023  {
  Tpasscontext279005 Sup;
Tsym227841* module;
Tscope227835* currentscope;
Tscope227835* importtable;
Tscope227835* toplevelscope;
Tproccon282011* p;
Tsymseq227811* friendmodules;
NI instcounter;
Intset224056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq227811* converters;
Tsymseq227811* patterns;
Tlinkedlist143028 optionstack;
Tidtable227859 symmapping;
Tlinkedlist143028 libs;
TY282074 semconstexpr;
TY282079 semexpr;
TY282087 semtryexpr;
TY282095 semtryconstexpr;
TY282100 semoperand;
TY282108 semconstboolexpr;
TY282113 semoverloadedcall;
TY282120 semtypenode;
TY282126 seminferredlambda;
TY282132 semgenerateinstance;
Intset224056 includedfiles;
Tstrtable227813 userpragmas;
Tctx281048* evalcontext;
Intset224056 unknownidents;
TY282143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY282148 insttypeboundop;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tnode227809  {
Ttype227847* typ;
Tlineinfo192352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym227841* sym;
} S4;
struct {Tident200021* ident;
} S5;
struct {Tnodeseq227803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Ropeobj178009  {
  TNimObject Sup;
Ropeobj178009* left;
Ropeobj178009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry143022  {
  TNimObject Sup;
Tlistentry143022* prev;
Tlistentry143022* next;
};
struct  Tlib227827  {
  Tlistentry143022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj178009* name;
Tnode227809* path;
};
struct  Tproccon282011  {
Tsym227841* owner;
Tsym227841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon282011* next;
NIM_BOOL wasforwarded;
Tnode227809* bracketexpr;
};
typedef NI TY30821[16];
struct  Trunk224052  {
Trunk224052* next;
NI key;
TY30821 bits;
};
struct  Tidpair227855  {
Tidobj200015* key;
TNimObject* val;
};
struct  Tctx281048  {
  Tpasscontext279005 Sup;
TY281254* code;
TY193420* debug;
Tnode227809* globals;
Tnode227809* constants;
Ttypeseq227843* types;
Tnode227809* currentexceptiona;
Tnode227809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype281233* prc;
Tsym227841* module;
Tnode227809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo192352 comesfromheuristic;
TY281273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair282013  {
Tsym227841* genericsym;
Tinstantiation227831* inst;
};
struct  Tinstantiation227831  {
Tsym227841* sym;
Ttypeseq227843* concretetypes;
TY227932* usedby;
NI compilesid;
};
struct TY281239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY281239 TY281242[256];
struct  PprocHEX3Aobjecttype281233  {
TY281234* blocks;
Tsym227841* sym;
TY281242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs281042* args, void* ClEnv);
void* ClEnv;
} Vmcallback281044;
struct TY281274 {
NimStringDesc* Field0;
Vmcallback281044 Field1;
};
struct  Tblock281030  {
Tsym227841* label;
TY281214* fixups;
};
struct  Vmargs281042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode227809* currentexception;
};
struct Tsymseq227811 {
  TGenericSeq Sup;
  Tsym227841* data[SEQ_DECL_SIZE];
};
struct Tnodeseq227803 {
  TGenericSeq Sup;
  Tnode227809* data[SEQ_DECL_SIZE];
};
struct Ttypeseq227843 {
  TGenericSeq Sup;
  Ttype227847* data[SEQ_DECL_SIZE];
};
struct TY227944 {
  TGenericSeq Sup;
  Tinstantiation227831* data[SEQ_DECL_SIZE];
};
struct Trunkseq224054 {
  TGenericSeq Sup;
  Trunk224052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq227857 {
  TGenericSeq Sup;
  Tidpair227855 data[SEQ_DECL_SIZE];
};
struct TY282143 {
  TGenericSeq Sup;
  Tinstantiationpair282013 data[SEQ_DECL_SIZE];
};
struct TY281254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY193420 {
  TGenericSeq Sup;
  Tlineinfo192352 data[SEQ_DECL_SIZE];
};
struct TY281273 {
  TGenericSeq Sup;
  TY281274 data[SEQ_DECL_SIZE];
};
struct TY227932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY281234 {
  TGenericSeq Sup;
  Tblock281030 data[SEQ_DECL_SIZE];
};
struct TY281214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tsym227841*, searchforprocnew_298197)(Tcontext282023* c, Tscope227835* scope, Tsym227841* fn);
N_NIMCALL(Tsym227841*, initidentiter_235147)(Tidentiter235141* ti, Tstrtable227813 tab, Tident200021* s);
N_NIMCALL(NIM_BOOL, sametype_262092)(Ttype227847* a, Ttype227847* b, NU8 flags);
N_NIMCALL(NU8, equalparams_257086)(Tnode227809* a, Tnode227809* b);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getprocheader_257447)(Tsym227841* sym, NU8 prefer);
N_NIMCALL(NimStringDesc*, HEX24_193879)(Tlineinfo192352 info);
N_NIMCALL(void, localerror_198128)(Tlineinfo192352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym227841*, nextidentiter_235156)(Tidentiter235141* ti, Tstrtable227813 tab);
STRING_LITERAL(TMP3292, "public implementation \'$1\' has non-public forward declaration i"
"n $2", 67);

N_NIMCALL(Tsym227841*, searchforprocnew_298197)(Tcontext282023* c, Tscope227835* scope, Tsym227841* fn) {
	Tsym227841* result;
	Tidentiter235141 it;
{	result = 0;
	memset((void*)(&it), 0, sizeof(it));
	result = initidentiter_235147((&it), (*scope).symbols, (*fn).name);
	{
		while (1) {
			if (!!((result == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				NU8 LOC9;
				LOC5 = 0;
				LOC5 = ((520192 &(1<<(((*result).kind)&31)))!=0);
				if (!(LOC5)) goto LA6;
				LOC5 = sametype_262092((*result).typ, (*fn).typ, 30);
				LA6: ;
				if (!LOC5) goto LA7;
				LOC9 = 0;
				LOC9 = equalparams_257086((*(*result).typ).n, (*(*fn).typ).n);
				switch (LOC9) {
				case ((NU8) 1):
				{
					{
						NIM_BOOL LOC13;
						NimStringDesc* message;
						TY195306 LOC17;
						LOC13 = 0;
						LOC13 = !((((*result).flags &(1<<((((NU8) 1))&31)))!=0));
						if (!(LOC13)) goto LA14;
						LOC13 = (((*fn).flags &(1<<((((NU8) 1))&31)))!=0);
						LA14: ;
						if (!LOC13) goto LA15;
						memset((void*)LOC17, 0, sizeof(LOC17));
						LOC17[0] = getprocheader_257447(result, ((NU8) 0));
						LOC17[1] = HEX24_193879((*result).info);
						message = nsuFormatOpenArray(((NimStringDesc*) &TMP3292), LOC17, 2);
						localerror_198128((*fn).info, ((NU16) 4), message);
					}
					LA15: ;
					goto BeforeRet;
				}
				break;
				case ((NU8) 2):
				{
					localerror_198128((*fn).info, ((NU16) 70), (*(*fn).name).s);
					goto BeforeRet;
				}
				break;
				case ((NU8) 0):
				{
				}
				break;
				}
			}
			LA7: ;
			result = nextidentiter_235156((&it), (*scope).symbols);
		} LA2: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym227841*, searchforproc_298278)(Tcontext282023* c, Tscope227835* scope, Tsym227841* fn) {
	Tsym227841* result;
	result = 0;
	result = searchforprocnew_298197(c, scope, fn);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_procfindInit000)(void) {
}

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

