/* 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 Tsym223841 Tsym223841;
typedef struct Tcontext278023 Tcontext278023;
typedef struct Tscope223835 Tscope223835;
typedef struct Tidentiter231141 Tidentiter231141;
typedef struct Tident196021 Tident196021;
typedef struct Tstrtable223813 Tstrtable223813;
typedef struct Tsymseq223811 Tsymseq223811;
typedef struct Tnodeseq223803 Tnodeseq223803;
typedef struct Tidobj196015 Tidobj196015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq223843 Ttypeseq223843;
typedef struct TY223944 TY223944;
typedef struct Ttype223847 Ttype223847;
typedef struct Tlineinfo188352 Tlineinfo188352;
typedef struct Tnode223809 Tnode223809;
typedef struct Tloc223823 Tloc223823;
typedef struct Ropeobj174009 Ropeobj174009;
typedef struct Tlib223827 Tlib223827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tpasscontext275005 Tpasscontext275005;
typedef struct Tproccon278011 Tproccon278011;
typedef struct Intset220056 Intset220056;
typedef struct Trunk220052 Trunk220052;
typedef struct Trunkseq220054 Trunkseq220054;
typedef struct Tlinkedlist139028 Tlinkedlist139028;
typedef struct Tlistentry139022 Tlistentry139022;
typedef struct Tidtable223859 Tidtable223859;
typedef struct Tidpairseq223857 Tidpairseq223857;
typedef struct Tctx277048 Tctx277048;
typedef struct TY278143 TY278143;
typedef struct Tinstantiation223831 Tinstantiation223831;
typedef struct Tidpair223855 Tidpair223855;
typedef struct TY277254 TY277254;
typedef struct TY189420 TY189420;
typedef struct PprocHEX3Aobjecttype277233 PprocHEX3Aobjecttype277233;
typedef struct TY277273 TY277273;
typedef struct Tinstantiationpair278013 Tinstantiationpair278013;
typedef struct TY223932 TY223932;
typedef struct TY277234 TY277234;
typedef struct TY277239 TY277239;
typedef struct TY277274 TY277274;
typedef struct Vmargs277042 Vmargs277042;
typedef struct Tblock277030 Tblock277030;
typedef struct TY277214 TY277214;
struct  Tidentiter231141  {
NI h;
Tident196021* name;
};
struct  Tstrtable223813  {
NI counter;
Tsymseq223811* data;
};
struct  Tscope223835  {
NI depthlevel;
Tstrtable223813 symbols;
Tnodeseq223803* usingsyms;
Tscope223835* 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  Tidobj196015  {
  TNimObject Sup;
NI id;
};
struct  Tlineinfo188352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc223823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype223847* t;
Ropeobj174009* r;
Ropeobj174009* heaproot;
};
struct  Tsym223841  {
  Tidobj196015 Sup;
NU8 kind;
union{
struct {Ttypeseq223843* typeinstcache;
Tscope223835* typscope;
} S1;
struct {TY223944* procinstcache;
Tsym223841* gcunsafetyreason;
} S2;
struct {TY223944* usedgenerics;
Tstrtable223813 tab;
} S3;
struct {Tsym223841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype223847* typ;
Tident196021* name;
Tlineinfo188352 info;
Tsym223841* owner;
NU32 flags;
Tnode223809* ast;
NU32 options;
NI position;
NI offset;
Tloc223823 loc;
Tlib223827* annex;
Tnode223809* constraint;
};
struct  Ttype223847  {
  Tidobj196015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq223843* sons;
Tnode223809* n;
Tsym223841* owner;
Tsym223841* sym;
Tsym223841* destructor;
Tsym223841* deepcopy;
Tsym223841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc223823 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* TY191306[2];
struct  Tident196021  {
  Tidobj196015 Sup;
NimStringDesc* s;
Tident196021* next;
NI h;
};
struct  Tpasscontext275005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset220056  {
NI counter;
NI max;
Trunk220052* head;
Trunkseq220054* data;
};
struct  Tlinkedlist139028  {
Tlistentry139022* head;
Tlistentry139022* tail;
NI counter;
};
struct  Tidtable223859  {
NI counter;
Tidpairseq223857* data;
};
typedef N_NIMCALL_PTR(Tnode223809*, TY278074) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278079) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278087) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278095) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278100) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278108) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278113) (Tcontext278023* c, Tnode223809* n, Tnode223809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype223847*, TY278120) (Tcontext278023* c, Tnode223809* n, Ttype223847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode223809*, ClPrc) (Tcontext278023* c, Tidtable223859 pt, Tnode223809* n, void* ClEnv);
void* ClEnv;
} TY278126;
typedef struct {
N_NIMCALL_PTR(Tsym223841*, ClPrc) (Tcontext278023* c, Tsym223841* fn, Tidtable223859 pt, Tlineinfo188352 info, void* ClEnv);
void* ClEnv;
} TY278132;
typedef N_NIMCALL_PTR(Tsym223841*, TY278148) (Tcontext278023* c, Tsym223841* dc, Ttype223847* t, Tlineinfo188352 info, NU8 op);
struct  Tcontext278023  {
  Tpasscontext275005 Sup;
Tsym223841* module;
Tscope223835* currentscope;
Tscope223835* importtable;
Tscope223835* toplevelscope;
Tproccon278011* p;
Tsymseq223811* friendmodules;
NI instcounter;
Intset220056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq223811* converters;
Tsymseq223811* patterns;
Tlinkedlist139028 optionstack;
Tidtable223859 symmapping;
Tlinkedlist139028 libs;
TY278074 semconstexpr;
TY278079 semexpr;
TY278087 semtryexpr;
TY278095 semtryconstexpr;
TY278100 semoperand;
TY278108 semconstboolexpr;
TY278113 semoverloadedcall;
TY278120 semtypenode;
TY278126 seminferredlambda;
TY278132 semgenerateinstance;
Intset220056 includedfiles;
Tstrtable223813 userpragmas;
Tctx277048* evalcontext;
Intset220056 unknownidents;
TY278143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY278148 insttypeboundop;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tnode223809  {
Ttype223847* typ;
Tlineinfo188352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym223841* sym;
} S4;
struct {Tident196021* ident;
} S5;
struct {Tnodeseq223803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Ropeobj174009  {
  TNimObject Sup;
Ropeobj174009* left;
Ropeobj174009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry139022  {
  TNimObject Sup;
Tlistentry139022* prev;
Tlistentry139022* next;
};
struct  Tlib223827  {
  Tlistentry139022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj174009* name;
Tnode223809* path;
};
struct  Tproccon278011  {
Tsym223841* owner;
Tsym223841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon278011* next;
NIM_BOOL wasforwarded;
Tnode223809* bracketexpr;
};
typedef NI TY30821[16];
struct  Trunk220052  {
Trunk220052* next;
NI key;
TY30821 bits;
};
struct  Tidpair223855  {
Tidobj196015* key;
TNimObject* val;
};
struct  Tctx277048  {
  Tpasscontext275005 Sup;
TY277254* code;
TY189420* debug;
Tnode223809* globals;
Tnode223809* constants;
Ttypeseq223843* types;
Tnode223809* currentexceptiona;
Tnode223809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype277233* prc;
Tsym223841* module;
Tnode223809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo188352 comesfromheuristic;
TY277273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair278013  {
Tsym223841* genericsym;
Tinstantiation223831* inst;
};
struct  Tinstantiation223831  {
Tsym223841* sym;
Ttypeseq223843* concretetypes;
TY223932* usedby;
NI compilesid;
};
struct TY277239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY277239 TY277242[256];
struct  PprocHEX3Aobjecttype277233  {
TY277234* blocks;
Tsym223841* sym;
TY277242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs277042* args, void* ClEnv);
void* ClEnv;
} Vmcallback277044;
struct TY277274 {
NimStringDesc* Field0;
Vmcallback277044 Field1;
};
struct  Tblock277030  {
Tsym223841* label;
TY277214* fixups;
};
struct  Vmargs277042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode223809* currentexception;
};
struct Tsymseq223811 {
  TGenericSeq Sup;
  Tsym223841* data[SEQ_DECL_SIZE];
};
struct Tnodeseq223803 {
  TGenericSeq Sup;
  Tnode223809* data[SEQ_DECL_SIZE];
};
struct Ttypeseq223843 {
  TGenericSeq Sup;
  Ttype223847* data[SEQ_DECL_SIZE];
};
struct TY223944 {
  TGenericSeq Sup;
  Tinstantiation223831* data[SEQ_DECL_SIZE];
};
struct Trunkseq220054 {
  TGenericSeq Sup;
  Trunk220052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq223857 {
  TGenericSeq Sup;
  Tidpair223855 data[SEQ_DECL_SIZE];
};
struct TY278143 {
  TGenericSeq Sup;
  Tinstantiationpair278013 data[SEQ_DECL_SIZE];
};
struct TY277254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY189420 {
  TGenericSeq Sup;
  Tlineinfo188352 data[SEQ_DECL_SIZE];
};
struct TY277273 {
  TGenericSeq Sup;
  TY277274 data[SEQ_DECL_SIZE];
};
struct TY223932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY277234 {
  TGenericSeq Sup;
  Tblock277030 data[SEQ_DECL_SIZE];
};
struct TY277214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tsym223841*, searchforprocnew_294197)(Tcontext278023* c, Tscope223835* scope, Tsym223841* fn);
N_NIMCALL(Tsym223841*, initidentiter_231147)(Tidentiter231141* ti, Tstrtable223813 tab, Tident196021* s);
N_NIMCALL(NIM_BOOL, sametype_258092)(Ttype223847* a, Ttype223847* b, NU8 flags);
N_NIMCALL(NU8, equalparams_253086)(Tnode223809* a, Tnode223809* b);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getprocheader_253447)(Tsym223841* sym, NU8 prefer);
N_NIMCALL(NimStringDesc*, HEX24_189879)(Tlineinfo188352 info);
N_NIMCALL(void, localerror_194128)(Tlineinfo188352 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym223841*, nextidentiter_231156)(Tidentiter231141* ti, Tstrtable223813 tab);
STRING_LITERAL(TMP3291, "public implementation \'$1\' has non-public forward declaration i"
"n $2", 67);

N_NIMCALL(Tsym223841*, searchforprocnew_294197)(Tcontext278023* c, Tscope223835* scope, Tsym223841* fn) {
	Tsym223841* result;
	Tidentiter231141 it;
{	result = 0;
	memset((void*)(&it), 0, sizeof(it));
	result = initidentiter_231147((&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_258092((*result).typ, (*fn).typ, 30);
				LA6: ;
				if (!LOC5) goto LA7;
				LOC9 = 0;
				LOC9 = equalparams_253086((*(*result).typ).n, (*(*fn).typ).n);
				switch (LOC9) {
				case ((NU8) 1):
				{
					{
						NIM_BOOL LOC13;
						NimStringDesc* message;
						TY191306 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_253447(result, ((NU8) 0));
						LOC17[1] = HEX24_189879((*result).info);
						message = nsuFormatOpenArray(((NimStringDesc*) &TMP3291), LOC17, 2);
						localerror_194128((*fn).info, ((NU16) 4), message);
					}
					LA15: ;
					goto BeforeRet;
				}
				break;
				case ((NU8) 2):
				{
					localerror_194128((*fn).info, ((NU16) 70), (*(*fn).name).s);
					goto BeforeRet;
				}
				break;
				case ((NU8) 0):
				{
				}
				break;
				}
			}
			LA7: ;
			result = nextidentiter_231156((&it), (*scope).symbols);
		} LA2: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym223841*, searchforproc_294278)(Tcontext278023* c, Tscope223835* scope, Tsym223841* fn) {
	Tsym223841* result;
	result = 0;
	result = searchforprocnew_294197(c, scope, fn);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_procfindInit000)(void) {
}

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

