/* Generated by Nim Compiler v0.11.2 */
/*   (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 Tnode191813 Tnode191813;
typedef struct Tcontext245023 Tcontext245023;
typedef struct Tsym191843 Tsym191843;
typedef struct Tpatterncontext401013 Tpatterncontext401013;
typedef struct Tnodeseq191807 Tnodeseq191807;
typedef struct Ttype191849 Ttype191849;
typedef struct Tidobj168015 Tidobj168015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq191845 Ttypeseq191845;
typedef struct Tscope191837 Tscope191837;
typedef struct TY191944 TY191944;
typedef struct Tstrtable191817 Tstrtable191817;
typedef struct Tsymseq191815 Tsymseq191815;
typedef struct Tident168021 Tident168021;
typedef struct Tlineinfo164338 Tlineinfo164338;
typedef struct Tloc191827 Tloc191827;
typedef struct Ropeobj162009 Ropeobj162009;
typedef struct Tlib191831 Tlib191831;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tcell46347 Tcell46347;
typedef struct Tcellseq46363 Tcellseq46363;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46359 Tcellset46359;
typedef struct Tpagedesc46355 Tpagedesc46355;
typedef struct Tmemregion28210 Tmemregion28210;
typedef struct Tsmallchunk27440 Tsmallchunk27440;
typedef struct Tllchunk28204 Tllchunk28204;
typedef struct Tbigchunk27442 Tbigchunk27442;
typedef struct Tintset27417 Tintset27417;
typedef struct Ttrunk27413 Ttrunk27413;
typedef struct Tavlnode28208 Tavlnode28208;
typedef struct Tgcstat48214 Tgcstat48214;
typedef struct TY401596 TY401596;
typedef struct Tpasscontext242005 Tpasscontext242005;
typedef struct Tproccon245011 Tproccon245011;
typedef struct Intset188056 Intset188056;
typedef struct Ttrunk188052 Ttrunk188052;
typedef struct Ttrunkseq188054 Ttrunkseq188054;
typedef struct Tlinkedlist130028 Tlinkedlist130028;
typedef struct Tlistentry130022 Tlistentry130022;
typedef struct Tidtable191861 Tidtable191861;
typedef struct Tidpairseq191859 Tidpairseq191859;
typedef struct Tctx244048 Tctx244048;
typedef struct TY245141 TY245141;
typedef struct Tinstantiation191833 Tinstantiation191833;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Tidpair191857 Tidpair191857;
typedef struct TY244253 TY244253;
typedef struct TY165036 TY165036;
typedef struct PprocHEX3Aobjecttype244232 PprocHEX3Aobjecttype244232;
typedef struct TY244272 TY244272;
typedef struct Tinstantiationpair245013 Tinstantiationpair245013;
typedef struct TY191933 TY191933;
typedef struct TY244233 TY244233;
typedef struct TY244239 TY244239;
typedef struct TY244273 TY244273;
typedef struct Vmargs244042 Vmargs244042;
typedef struct Tblock244030 Tblock244030;
typedef struct TY244213 TY244213;
struct  Tpatterncontext401013  {
Tsym191843* owner;
Tnodeseq191807* mapping;
NI formals;
Tcontext245023* c;
NIM_BOOL submatch;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj168015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable191817  {
NI counter;
Tsymseq191815* data;
};
struct  Tlineinfo164338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc191827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype191849* t;
Ropeobj162009* r;
Ropeobj162009* heaproot;
};
struct  Tsym191843  {
  Tidobj168015 Sup;
NU8 kind;
union{
struct {Ttypeseq191845* typeinstcache;
Tscope191837* typscope;
} S1;
struct {TY191944* procinstcache;
Tsym191843* gcunsafetyreason;
} S2;
struct {TY191944* usedgenerics;
Tstrtable191817 tab;
} S3;
struct {Tsym191843* guard;
} S4;
} kindU;
NU16 magic;
Ttype191849* typ;
Tident168021* name;
Tlineinfo164338 info;
Tsym191843* owner;
NU32 flags;
Tnode191813* ast;
NU32 options;
NI position;
NI offset;
Tloc191827 loc;
Tlib191831* annex;
Tnode191813* constraint;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode191813  {
Ttype191849* typ;
Tlineinfo164338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym191843* sym;
} S4;
struct {Tident168021* ident;
} S5;
struct {Tnodeseq191807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident168021  {
  Tidobj168015 Sup;
NimStringDesc* s;
Tident168021* next;
NI h;
};
struct  Ttype191849  {
  Tidobj168015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq191845* sons;
Tnode191813* n;
Tsym191843* owner;
Tsym191843* sym;
Tsym191843* destructor;
Tsym191843* deepcopy;
Tsym191843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc191827 loc;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tcell46347  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46363  {
NI len;
NI cap;
Tcell46347** d;
};
struct  Tcellset46359  {
NI counter;
NI max;
Tpagedesc46355* head;
Tpagedesc46355** data;
};
typedef Tsmallchunk27440* TY28222[512];
typedef Ttrunk27413* Ttrunkbuckets27415[256];
struct  Tintset27417  {
Ttrunkbuckets27415 data;
};
struct  Tmemregion28210  {
NI minlargeobj;
NI maxlargeobj;
TY28222 freesmallchunks;
Tllchunk28204* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27442* freechunkslist;
Tintset27417 chunkstarts;
Tavlnode28208* root;
Tavlnode28208* deleted;
Tavlnode28208* last;
Tavlnode28208* freeavlnodes;
};
struct  Tgcstat48214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48216  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46363 zct;
Tcellseq46363 decstack;
Tcellset46359 cycleroots;
Tcellseq46363 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  TY401596  {
NI HEX3Astate;
Tnode191813* p401485;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY401490;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3184) (Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3185) (Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3186) (Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn);
struct  Tpasscontext242005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset188056  {
NI counter;
NI max;
Ttrunk188052* head;
Ttrunkseq188054* data;
};
struct  Tlinkedlist130028  {
Tlistentry130022* head;
Tlistentry130022* tail;
NI counter;
};
struct  Tidtable191861  {
NI counter;
Tidpairseq191859* data;
};
typedef N_NIMCALL_PTR(Tnode191813*, TY245072) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245077) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245085) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245093) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245098) (Tcontext245023* c, Tnode191813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode191813*, TY245106) (Tcontext245023* c, Tnode191813* n);
typedef N_NIMCALL_PTR(Tnode191813*, TY245111) (Tcontext245023* c, Tnode191813* n, Tnode191813* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype191849*, TY245118) (Tcontext245023* c, Tnode191813* n, Ttype191849* prev);
typedef struct {
N_NIMCALL_PTR(Tnode191813*, ClPrc) (Tcontext245023* c, Tidtable191861 pt, Tnode191813* n, void* ClEnv);
void* ClEnv;
} TY245124;
typedef struct {
N_NIMCALL_PTR(Tsym191843*, ClPrc) (Tcontext245023* c, Tsym191843* fn, Tidtable191861 pt, Tlineinfo164338 info, void* ClEnv);
void* ClEnv;
} TY245130;
typedef N_NIMCALL_PTR(Tsym191843*, TY245146) (Tcontext245023* c, Tsym191843* dc, Ttype191849* t, Tlineinfo164338 info, NU8 op);
struct  Tcontext245023  {
  Tpasscontext242005 Sup;
Tsym191843* module;
Tscope191837* currentscope;
Tscope191837* importtable;
Tscope191837* toplevelscope;
Tproccon245011* p;
Tsymseq191815* friendmodules;
NI instcounter;
Intset188056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI incompilescontext;
NI ingenericinst;
Tsymseq191815* converters;
Tsymseq191815* patterns;
Tlinkedlist130028 optionstack;
Tidtable191861 symmapping;
Tlinkedlist130028 libs;
TY245072 semconstexpr;
TY245077 semexpr;
TY245085 semtryexpr;
TY245093 semtryconstexpr;
TY245098 semoperand;
TY245106 semconstboolexpr;
TY245111 semoverloadedcall;
TY245118 semtypenode;
TY245124 seminferredlambda;
TY245130 semgenerateinstance;
Intset188056 includedfiles;
Tstrtable191817 userpragmas;
Tctx244048* evalcontext;
Intset188056 unknownidents;
TY245141* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY245146 insttypeboundop;
};
struct  Tscope191837  {
NI depthlevel;
Tstrtable191817 symbols;
Tnodeseq191807* usingsyms;
Tscope191837* parent;
};
struct  Ropeobj162009  {
  TNimObject Sup;
Ropeobj162009* left;
Ropeobj162009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry130022  {
  TNimObject Sup;
Tlistentry130022* prev;
Tlistentry130022* next;
};
struct  Tlib191831  {
  Tlistentry130022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj162009* name;
Tnode191813* path;
};
typedef NI TY27420[16];
struct  Tpagedesc46355  {
Tpagedesc46355* next;
NI key;
TY27420 bits;
};
struct  Tbasechunk27438  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27440  {
  Tbasechunk27438 Sup;
Tsmallchunk27440* next;
Tsmallchunk27440* prev;
Tfreecell27430* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28204  {
NI size;
NI acc;
Tllchunk28204* next;
};
struct  Tbigchunk27442  {
  Tbasechunk27438 Sup;
Tbigchunk27442* next;
Tbigchunk27442* prev;
NI align;
NF data;
};
struct  Ttrunk27413  {
Ttrunk27413* next;
NI key;
TY27420 bits;
};
typedef Tavlnode28208* TY28214[2];
struct  Tavlnode28208  {
TY28214 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon245011  {
Tsym191843* owner;
Tsym191843* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon245011* next;
NIM_BOOL wasforwarded;
Tnode191813* bracketexpr;
};
struct  Ttrunk188052  {
Ttrunk188052* next;
NI key;
TY27420 bits;
};
struct  Tidpair191857  {
Tidobj168015* key;
TNimObject* val;
};
struct  Tctx244048  {
  Tpasscontext242005 Sup;
TY244253* code;
TY165036* debug;
Tnode191813* globals;
Tnode191813* constants;
Ttypeseq191845* types;
Tnode191813* currentexceptiona;
Tnode191813* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype244232* prc;
Tsym191843* module;
Tnode191813* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo164338 comesfromheuristic;
TY244272* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair245013  {
Tsym191843* genericsym;
Tinstantiation191833* inst;
};
struct  Tinstantiation191833  {
Tsym191843* sym;
Ttypeseq191845* concretetypes;
TY191933* usedby;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct TY244239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY244239 TY244236[256];
struct  PprocHEX3Aobjecttype244232  {
TY244233* blocks;
Tsym191843* sym;
TY244236 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs244042* args, void* ClEnv);
void* ClEnv;
} Vmcallback244044;
struct TY244273 {
NimStringDesc* Field0;
Vmcallback244044 Field1;
};
struct  Tblock244030  {
Tsym191843* label;
TY244213* fixups;
};
struct  Vmargs244042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode191813* currentexception;
};
struct Tnodeseq191807 {
  TGenericSeq Sup;
  Tnode191813* data[SEQ_DECL_SIZE];
};
struct Ttypeseq191845 {
  TGenericSeq Sup;
  Ttype191849* data[SEQ_DECL_SIZE];
};
struct TY191944 {
  TGenericSeq Sup;
  Tinstantiation191833* data[SEQ_DECL_SIZE];
};
struct Tsymseq191815 {
  TGenericSeq Sup;
  Tsym191843* data[SEQ_DECL_SIZE];
};
struct Ttrunkseq188054 {
  TGenericSeq Sup;
  Ttrunk188052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq191859 {
  TGenericSeq Sup;
  Tidpair191857 data[SEQ_DECL_SIZE];
};
struct TY245141 {
  TGenericSeq Sup;
  Tinstantiationpair245013 data[SEQ_DECL_SIZE];
};
struct TY244253 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY165036 {
  TGenericSeq Sup;
  Tlineinfo164338 data[SEQ_DECL_SIZE];
};
struct TY244272 {
  TGenericSeq Sup;
  TY244273 data[SEQ_DECL_SIZE];
};
struct TY191933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY244233 {
  TGenericSeq Sup;
  Tblock244030 data[SEQ_DECL_SIZE];
};
struct TY244213 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_194351)(Ttype191849* n);
N_NIMCALL(Tnode191813*, matchstmtlist_402037)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n_402041);
static N_INLINE(NI, len_192097)(Tnode191813* n);
N_NIMCALL(Tnode191813*, flattenstmts_220759)(Tnode191813* n);
N_NIMCALL(NIM_BOOL, matchrange_402043)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n, NI i);
N_NIMCALL(NIM_BOOL, matches_401075)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n_401079);
static N_INLINE(NIM_BOOL, ispatternparam_401320)(Tpatterncontext401013* c, Tnode191813* p);
N_NIMCALL(NIM_BOOL, bindorcheck_401413)(Tpatterncontext401013* c, Tsym191843* param, Tnode191813* n);
N_NIMCALL(Tnode191813*, getlazy_401025)(Tpatterncontext401013* c, Tsym191843* sym);
N_NIMCALL(NIM_BOOL, sametrees_401124)(Tnode191813* a, Tnode191813* b);
static N_INLINE(NIM_BOOL, samekinds_401093)(Tnode191813* a, Tnode191813* b);
N_NIMCALL(NU8, canonkind_401083)(Tnode191813* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_226108)(Ttype191849* a, Ttype191849* b, NU8 flags);
N_NIMCALL(NI, sonslen_194403)(Tnode191813* n);
N_NIMCALL(NIM_BOOL, checktypes_401273)(Tpatterncontext401013* c, Tsym191843* p, Tnode191813* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_270284)(Tnode191813* p, Tnode191813* n);
N_NIMCALL(NIM_BOOL, argtypematches_351522)(Tcontext245023* c, Ttype191849* f, Ttype191849* a);
N_NIMCALL(void, putlazy_401045)(Tpatterncontext401013* c, Tsym191843* sym, Tnode191813* n);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Tcell46347*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46347* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46363* s, Tcell46347* c);
N_NIMCALL(NIM_BOOL, insymchoice_401188)(Tnode191813* sc, Tnode191813* x);
N_NIMCALL(NIM_BOOL, matchchoice_401363)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n);
N_NIMCALL(NIM_BOOL, matchnested_401482)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3183)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode191813*, newnodei_193351)(NU8 kind, Tlineinfo164338 info);
N_CLOSURE(NIM_BOOL, matchstaraux_401489)(Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode191813*, HEX5BHEX5D_192244)(Tnode191813* n, NI i);
N_NIMCALL(void, add_192164)(Tnode191813* father, Tnode191813* son);
N_NIMCALL(void, internalerror_166199)(Tlineinfo164338 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_401447)(Tpatterncontext401013* c, Tsym191843* param, Tnode191813* n);
N_NIMCALL(Tnode191813*, newnodei_193407)(NU8 kind, Tlineinfo164338 info, NI children);
N_NIMCALL(Tnode191813*, lastson_194431)(Tnode191813* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_81204, TNimType* mt);
N_NIMCALL(Tnode191813*, extractrange_220771)(NU8 k, Tnode191813* n, NI a, NI b);
N_NIMCALL(Tnode191813*, newsymnode_193338)(Tsym191843* sym, Tlineinfo164338 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_402163)(Tnode191813* params);
N_NIMCALL(NU8, whichalias_269080)(Tsym191843* p);
N_NIMCALL(void, addtoarglist_402223)(Tnode191813* result, Tnode191813* n);
N_NIMCALL(NU8, ispartof_400375)(Tnode191813* a, Tnode191813* b);
N_NIMCALL(void, markused_345251)(Tlineinfo164338 info, Tsym191843* s);
STRING_LITERAL(TMP3178, "|", 1);
STRING_LITERAL(TMP3179, "*", 1);
STRING_LITERAL(TMP3180, "**", 2);
STRING_LITERAL(TMP3181, "~", 1);
STRING_LITERAL(TMP3187, "invalid pattern", 15);
extern TNimType NTI191807; /* TNodeSeq */
extern Tgcheap48216 gch_48244;
TNimType NTI401596; /* object */
extern TNimType NTI311033; /* range -1..0(int) */
extern TNimType NTI191805; /* PNode */
TNimType NTI401624; /* ref object */

static N_INLINE(NI, len_192097)(Tnode191813* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.sons == 0) goto LA3;
		result = ((NI) 0);
	}
	goto LA1;
	LA3: ;
	{
		result = ((*n).kindU.S6.sons ? (*n).kindU.S6.sons->Sup.len : 0);
	}
	LA1: ;
	return result;
}

static N_INLINE(NIM_BOOL, ispatternparam_401320)(Tpatterncontext401013* c, Tnode191813* p) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC2;
	result = 0;
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = ((*p).kind == ((NU8) 3));
	if (!(LOC2)) goto LA3;
	LOC2 = ((*(*p).kindU.S4.sym).kind == ((NU8) 3));
	LA3: ;
	LOC1 = LOC2;
	if (!(LOC1)) goto LA4;
	LOC1 = ((*(*p).kindU.S4.sym).owner == (*c).owner);
	LA4: ;
	result = LOC1;
	return result;
}

N_NIMCALL(Tnode191813*, getlazy_401025)(Tpatterncontext401013* c, Tsym191843* sym) {
	Tnode191813* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_401083)(Tnode191813* n) {
	NU8 result;
	result = 0;
	result = (*n).kind;
	switch (result) {
	case ((NU8) 27):
	case ((NU8) 29):
	case ((NU8) 30):
	case ((NU8) 31):
	case ((NU8) 26):
	case ((NU8) 28):
	case ((NU8) 32):
	{
		result = ((NU8) 27);
	}
	break;
	case ((NU8) 20) ... ((NU8) 22):
	{
		result = ((NU8) 20);
	}
	break;
	case ((NU8) 74):
	{
		result = ((NU8) 73);
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

static N_INLINE(NIM_BOOL, samekinds_401093)(Tnode191813* a, Tnode191813* b) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NU8 LOC3;
	NU8 LOC4;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*a).kind == (*b).kind);
	if (LOC1) goto LA2;
	LOC3 = 0;
	LOC3 = canonkind_401083(a);
	LOC4 = 0;
	LOC4 = canonkind_401083(b);
	LOC1 = (LOC3 == LOC4);
	LA2: ;
	result = LOC1;
	return result;
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL LOC11;
	int LOC13;
{	result = 0;
	{
		if (!(a == b)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = (a == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = ((*a).Sup.len == (*b).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC13 = 0;
	LOC13 = memcmp(((NCSTRING) ((*a).data)), ((NCSTRING) ((*b).data)), (*a).Sup.len);
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, sametrees_401124)(Tnode191813* a, Tnode191813* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_401093(a, b);
		if (!LOC3) goto LA4;
		switch ((*a).kind) {
		case ((NU8) 3):
		{
			result = ((*a).kindU.S4.sym == (*b).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*a).kindU.S5.ident).Sup.id == (*(*b).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*a).kindU.S1.intval == (*b).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*a).kindU.S2.floatval == (*b).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*a).kindU.S3.strval, (*b).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		{
			result = NIM_TRUE;
		}
		break;
		case ((NU8) 4):
		{
			result = sametypeornil_226108((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_194403(a);
				LOC17 = 0;
				LOC17 = sonslen_194403(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_401162;
					NI HEX3Atmp_401166;
					NI LOC21;
					NI res_401169;
					i_401162 = 0;
					HEX3Atmp_401166 = 0;
					LOC21 = 0;
					LOC21 = sonslen_194403(a);
					HEX3Atmp_401166 = (NI)(LOC21 - ((NI) 1));
					res_401169 = ((NI) 0);
					{
						while (1) {
							if (!(res_401169 <= HEX3Atmp_401166)) goto LA23;
							i_401162 = res_401169;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_401124((*a).kindU.S6.sons->data[i_401162], (*b).kindU.S6.sons->data[i_401162]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_401169 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_401273)(Tpatterncontext401013* c, Tsym191843* p, Tnode191813* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_270284((*p).constraint, n);
		{
			if (!!(result)) goto LA7;
			goto BeforeRet;
		}
		LA7: ;
	}
	LA3: ;
	{
		if (!(*n).typ == 0) goto LA11;
		result = ((*(*p).typ).kind == ((NU8) 3) || (*(*p).typ).kind == ((NU8) 7));
	}
	goto LA9;
	LA11: ;
	{
		result = argtypematches_351522((*c).c, (*p).typ, (*n).typ);
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

static N_INLINE(Tcell46347*, usrtocell_49846)(void* usr) {
	Tcell46347* result;
	result = 0;
	result = ((Tcell46347*) ((NI)((NU32)(((NI) (usr))) - (NU32)(((NI)sizeof(Tcell46347))))));
	return result;
}

static N_INLINE(void, rtladdzct_51404)(Tcell46347* c) {
	addzct_49817((&gch_48244.zct), c);
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		Tcell46347* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_49846(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Tcell46347* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_49846((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_51404(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, putlazy_401045)(Tpatterncontext401013* c, Tsym191843* sym, Tnode191813* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq191807*) newSeq((&NTI191807), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_401413)(Tpatterncontext401013* c, Tsym191843* param, Tnode191813* n) {
	NIM_BOOL result;
	Tnode191813* pp;
	result = 0;
	pp = getlazy_401025(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_401124(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_401273(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_401045(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_401188)(Tnode191813* sc, Tnode191813* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_401221;
			NI HEX3Atmp_401251;
			NI LOC6;
			NI res_401254;
			i_401221 = 0;
			HEX3Atmp_401251 = 0;
			LOC6 = 0;
			LOC6 = len_192097(sc);
			HEX3Atmp_401251 = (LOC6 - 1);
			res_401254 = ((NI) 0);
			{
				while (1) {
					if (!(res_401254 <= HEX3Atmp_401251)) goto LA8;
					i_401221 = res_401254;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_401221]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_401254 += ((NI) 1);
				} LA8: ;
			}
		}
	}
	goto LA1;
	LA3: ;
	{
		if (!((*sc).kind == ((NU8) 57))) goto LA14;
		result = ((*(*(*(*sc).kindU.S6.sons->data[((NI) 0)]).kindU.S4.sym).name).Sup.id == (*(*(*x).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA14: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchchoice_401363)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_401388;
		NI HEX3Atmp_401391;
		NI LOC2;
		NI res_401394;
		i_401388 = 0;
		HEX3Atmp_401391 = 0;
		LOC2 = 0;
		LOC2 = len_192097(p);
		HEX3Atmp_401391 = (LOC2 - 1);
		res_401394 = ((NI) 1);
		{
			while (1) {
				if (!(res_401394 <= HEX3Atmp_401391)) goto LA4;
				i_401388 = res_401394;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_401075(c, (*p).kindU.S6.sons->data[i_401388], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_401394 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3183)(void* p, NI op) {
	TY401596* a;
	a = (TY401596*)p;
	nimGCvisit((void*)(*a).p401485, op);
}

static N_INLINE(Tnode191813*, HEX5BHEX5D_192244)(Tnode191813* n, NI i) {
	Tnode191813* result;
	result = 0;
	result = (*n).kindU.S6.sons->data[i];
	return result;
}

N_CLOSURE(NIM_BOOL, matchstaraux_401489)(Tpatterncontext401013* c, Tnode191813* op, Tnode191813* n_401493, Tnode191813* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY401596* HEX3Aenvp_401620;
{	result = 0;
	HEX3Aenvp_401620 = (TY401596*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_401493).kind == ((NU8) 27) || (*n_401493).kind == ((NU8) 29) || (*n_401493).kind == ((NU8) 30) || (*n_401493).kind == ((NU8) 31) || (*n_401493).kind == ((NU8) 26) || (*n_401493).kind == ((NU8) 28) || (*n_401493).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_401075(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_401493).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_401519;
			NI HEX3Atmp_401566;
			NI LOC8;
			NI res_401569;
			i_401519 = 0;
			HEX3Atmp_401566 = 0;
			LOC8 = 0;
			LOC8 = sonslen_194403(n_401493);
			HEX3Atmp_401566 = (NI)(LOC8 - ((NI) 1));
			res_401569 = ((NI) 1);
			{
				while (1) {
					if (!(res_401569 <= HEX3Atmp_401566)) goto LA10;
					i_401519 = res_401569;
					{
						TY401490 LOC13;
						Tnode191813* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_401489; LOC13.ClEnv = HEX3Aenvp_401620;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_192244(n_401493, i_401519);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3184)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_401569 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_192164(arglist, (*n_401493).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode191813* n;
		LOC23 = 0;
		LOC23 = ((*n_401493).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_401493).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_401493).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_401562;
			NI HEX3Atmp_401574;
			NI LOC28;
			NI res_401577;
			i_401562 = 0;
			HEX3Atmp_401574 = 0;
			LOC28 = 0;
			LOC28 = len_192097(n);
			HEX3Atmp_401574 = (LOC28 - 1);
			res_401577 = ((NI) 0);
			{
				while (1) {
					if (!(res_401577 <= HEX3Atmp_401574)) goto LA30;
					i_401562 = res_401577;
					{
						TY401490 LOC33;
						Tnode191813* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_401489; LOC33.ClEnv = HEX3Aenvp_401620;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_192244(n, i_401562);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3185)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_401577 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_401273(c, (*(*(*HEX3Aenvp_401620).p401485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_401493);
		if (!LOC39) goto LA40;
		add_192164(arglist, n_401493);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_401482)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY401596* HEX3Aenv_401623;
{	result = 0;
	HEX3Aenv_401623 = 0;
	HEX3Aenv_401623 = (TY401596*) newObj((&NTI401624), sizeof(TY401596));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_401623).p401485), p);
	{
		if (!!(((*n).kind == ((NU8) 27) || (*n).kind == ((NU8) 29) || (*n).kind == ((NU8) 30) || (*n).kind == ((NU8) 31) || (*n).kind == ((NU8) 26) || (*n).kind == ((NU8) 28) || (*n).kind == ((NU8) 32)))) goto LA3;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		Tnode191813* arglist;
		LOC7 = 0;
		LOC7 = matches_401075(c, (*(*HEX3Aenv_401623).p401485).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_193351(((NU8) 152), (*n).info);
		{
			TY401490 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_401489; LOC12.ClEnv = HEX3Aenv_401623;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_401623).p401485, n, arglist, rpn, LOC12.ClEnv):((TMP3186)(LOC12.ClPrc))(c, (*HEX3Aenv_401623).p401485, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_401413(c, (*(*(*HEX3Aenv_401623).p401485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_401447)(Tpatterncontext401013* c, Tsym191843* param, Tnode191813* n) {
	Tnode191813* pp;
	pp = getlazy_401025(c, param);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = !((pp == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = ((*pp).kind == ((NU8) 152));
		LA4: ;
		if (!LOC3) goto LA5;
		add_192164(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_193407(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_401045(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_401075)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n_401079) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ispatternparam_401320(c, p);
		if (!LOC3) goto LA4;
		result = bindorcheck_401413(c, (*p).kindU.S4.sym, n_401079);
	}
	goto LA1;
	LA4: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = ((*n_401079).kind == ((NU8) 3));
		if (!(LOC7)) goto LA8;
		LOC7 = ((*p).kind == ((NU8) 2));
		LA8: ;
		if (!LOC7) goto LA9;
		result = ((*(*p).kindU.S5.ident).Sup.id == (*(*(*n_401079).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = ((*n_401079).kind == ((NU8) 3));
		if (!(LOC12)) goto LA13;
		LOC12 = insymchoice_401188(p, n_401079);
		LA13: ;
		if (!LOC12) goto LA14;
		result = NIM_TRUE;
	}
	goto LA1;
	LA14: ;
	{
		NIM_BOOL LOC17;
		LOC17 = 0;
		LOC17 = ((*n_401079).kind == ((NU8) 3));
		if (!(LOC17)) goto LA18;
		LOC17 = ((*(*n_401079).kindU.S4.sym).kind == ((NU8) 10));
		LA18: ;
		if (!LOC17) goto LA19;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA23;
			result = ((*p).kindU.S4.sym == (*n_401079).kindU.S4.sym);
		}
		goto LA21;
		LA23: ;
		{
			NIM_BOOL LOC26;
			LOC26 = 0;
			LOC26 = matches_401075(c, p, (*(*n_401079).kindU.S4.sym).ast);
			if (!LOC26) goto LA27;
			result = NIM_TRUE;
		}
		goto LA21;
		LA27: ;
		LA21: ;
	}
	goto LA1;
	LA19: ;
	{
		NimStringDesc* opr;
		if (!((*p).kind == ((NU8) 153))) goto LA30;
		opr = (*(*(*p).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident).s;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3178))) goto LA32;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3179))) goto LA33;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3180))) goto LA34;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3181))) goto LA35;
		goto LA36;
		LA32: ;
		{
			result = matchchoice_401363(c, p, n_401079);
		}
		goto LA37;
		LA33: ;
		{
			result = matchnested_401482(c, p, n_401079, NIM_FALSE);
		}
		goto LA37;
		LA34: ;
		{
			result = matchnested_401482(c, p, n_401079, NIM_TRUE);
		}
		goto LA37;
		LA35: ;
		{
			NIM_BOOL LOC42;
			LOC42 = 0;
			LOC42 = matches_401075(c, (*p).kindU.S6.sons->data[((NI) 1)], n_401079);
			result = !(LOC42);
		}
		goto LA37;
		LA36: ;
		{
			internalerror_166199((*p).info, ((NimStringDesc*) &TMP3187));
		}
		LA37: ;
	}
	goto LA1;
	LA30: ;
	{
		if (!((*p).kind == ((NU8) 40))) goto LA45;
		{
			if (!((*(*p).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 30))) goto LA49;
			{
				NIM_BOOL LOC53;
				LOC53 = 0;
				LOC53 = matches_401075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_401079);
				if (!LOC53) goto LA54;
				gather_401447(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_401079);
				result = NIM_TRUE;
			}
			LA54: ;
		}
		goto LA47;
		LA49: ;
		{
			{
				NIM_BOOL LOC59;
				LOC59 = 0;
				LOC59 = matches_401075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_401079);
				if (!LOC59) goto LA60;
				result = bindorcheck_401413(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_401079);
			}
			LA60: ;
		}
		LA47: ;
	}
	goto LA1;
	LA45: ;
	{
		NIM_BOOL LOC63;
		LOC63 = 0;
		LOC63 = samekinds_401093(p, n_401079);
		if (!LOC63) goto LA64;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_401079).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_401079).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_401079).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_401079).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_401079).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode191813* v;
			plen = sonslen_194403(p);
			v = lastson_194431(p);
			{
				NIM_BOOL LOC75;
				Tnode191813* arglist;
				LOC75 = 0;
				LOC75 = ispatternparam_401320(c, v);
				if (!(LOC75)) goto LA76;
				LOC75 = ((*(*(*v).kindU.S4.sym).typ).kind == ((NU8) 48));
				LA76: ;
				if (!LOC75) goto LA77;
				arglist = 0;
				{
					NI LOC81;
					LOC81 = 0;
					LOC81 = sonslen_194403(n_401079);
					if (!(plen <= LOC81)) goto LA82;
					{
						NI i_401851;
						NI HEX3Atmp_401947;
						NI res_401950;
						i_401851 = 0;
						HEX3Atmp_401947 = 0;
						HEX3Atmp_401947 = (NI)(plen - ((NI) 2));
						res_401950 = ((NI) 0);
						{
							while (1) {
								if (!(res_401950 <= HEX3Atmp_401947)) goto LA86;
								i_401851 = res_401950;
								{
									NIM_BOOL LOC89;
									LOC89 = 0;
									LOC89 = matches_401075(c, (*p).kindU.S6.sons->data[i_401851], (*n_401079).kindU.S6.sons->data[i_401851]);
									if (!!(LOC89)) goto LA90;
									goto BeforeRet;
								}
								LA90: ;
								res_401950 += ((NI) 1);
							} LA86: ;
						}
					}
					{
						NIM_BOOL LOC94;
						NIM_BOOL LOC95;
						NI LOC96;
						Tnode191813* LOC98;
						Tnode191813* LOC100;
						Tnode191813* n;
						Tnode191813* LOC103;
						NI LOC104;
						LOC94 = 0;
						LOC95 = 0;
						LOC96 = 0;
						LOC96 = sonslen_194403(n_401079);
						LOC95 = (plen == LOC96);
						if (!(LOC95)) goto LA97;
						LOC98 = 0;
						LOC98 = lastson_194431(n_401079);
						LOC95 = ((*LOC98).kind == ((NU8) 58));
						LA97: ;
						LOC94 = LOC95;
						if (!(LOC94)) goto LA99;
						LOC100 = 0;
						LOC100 = lastson_194431(n_401079);
						LOC94 = ((*(*LOC100).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA99: ;
						if (!LOC94) goto LA101;
						LOC103 = 0;
						LOC103 = lastson_194431(n_401079);
						n = (*LOC103).kindU.S6.sons->data[((NI) 1)];
						LOC104 = 0;
						LOC104 = len_192097(n);
						arglist = newnodei_193407(((NU8) 152), (*n).info, LOC104);
						{
							NI i_401895;
							NI HEX3Atmp_401955;
							NI LOC106;
							NI res_401958;
							i_401895 = 0;
							HEX3Atmp_401955 = 0;
							LOC106 = 0;
							LOC106 = len_192097(n);
							HEX3Atmp_401955 = (LOC106 - 1);
							res_401958 = ((NI) 0);
							{
								while (1) {
									if (!(res_401958 <= HEX3Atmp_401955)) goto LA108;
									i_401895 = res_401958;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_401895]), (*n).kindU.S6.sons->data[i_401895]);
									res_401958 += ((NI) 1);
								} LA108: ;
							}
						}
					}
					goto LA92;
					LA101: ;
					{
						NI LOC110;
						LOC110 = 0;
						LOC110 = sonslen_194403(n_401079);
						arglist = newnodei_193407(((NU8) 152), (*n_401079).info, (NI)((NI)(LOC110 - plen) + ((NI) 1)));
						{
							NI i_401910;
							NI HEX3Atmp_401963;
							NI LOC112;
							NI res_401966;
							i_401910 = 0;
							HEX3Atmp_401963 = 0;
							LOC112 = 0;
							LOC112 = sonslen_194403(n_401079);
							HEX3Atmp_401963 = (NI)(LOC112 - plen);
							res_401966 = ((NI) 0);
							{
								while (1) {
									if (!(res_401966 <= HEX3Atmp_401963)) goto LA114;
									i_401910 = res_401966;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_401910]), (*n_401079).kindU.S6.sons->data[(NI)((NI)(i_401910 + plen) - ((NI) 1))]);
									res_401966 += ((NI) 1);
								} LA114: ;
							}
						}
					}
					LA92: ;
					result = bindorcheck_401413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA79;
				LA82: ;
				{
					NI LOC116;
					LOC116 = 0;
					LOC116 = sonslen_194403(n_401079);
					if (!((NI)(plen - ((NI) 1)) == LOC116)) goto LA117;
					{
						NI i_401926;
						NI HEX3Atmp_401971;
						NI res_401974;
						i_401926 = 0;
						HEX3Atmp_401971 = 0;
						HEX3Atmp_401971 = (NI)(plen - ((NI) 2));
						res_401974 = ((NI) 0);
						{
							while (1) {
								if (!(res_401974 <= HEX3Atmp_401971)) goto LA121;
								i_401926 = res_401974;
								{
									NIM_BOOL LOC124;
									LOC124 = 0;
									LOC124 = matches_401075(c, (*p).kindU.S6.sons->data[i_401926], (*n_401079).kindU.S6.sons->data[i_401926]);
									if (!!(LOC124)) goto LA125;
									goto BeforeRet;
								}
								LA125: ;
								res_401974 += ((NI) 1);
							} LA121: ;
						}
					}
					arglist = newnodei_193351(((NU8) 152), (*n_401079).info);
					result = bindorcheck_401413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA79;
				LA117: ;
				LA79: ;
			}
			LA77: ;
			{
				NI LOC129;
				LOC129 = 0;
				LOC129 = sonslen_194403(n_401079);
				if (!(plen == LOC129)) goto LA130;
				{
					NI i_401942;
					NI HEX3Atmp_401979;
					NI LOC133;
					NI res_401982;
					i_401942 = 0;
					HEX3Atmp_401979 = 0;
					LOC133 = 0;
					LOC133 = sonslen_194403(p);
					HEX3Atmp_401979 = (NI)(LOC133 - ((NI) 1));
					res_401982 = ((NI) 0);
					{
						while (1) {
							if (!(res_401982 <= HEX3Atmp_401979)) goto LA135;
							i_401942 = res_401982;
							{
								NIM_BOOL LOC138;
								LOC138 = 0;
								LOC138 = matches_401075(c, (*p).kindU.S6.sons->data[i_401942], (*n_401079).kindU.S6.sons->data[i_401942]);
								if (!!(LOC138)) goto LA139;
								goto BeforeRet;
							}
							LA139: ;
							res_401982 += ((NI) 1);
						} LA135: ;
					}
				}
				result = NIM_TRUE;
			}
			LA130: ;
		}
		break;
		}
	}
	goto LA1;
	LA64: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_402043)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_402069;
		NI HEX3Atmp_402081;
		NI LOC2;
		NI res_402084;
		j_402069 = 0;
		HEX3Atmp_402081 = 0;
		LOC2 = 0;
		LOC2 = len_192097(p);
		HEX3Atmp_402081 = (LOC2 - 1);
		res_402084 = ((NI) 0);
		{
			while (1) {
				if (!(res_402084 <= HEX3Atmp_402081)) goto LA4;
				j_402069 = res_402084;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_401075(c, (*p).kindU.S6.sons->data[j_402069], (*n).kindU.S6.sons->data[(NI)(i + j_402069)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI191807));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_402084 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode191813*, matchstmtlist_402037)(Tpatterncontext401013* c, Tnode191813* p, Tnode191813* n_402041) {
	Tnode191813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode191813* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_402041).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_192097(p);
		LOC8 = 0;
		LOC8 = len_192097(n_402041);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_220759(n_402041);
		{
			NI i_402121;
			NI HEX3Atmp_402129;
			NI LOC12;
			NI LOC13;
			NI res_402132;
			i_402121 = 0;
			HEX3Atmp_402129 = 0;
			LOC12 = 0;
			LOC12 = len_192097(n);
			LOC13 = 0;
			LOC13 = len_192097(p);
			HEX3Atmp_402129 = (NI)(LOC12 - LOC13);
			res_402132 = ((NI) 0);
			{
				while (1) {
					if (!(res_402132 <= HEX3Atmp_402129)) goto LA15;
					i_402121 = res_402132;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_402043(c, p, n, i_402121);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_193407(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_220771(((NU8) 115), n, ((NI) 0), (NI)(i_402121 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_192097(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_220771(((NU8) 115), n, i_402121, (NI)((NI)(i_402121 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_192097(p);
						LOC23 = 0;
						LOC23 = len_192097(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_220771(((NU8) 115), n, (NI)(i_402121 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_402132 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_401075(c, p, n_402041);
		if (!LOC25) goto LA26;
		result = n_402041;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_402163)(Tnode191813* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_192097(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_402187;
			NI HEX3Atmp_402201;
			NI LOC7;
			NI res_402204;
			i_402187 = 0;
			HEX3Atmp_402201 = 0;
			LOC7 = 0;
			LOC7 = len_192097(params);
			HEX3Atmp_402201 = (LOC7 - 1);
			res_402204 = ((NI) 1);
			{
				while (1) {
					Tsym191843* param;
					if (!(res_402204 <= HEX3Atmp_402201)) goto LA9;
					i_402187 = res_402204;
					param = (*(*params).kindU.S6.sons->data[i_402187]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_269080(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_402204 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_402223)(Tnode191813* result, Tnode191813* n) {
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = !(((*n).typ == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = !(((*(*n).typ).kind == ((NU8) 7)));
		LA4: ;
		if (!LOC3) goto LA5;
		{
			if (!!(((*n).kind == ((NU8) 152)))) goto LA9;
			add_192164(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_402277;
				NI HEX3Atmp_402281;
				NI LOC13;
				NI res_402284;
				i_402277 = 0;
				HEX3Atmp_402281 = 0;
				LOC13 = 0;
				LOC13 = len_192097(n);
				HEX3Atmp_402281 = (LOC13 - 1);
				res_402284 = ((NI) 0);
				{
					while (1) {
						if (!(res_402284 <= HEX3Atmp_402281)) goto LA15;
						i_402277 = res_402284;
						add_192164(result, (*n).kindU.S6.sons->data[i_402277]);
						res_402284 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode191813*, applyrule_402303)(Tcontext245023* c, Tsym191843* s, Tnode191813* n) {
	Tnode191813* result;
	Tpatterncontext401013 ctx;
	NI LOC1;
	Tnode191813* m;
	Tnode191813* LOC6;
	Tnode191813* params;
	NIM_BOOL requiresaa;
	Tnode191813* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_194351((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_402037((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_193351(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_193338(s, (*n).info);
	add_192164(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_402163(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_193351(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_402347;
		NI HEX3Atmp_402605;
		NI LOC12;
		NI res_402608;
		i_402347 = 0;
		HEX3Atmp_402605 = 0;
		LOC12 = 0;
		LOC12 = len_192097(params);
		HEX3Atmp_402605 = (LOC12 - 1);
		res_402608 = ((NI) 1);
		{
			while (1) {
				Tsym191843* param;
				Tnode191813* x;
				if (!(res_402608 <= HEX3Atmp_402605)) goto LA14;
				i_402347 = res_402608;
				param = (*(*params).kindU.S6.sons->data[i_402347]).kindU.S4.sym;
				x = getlazy_401025((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_192164(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_402223(args, x);
				}
				LA21: ;
				res_402608 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_402381;
			NI HEX3Atmp_402635;
			NI LOC28;
			NI res_402638;
			i_402381 = 0;
			HEX3Atmp_402635 = 0;
			LOC28 = 0;
			LOC28 = len_192097(params);
			HEX3Atmp_402635 = (LOC28 - 1);
			res_402638 = ((NI) 1);
			{
				while (1) {
					Tnode191813* rs;
					Tsym191843* param;
					NU8 LOC31;
					if (!(res_402638 <= HEX3Atmp_402635)) goto LA30;
					i_402381 = res_402638;
					rs = (*result).kindU.S6.sons->data[i_402381];
					param = (*(*params).kindU.S6.sons->data[i_402381]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_269080(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode191813* arg_402388;
							arg_402388 = 0;
							{
								NI i_402617;
								NI HEX3Atmp_402619;
								NI LOC36;
								NI res_402621;
								i_402617 = 0;
								HEX3Atmp_402619 = 0;
								LOC36 = 0;
								LOC36 = len_192097(args);
								HEX3Atmp_402619 = (LOC36 - 1);
								res_402621 = ((NI) 0);
								{
									while (1) {
										if (!(res_402621 <= HEX3Atmp_402619)) goto LA38;
										i_402617 = res_402621;
										arg_402388 = (*args).kindU.S6.sons->data[i_402617];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_402388 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_400375(rs, arg_402388);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_402621 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode191813* arg_402410;
							arg_402410 = 0;
							{
								NI i_402628;
								NI HEX3Atmp_402630;
								NI LOC53;
								NI res_402632;
								i_402628 = 0;
								HEX3Atmp_402630 = 0;
								LOC53 = 0;
								LOC53 = len_192097(args);
								HEX3Atmp_402630 = (LOC53 - 1);
								res_402632 = ((NI) 0);
								{
									while (1) {
										if (!(res_402632 <= HEX3Atmp_402630)) goto LA55;
										i_402628 = res_402632;
										arg_402410 = (*args).kindU.S6.sons->data[i_402628];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_402410 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_400375(rs, arg_402410);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_402632 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_402638 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_345251((*n).info, s);
	{
		if (!ctx.submatch) goto LA69;
		asgnRefNoCycle((void**) (&(*m).kindU.S6.sons->data[((NI) 1)]), result);
		result = m;
	}
	LA69: ;
	}BeforeRet: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_patternsInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, nimsrc_patternsDatInit)(void) {
static TNimNode* TMP3182[2];
static TNimNode TMP948[3];
NTI401596.size = sizeof(TY401596);
NTI401596.kind = 18;
NTI401596.base = 0;
NTI401596.flags = 2;
TMP3182[0] = &TMP948[1];
TMP948[1].kind = 1;
TMP948[1].offset = offsetof(TY401596, HEX3Astate);
TMP948[1].typ = (&NTI311033);
TMP948[1].name = ":state";
TMP3182[1] = &TMP948[2];
TMP948[2].kind = 1;
TMP948[2].offset = offsetof(TY401596, p401485);
TMP948[2].typ = (&NTI191805);
TMP948[2].name = "p401485";
TMP948[0].len = 2; TMP948[0].kind = 2; TMP948[0].sons = &TMP3182[0];
NTI401596.node = &TMP948[0];
NTI401624.size = sizeof(TY401596*);
NTI401624.kind = 22;
NTI401624.base = (&NTI401596);
NTI401624.flags = 2;
NTI401624.marker = TMP3183;
}

