/* Generated by Nim Compiler v0.13.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 Tsym216822 Tsym216822;
typedef struct Tcontext266020 Tcontext266020;
typedef struct Tscope216816 Tscope216816;
typedef struct Tidentiter223084 Tidentiter223084;
typedef struct Tident191012 Tident191012;
typedef struct Tstrtable216794 Tstrtable216794;
typedef struct Tsymseq216792 Tsymseq216792;
typedef struct Tnodeseq216784 Tnodeseq216784;
typedef struct Tidobj191006 Tidobj191006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq216824 Ttypeseq216824;
typedef struct TY216925 TY216925;
typedef struct Ttype216828 Ttype216828;
typedef struct Tlineinfo184337 Tlineinfo184337;
typedef struct Tnode216790 Tnode216790;
typedef struct Tloc216804 Tloc216804;
typedef struct Ropeobj172006 Ropeobj172006;
typedef struct Tlib216808 Tlib216808;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tpasscontext263002 Tpasscontext263002;
typedef struct Tproccon266008 Tproccon266008;
typedef struct Intset213035 Intset213035;
typedef struct Trunk213031 Trunk213031;
typedef struct Trunkseq213033 Trunkseq213033;
typedef struct Tlinkedlist138016 Tlinkedlist138016;
typedef struct Tlistentry138010 Tlistentry138010;
typedef struct Tidtable216840 Tidtable216840;
typedef struct Tidpairseq216838 Tidpairseq216838;
typedef struct Tctx265036 Tctx265036;
typedef struct TY266140 TY266140;
typedef struct Tinstantiation216812 Tinstantiation216812;
typedef struct Tidpair216836 Tidpair216836;
typedef struct TY265242 TY265242;
typedef struct TY185093 TY185093;
typedef struct PprocHEX3Aobjecttype265221 PprocHEX3Aobjecttype265221;
typedef struct TY265261 TY265261;
typedef struct Tinstantiationpair266010 Tinstantiationpair266010;
typedef struct TY216913 TY216913;
typedef struct TY265222 TY265222;
typedef struct TY265227 TY265227;
typedef struct TY265262 TY265262;
typedef struct Vmargs265030 Vmargs265030;
typedef struct Tblock265018 Tblock265018;
typedef struct TY265202 TY265202;
struct  Tidentiter223084  {
NI h;
Tident191012* name;
};
struct  Tstrtable216794  {
NI counter;
Tsymseq216792* data;
};
struct  Tscope216816  {
NI depthlevel;
Tstrtable216794 symbols;
Tnodeseq216784* usingsyms;
Tscope216816* 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  Tidobj191006  {
  TNimObject Sup;
NI id;
};
struct  Tlineinfo184337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc216804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype216828* t;
Ropeobj172006* r;
Ropeobj172006* heaproot;
};
struct  Tsym216822  {
  Tidobj191006 Sup;
NU8 kind;
union{
struct {Ttypeseq216824* typeinstcache;
Tscope216816* typscope;
} S1;
struct {TY216925* procinstcache;
Tsym216822* gcunsafetyreason;
} S2;
struct {TY216925* usedgenerics;
Tstrtable216794 tab;
} S3;
struct {Tsym216822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype216828* typ;
Tident191012* name;
Tlineinfo184337 info;
Tsym216822* owner;
NU32 flags;
Tnode216790* ast;
NU32 options;
NI position;
NI offset;
Tloc216804 loc;
Tlib216808* annex;
Tnode216790* constraint;
};
struct  Ttype216828  {
  Tidobj191006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq216824* sons;
Tnode216790* n;
Tsym216822* owner;
Tsym216822* sym;
Tsym216822* destructor;
Tsym216822* deepcopy;
Tsym216822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc216804 loc;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* TY186169[2];
struct  Tident191012  {
  Tidobj191006 Sup;
NimStringDesc* s;
Tident191012* next;
NI h;
};
struct  Tpasscontext263002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset213035  {
NI counter;
NI max;
Trunk213031* head;
Trunkseq213033* data;
};
struct  Tlinkedlist138016  {
Tlistentry138010* head;
Tlistentry138010* tail;
NI counter;
};
struct  Tidtable216840  {
NI counter;
Tidpairseq216838* data;
};
typedef N_NIMCALL_PTR(Tnode216790*, TY266071) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266076) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266084) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266092) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266097) (Tcontext266020* c, Tnode216790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode216790*, TY266105) (Tcontext266020* c, Tnode216790* n);
typedef N_NIMCALL_PTR(Tnode216790*, TY266110) (Tcontext266020* c, Tnode216790* n, Tnode216790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype216828*, TY266117) (Tcontext266020* c, Tnode216790* n, Ttype216828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode216790*, ClPrc) (Tcontext266020* c, Tidtable216840 pt, Tnode216790* n, void* ClEnv);
void* ClEnv;
} TY266123;
typedef struct {
N_NIMCALL_PTR(Tsym216822*, ClPrc) (Tcontext266020* c, Tsym216822* fn, Tidtable216840 pt, Tlineinfo184337 info, void* ClEnv);
void* ClEnv;
} TY266129;
typedef N_NIMCALL_PTR(Tsym216822*, TY266145) (Tcontext266020* c, Tsym216822* dc, Ttype216828* t, Tlineinfo184337 info, NU8 op);
struct  Tcontext266020  {
  Tpasscontext263002 Sup;
Tsym216822* module;
Tscope216816* currentscope;
Tscope216816* importtable;
Tscope216816* toplevelscope;
Tproccon266008* p;
Tsymseq216792* friendmodules;
NI instcounter;
Intset213035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq216792* converters;
Tsymseq216792* patterns;
Tlinkedlist138016 optionstack;
Tidtable216840 symmapping;
Tlinkedlist138016 libs;
TY266071 semconstexpr;
TY266076 semexpr;
TY266084 semtryexpr;
TY266092 semtryconstexpr;
TY266097 semoperand;
TY266105 semconstboolexpr;
TY266110 semoverloadedcall;
TY266117 semtypenode;
TY266123 seminferredlambda;
TY266129 semgenerateinstance;
Intset213035 includedfiles;
Tstrtable216794 userpragmas;
Tctx265036* evalcontext;
Intset213035 unknownidents;
TY266140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY266145 insttypeboundop;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tnode216790  {
Ttype216828* typ;
Tlineinfo184337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym216822* sym;
} S4;
struct {Tident191012* ident;
} S5;
struct {Tnodeseq216784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Ropeobj172006  {
  TNimObject Sup;
Ropeobj172006* left;
Ropeobj172006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry138010  {
  TNimObject Sup;
Tlistentry138010* prev;
Tlistentry138010* next;
};
struct  Tlib216808  {
  Tlistentry138010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj172006* name;
Tnode216790* path;
};
struct  Tproccon266008  {
Tsym216822* owner;
Tsym216822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon266008* next;
NIM_BOOL wasforwarded;
Tnode216790* bracketexpr;
};
typedef NI TY29418[16];
struct  Trunk213031  {
Trunk213031* next;
NI key;
TY29418 bits;
};
struct  Tidpair216836  {
Tidobj191006* key;
TNimObject* val;
};
struct  Tctx265036  {
  Tpasscontext263002 Sup;
TY265242* code;
TY185093* debug;
Tnode216790* globals;
Tnode216790* constants;
Ttypeseq216824* types;
Tnode216790* currentexceptiona;
Tnode216790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype265221* prc;
Tsym216822* module;
Tnode216790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo184337 comesfromheuristic;
TY265261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair266010  {
Tsym216822* genericsym;
Tinstantiation216812* inst;
};
struct  Tinstantiation216812  {
Tsym216822* sym;
Ttypeseq216824* concretetypes;
TY216913* usedby;
NI compilesid;
};
struct TY265227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY265227 TY265230[256];
struct  PprocHEX3Aobjecttype265221  {
TY265222* blocks;
Tsym216822* sym;
TY265230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs265030* args, void* ClEnv);
void* ClEnv;
} Vmcallback265032;
struct TY265262 {
NimStringDesc* Field0;
Vmcallback265032 Field1;
};
struct  Tblock265018  {
Tsym216822* label;
TY265202* fixups;
};
struct  Vmargs265030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode216790* currentexception;
};
struct Tsymseq216792 {
  TGenericSeq Sup;
  Tsym216822* data[SEQ_DECL_SIZE];
};
struct Tnodeseq216784 {
  TGenericSeq Sup;
  Tnode216790* data[SEQ_DECL_SIZE];
};
struct Ttypeseq216824 {
  TGenericSeq Sup;
  Ttype216828* data[SEQ_DECL_SIZE];
};
struct TY216925 {
  TGenericSeq Sup;
  Tinstantiation216812* data[SEQ_DECL_SIZE];
};
struct Trunkseq213033 {
  TGenericSeq Sup;
  Trunk213031* data[SEQ_DECL_SIZE];
};
struct Tidpairseq216838 {
  TGenericSeq Sup;
  Tidpair216836 data[SEQ_DECL_SIZE];
};
struct TY266140 {
  TGenericSeq Sup;
  Tinstantiationpair266010 data[SEQ_DECL_SIZE];
};
struct TY265242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY185093 {
  TGenericSeq Sup;
  Tlineinfo184337 data[SEQ_DECL_SIZE];
};
struct TY265261 {
  TGenericSeq Sup;
  TY265262 data[SEQ_DECL_SIZE];
};
struct TY216913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY265222 {
  TGenericSeq Sup;
  Tblock265018 data[SEQ_DECL_SIZE];
};
struct TY265202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tsym216822*, searchforprocnew_280157)(Tcontext266020* c, Tscope216816* scope, Tsym216822* fn);
N_NIMCALL(Tsym216822*, initidentiter_223087)(Tidentiter223084* ti, Tstrtable216794 tab, Tident191012* s);
N_NIMCALL(NIM_BOOL, sametype_246628)(Ttype216828* a, Ttype216828* b, NU8 flags);
N_NIMCALL(NU8, equalparams_242053)(Tnode216790* a, Tnode216790* b);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getprocheader_242324)(Tsym216822* sym, NU8 prefer);
N_NIMCALL(NimStringDesc*, HEX24_185431)(Tlineinfo184337 info);
N_NIMCALL(void, localerror_189080)(Tlineinfo184337 info, NU16 msg, NimStringDesc* arg);
N_NIMCALL(Tsym216822*, nextidentiter_223093)(Tidentiter223084* ti, Tstrtable216794 tab);
STRING_LITERAL(TMP3330, "public implementation \'$1\' has non-public forward declaration i"
"n $2", 67);

N_NIMCALL(Tsym216822*, searchforprocnew_280157)(Tcontext266020* c, Tscope216816* scope, Tsym216822* fn) {
	Tsym216822* result;
	Tidentiter223084 it;
{	result = 0;
	memset((void*)(&it), 0, sizeof(it));
	result = initidentiter_223087((&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_246628((*result).typ, (*fn).typ, 30);
				LA6: ;
				if (!LOC5) goto LA7;
				LOC9 = 0;
				LOC9 = equalparams_242053((*(*result).typ).n, (*(*fn).typ).n);
				switch (LOC9) {
				case ((NU8) 1):
				{
					{
						NIM_BOOL LOC13;
						NimStringDesc* message;
						TY186169 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_242324(result, ((NU8) 0));
						LOC17[1] = HEX24_185431((*result).info);
						message = nsuFormatOpenArray(((NimStringDesc*) &TMP3330), LOC17, 2);
						localerror_189080((*fn).info, ((NU16) 4), message);
					}
					LA15: ;
					goto BeforeRet;
				}
				break;
				case ((NU8) 2):
				{
					localerror_189080((*fn).info, ((NU16) 70), (*(*fn).name).s);
					goto BeforeRet;
				}
				break;
				case ((NU8) 0):
				{
				}
				break;
				}
			}
			LA7: ;
			result = nextidentiter_223093((&it), (*scope).symbols);
		} LA2: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tsym216822*, searchforproc_280226)(Tcontext266020* c, Tscope216816* scope, Tsym216822* fn) {
	Tsym216822* result;
	result = 0;
	result = searchforprocnew_280157(c, scope, fn);
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_procfindInit000)(void) {
}

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

