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

#include "nimbase.h"
#include <string.h>
typedef struct Tsym215822 Tsym215822;
typedef struct Tcontext265020 Tcontext265020;
typedef struct Tscope215816 Tscope215816;
typedef struct Tidentiter222084 Tidentiter222084;
typedef struct Tident190012 Tident190012;
typedef struct Tstrtable215794 Tstrtable215794;
typedef struct Tsymseq215792 Tsymseq215792;
typedef struct Tnodeseq215784 Tnodeseq215784;
typedef struct Tidobj190006 Tidobj190006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq215824 Ttypeseq215824;
typedef struct TY215925 TY215925;
typedef struct Ttype215828 Ttype215828;
typedef struct Tlineinfo183337 Tlineinfo183337;
typedef struct Tnode215790 Tnode215790;
typedef struct Tloc215804 Tloc215804;
typedef struct Ropeobj170006 Ropeobj170006;
typedef struct Tlib215808 Tlib215808;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tpasscontext262002 Tpasscontext262002;
typedef struct Tproccon265008 Tproccon265008;
typedef struct Intset212035 Intset212035;
typedef struct Trunk212031 Trunk212031;
typedef struct Trunkseq212033 Trunkseq212033;
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Tidtable215840 Tidtable215840;
typedef struct Tidpairseq215838 Tidpairseq215838;
typedef struct Tctx264036 Tctx264036;
typedef struct TY265140 TY265140;
typedef struct Tinstantiation215812 Tinstantiation215812;
typedef struct Tidpair215836 Tidpair215836;
typedef struct TY264242 TY264242;
typedef struct TY184090 TY184090;
typedef struct PprocHEX3Aobjecttype264221 PprocHEX3Aobjecttype264221;
typedef struct TY264261 TY264261;
typedef struct Tinstantiationpair265010 Tinstantiationpair265010;
typedef struct TY215913 TY215913;
typedef struct TY264222 TY264222;
typedef struct TY264227 TY264227;
typedef struct TY264262 TY264262;
typedef struct Vmargs264030 Vmargs264030;
typedef struct Tblock264018 Tblock264018;
typedef struct TY264202 TY264202;
struct  Tidentiter222084  {
NI h;
Tident190012* name;
};
struct  Tstrtable215794  {
NI counter;
Tsymseq215792* data;
};
struct  Tscope215816  {
NI depthlevel;
Tstrtable215794 symbols;
Tnodeseq215784* usingsyms;
Tscope215816* parent;
};
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  Tidobj190006  {
  TNimObject Sup;
NI id;
};
struct  Tlineinfo183337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc215804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype215828* t;
Ropeobj170006* r;
Ropeobj170006* heaproot;
};
struct  Tsym215822  {
  Tidobj190006 Sup;
NU8 kind;
union{
struct {Ttypeseq215824* typeinstcache;
Tscope215816* typscope;
} S1;
struct {TY215925* procinstcache;
Tsym215822* gcunsafetyreason;
} S2;
struct {TY215925* usedgenerics;
Tstrtable215794 tab;
} S3;
struct {Tsym215822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype215828* typ;
Tident190012* name;
Tlineinfo183337 info;
Tsym215822* owner;
NU32 flags;
Tnode215790* ast;
NU32 options;
NI position;
NI offset;
Tloc215804 loc;
Tlib215808* annex;
Tnode215790* constraint;
};
struct  Ttype215828  {
  Tidobj190006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq215824* sons;
Tnode215790* n;
Tsym215822* owner;
Tsym215822* sym;
Tsym215822* destructor;
Tsym215822* deepcopy;
Tsym215822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc215804 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* TY185169[2];
struct  Tident190012  {
  Tidobj190006 Sup;
NimStringDesc* s;
Tident190012* next;
NI h;
};
struct  Tpasscontext262002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset212035  {
NI counter;
NI max;
Trunk212031* head;
Trunkseq212033* data;
};
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
struct  Tidtable215840  {
NI counter;
Tidpairseq215838* data;
};
typedef N_NIMCALL_PTR(Tnode215790*, TY265071) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265076) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265084) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265092) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265097) (Tcontext265020* c, Tnode215790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode215790*, TY265105) (Tcontext265020* c, Tnode215790* n);
typedef N_NIMCALL_PTR(Tnode215790*, TY265110) (Tcontext265020* c, Tnode215790* n, Tnode215790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype215828*, TY265117) (Tcontext265020* c, Tnode215790* n, Ttype215828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode215790*, ClPrc) (Tcontext265020* c, Tidtable215840 pt, Tnode215790* n, void* ClEnv);
void* ClEnv;
} TY265123;
typedef struct {
N_NIMCALL_PTR(Tsym215822*, ClPrc) (Tcontext265020* c, Tsym215822* fn, Tidtable215840 pt, Tlineinfo183337 info, void* ClEnv);
void* ClEnv;
} TY265129;
typedef N_NIMCALL_PTR(Tsym215822*, TY265145) (Tcontext265020* c, Tsym215822* dc, Ttype215828* t, Tlineinfo183337 info, NU8 op);
struct  Tcontext265020  {
  Tpasscontext262002 Sup;
Tsym215822* module;
Tscope215816* currentscope;
Tscope215816* importtable;
Tscope215816* toplevelscope;
Tproccon265008* p;
Tsymseq215792* friendmodules;
NI instcounter;
Intset212035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq215792* converters;
Tsymseq215792* patterns;
Tlinkedlist135016 optionstack;
Tidtable215840 symmapping;
Tlinkedlist135016 libs;
TY265071 semconstexpr;
TY265076 semexpr;
TY265084 semtryexpr;
TY265092 semtryconstexpr;
TY265097 semoperand;
TY265105 semconstboolexpr;
TY265110 semoverloadedcall;
TY265117 semtypenode;
TY265123 seminferredlambda;
TY265129 semgenerateinstance;
Intset212035 includedfiles;
Tstrtable215794 userpragmas;
Tctx264036* evalcontext;
Intset212035 unknownidents;
TY265140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY265145 insttypeboundop;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tnode215790  {
Ttype215828* typ;
Tlineinfo183337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym215822* sym;
} S4;
struct {Tident190012* ident;
} S5;
struct {Tnodeseq215784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Ropeobj170006  {
  TNimObject Sup;
Ropeobj170006* left;
Ropeobj170006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib215808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj170006* name;
Tnode215790* path;
};
struct  Tproccon265008  {
Tsym215822* owner;
Tsym215822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon265008* next;
NIM_BOOL wasforwarded;
Tnode215790* bracketexpr;
};
typedef NI TY29619[8];
struct  Trunk212031  {
Trunk212031* next;
NI key;
TY29619 bits;
};
struct  Tidpair215836  {
Tidobj190006* key;
TNimObject* val;
};
struct  Tctx264036  {
  Tpasscontext262002 Sup;
TY264242* code;
TY184090* debug;
Tnode215790* globals;
Tnode215790* constants;
Ttypeseq215824* types;
Tnode215790* currentexceptiona;
Tnode215790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype264221* prc;
Tsym215822* module;
Tnode215790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo183337 comesfromheuristic;
TY264261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair265010  {
Tsym215822* genericsym;
Tinstantiation215812* inst;
};
struct  Tinstantiation215812  {
Tsym215822* sym;
Ttypeseq215824* concretetypes;
TY215913* usedby;
NI compilesid;
};
struct TY264227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY264227 TY264230[256];
struct  PprocHEX3Aobjecttype264221  {
TY264222* blocks;
Tsym215822* sym;
TY264230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs264030* args, void* ClEnv);
void* ClEnv;
} Vmcallback264032;
struct TY264262 {
NimStringDesc* Field0;
Vmcallback264032 Field1;
};
struct  Tblock264018  {
Tsym215822* label;
TY264202* fixups;
};
struct  Vmargs264030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode215790* currentexception;
};
struct Tsymseq215792 {
  TGenericSeq Sup;
  Tsym215822* data[SEQ_DECL_SIZE];
};
struct Tnodeseq215784 {
  TGenericSeq Sup;
  Tnode215790* data[SEQ_DECL_SIZE];
};
struct Ttypeseq215824 {
  TGenericSeq Sup;
  Ttype215828* data[SEQ_DECL_SIZE];
};
struct TY215925 {
  TGenericSeq Sup;
  Tinstantiation215812* data[SEQ_DECL_SIZE];
};
struct Trunkseq212033 {
  TGenericSeq Sup;
  Trunk212031* data[SEQ_DECL_SIZE];
};
struct Tidpairseq215838 {
  TGenericSeq Sup;
  Tidpair215836 data[SEQ_DECL_SIZE];
};
struct TY265140 {
  TGenericSeq Sup;
  Tinstantiationpair265010 data[SEQ_DECL_SIZE];
};
struct TY264242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY184090 {
  TGenericSeq Sup;
  Tlineinfo183337 data[SEQ_DECL_SIZE];
};
struct TY264261 {
  TGenericSeq Sup;
  TY264262 data[SEQ_DECL_SIZE];
};
struct TY215913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY264222 {
  TGenericSeq Sup;
  Tblock264018 data[SEQ_DECL_SIZE];
};
struct TY264202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tsym215822*, searchforprocnew_279157)(Tcontext265020* c, Tscope215816* scope, Tsym215822* fn);
N_NIMCALL(Tsym215822*, initidentiter_222087)(Tidentiter222084* ti, Tstrtable215794 tab, Tident190012* s);
N_NIMCALL(NIM_BOOL, sametype_245628)(Ttype215828* a, Ttype215828* b, NU8 flags);
N_NIMCALL(NU8, equalparams_241053)(Tnode215790* a, Tnode215790* b);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getprocheader_241324)(Tsym215822* sym, NU8 prefer);
N_NIMCALL(NimStringDesc*, HEX24_184431)(Tlineinfo183337 info);
N_NIMCALL(void, localerror_188080)(Tlineinfo183337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym215822*, nextidentiter_222093)(Tidentiter222084* ti, Tstrtable215794 tab);
STRING_LITERAL(TMP3327, "public implementation \'$1\' has non-public forward declaration i"
"n $2", 67);

N_NIMCALL(Tsym215822*, searchforprocnew_279157)(Tcontext265020* c, Tscope215816* scope, Tsym215822* fn) {
	Tsym215822* result;
	Tidentiter222084 it;
{	result = 0;
	memset((void*)(&it), 0, sizeof(it));
	result = initidentiter_222087((&it), (*scope).symbols, (*fn).name);
	{
		while (1) {
			if (!!((result == NIM_NIL))) goto LA2;
			{
				NIM_BOOL LOC5;
				NU8 LOC9;
				LOC5 = 0;
				LOC5 = ((258048 &(1U<<((NU)((*result).kind)&31U)))!=0);
				if (!(LOC5)) goto LA6;
				LOC5 = sametype_245628((*result).typ, (*fn).typ, 30);
				LA6: ;
				if (!LOC5) goto LA7;
				LOC9 = 0;
				LOC9 = equalparams_241053((*(*result).typ).n, (*(*fn).typ).n);
				switch (LOC9) {
				case ((NU8) 1):
				{
					{
						NIM_BOOL LOC13;
						NimStringDesc* message;
						TY185169 LOC17;
						LOC13 = 0;
						LOC13 = !((((*result).flags &(1U<<((NU)(((NU8) 1))&31U)))!=0));
						if (!(LOC13)) goto LA14;
						LOC13 = (((*fn).flags &(1U<<((NU)(((NU8) 1))&31U)))!=0);
						LA14: ;
						if (!LOC13) goto LA15;
						memset((void*)LOC17, 0, sizeof(LOC17));
						LOC17[0] = getprocheader_241324(result, ((NU8) 0));
						LOC17[1] = HEX24_184431((*result).info);
						message = nsuFormatOpenArray(((NimStringDesc*) &TMP3327), LOC17, 2);
						localerror_188080((*fn).info, ((NU16) 4), message);
					}
					LA15: ;
					goto BeforeRet;
				}
				break;
				case ((NU8) 2):
				{
					localerror_188080((*fn).info, ((NU16) 70), (*(*fn).name).s);
					goto BeforeRet;
				}
				break;
				case ((NU8) 0):
				{
				}
				break;
				}
			}
			LA7: ;
			result = nextidentiter_222093((&it), (*scope).symbols);
		} LA2: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym215822*, searchforproc_279226)(Tcontext265020* c, Tscope215816* scope, Tsym215822* fn) {
	Tsym215822* result;
	result = 0;
	result = searchforprocnew_279157(c, scope, fn);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_procfindInit000)(void) {
}

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

