/* 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 Tnode215790 Tnode215790;
typedef struct Tcontext265020 Tcontext265020;
typedef struct Tsym215822 Tsym215822;
typedef struct Tpatterncontext417004 Tpatterncontext417004;
typedef struct Tnodeseq215784 Tnodeseq215784;
typedef struct Ttype215828 Ttype215828;
typedef struct Tidobj190006 Tidobj190006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq215824 Ttypeseq215824;
typedef struct Tscope215816 Tscope215816;
typedef struct TY215925 TY215925;
typedef struct Tstrtable215794 Tstrtable215794;
typedef struct Tsymseq215792 Tsymseq215792;
typedef struct Tident190012 Tident190012;
typedef struct Tlineinfo183337 Tlineinfo183337;
typedef struct Tloc215804 Tloc215804;
typedef struct Ropeobj170006 Ropeobj170006;
typedef struct Tlib215808 Tlib215808;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell47504 Cell47504;
typedef struct Cellseq47520 Cellseq47520;
typedef struct Gcheap49818 Gcheap49818;
typedef struct Gcstack49816 Gcstack49816;
typedef struct Cellset47516 Cellset47516;
typedef struct Pagedesc47512 Pagedesc47512;
typedef struct Memregion29687 Memregion29687;
typedef struct Smallchunk29639 Smallchunk29639;
typedef struct Llchunk29681 Llchunk29681;
typedef struct Bigchunk29641 Bigchunk29641;
typedef struct Intset29614 Intset29614;
typedef struct Trunk29610 Trunk29610;
typedef struct Avlnode29685 Avlnode29685;
typedef struct Gcstat49814 Gcstat49814;
typedef struct TY417484 TY417484;
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 Basechunk29637 Basechunk29637;
typedef struct Freecell29629 Freecell29629;
typedef struct Tidpair215836 Tidpair215836;
typedef struct TY264242 TY264242;
typedef struct TY184093 TY184093;
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  Tpatterncontext417004  {
Tsym215822* owner;
Tnodeseq215784* mapping;
NI formals;
Tcontext265020* c;
NIM_BOOL submatch;
};
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  Tstrtable215794  {
NI counter;
Tsymseq215792* data;
};
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  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
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  Tident190012  {
  Tidobj190006 Sup;
NimStringDesc* s;
Tident190012* next;
NI h;
};
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  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Cell47504  {
NI refcount;
TNimType* typ;
};
struct  Cellseq47520  {
NI len;
NI cap;
Cell47504** d;
};
struct  Cellset47516  {
NI counter;
NI max;
Pagedesc47512* head;
Pagedesc47512** data;
};
typedef Smallchunk29639* TY29702[512];
typedef Trunk29610* Trunkbuckets29612[256];
struct  Intset29614  {
Trunkbuckets29612 data;
};
struct  Memregion29687  {
NI minlargeobj;
NI maxlargeobj;
TY29702 freesmallchunks;
Llchunk29681* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29641* freechunkslist;
Intset29614 chunkstarts;
Avlnode29685* root;
Avlnode29685* deleted;
Avlnode29685* last;
Avlnode29685* freeavlnodes;
};
struct  Gcstat49814  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49818  {
Gcstack49816* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47520 zct;
Cellseq47520 decstack;
Cellset47516 cycleroots;
Cellseq47520 tempstack;
NI recgclock;
Memregion29687 region;
Gcstat49814 stat;
};
struct  TY417484  {
NI HEX3Astate;
Tnode215790* p417374;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY417379;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3358) (Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3359) (Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3360) (Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn);
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  Tscope215816  {
NI depthlevel;
Tstrtable215794 symbols;
Tnodeseq215784* usingsyms;
Tscope215816* parent;
};
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  Gcstack49816  {
Gcstack49816* prev;
Gcstack49816* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY29618[16];
struct  Pagedesc47512  {
Pagedesc47512* next;
NI key;
TY29618 bits;
};
struct  Basechunk29637  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29639  {
  Basechunk29637 Sup;
Smallchunk29639* next;
Smallchunk29639* prev;
Freecell29629* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk29681  {
NI size;
NI acc;
Llchunk29681* next;
};
struct  Bigchunk29641  {
  Basechunk29637 Sup;
Bigchunk29641* next;
Bigchunk29641* prev;
NI align;
NF data;
};
struct  Trunk29610  {
Trunk29610* next;
NI key;
TY29618 bits;
};
typedef Avlnode29685* TY29692[2];
struct  Avlnode29685  {
TY29692 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon265008  {
Tsym215822* owner;
Tsym215822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon265008* next;
NIM_BOOL wasforwarded;
Tnode215790* bracketexpr;
};
struct  Trunk212031  {
Trunk212031* next;
NI key;
TY29618 bits;
};
struct  Tidpair215836  {
Tidobj190006* key;
TNimObject* val;
};
struct  Tctx264036  {
  Tpasscontext262002 Sup;
TY264242* code;
TY184093* 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  Freecell29629  {
Freecell29629* next;
NI zerofield;
};
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 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 Tsymseq215792 {
  TGenericSeq Sup;
  Tsym215822* 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 TY184093 {
  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(NI, sonslen_218327)(Ttype215828* n);
N_NIMCALL(Tnode215790*, matchstmtlist_417981)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n_417985);
static N_INLINE(NI, len_216059)(Tnode215790* n);
N_NIMCALL(Tnode215790*, flattenstmts_240587)(Tnode215790* n);
N_NIMCALL(NIM_BOOL, matchrange_417987)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n, NI i);
N_NIMCALL(NIM_BOOL, matches_417051)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n_417055);
static N_INLINE(NIM_BOOL, ispatternparam_417243)(Tpatterncontext417004* c, Tnode215790* p);
N_NIMCALL(NIM_BOOL, bindorcheck_417314)(Tpatterncontext417004* c, Tsym215822* param, Tnode215790* n);
N_NIMCALL(Tnode215790*, getlazy_417013)(Tpatterncontext417004* c, Tsym215822* sym);
N_NIMCALL(NIM_BOOL, sametrees_417085)(Tnode215790* a, Tnode215790* b);
static N_INLINE(NIM_BOOL, samekinds_417060)(Tnode215790* a, Tnode215790* b);
N_NIMCALL(NU8, canonkind_417056)(Tnode215790* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_245638)(Ttype215828* a, Ttype215828* b, NU8 flags);
N_NIMCALL(NI, sonslen_218351)(Tnode215790* n);
N_NIMCALL(NIM_BOOL, checktypes_417202)(Tpatterncontext417004* c, Tsym215822* p, Tnode215790* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_288042)(Tnode215790* p, Tnode215790* n);
N_NIMCALL(NIM_BOOL, argtypematches_369396)(Tcontext265020* c, Ttype215828* f, Ttype215828* a);
N_NIMCALL(void, putlazy_417027)(Tpatterncontext417004* c, Tsym215822* sym, Tnode215790* 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(Cell47504*, usrtocell_51440)(void* usr);
static N_INLINE(void, rtladdzct_53001)(Cell47504* c);
N_NOINLINE(void, addzct_51417)(Cellseq47520* s, Cell47504* c);
N_NIMCALL(NIM_BOOL, insymchoice_417133)(Tnode215790* sc, Tnode215790* x);
N_NIMCALL(NIM_BOOL, matchchoice_417280)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n);
N_NIMCALL(NIM_BOOL, matchnested_417371)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3357)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode215790*, newnodei_217248)(NU8 kind, Tlineinfo183337 info);
N_CLOSURE(NIM_BOOL, matchstaraux_417378)(Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode215790*, HEX5BHEX5D_216238)(Tnode215790* n, NI i);
N_NIMCALL(void, add_216114)(Tnode215790* father, Tnode215790* son);
N_NIMCALL(void, internalerror_188100)(Tlineinfo183337 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_417342)(Tpatterncontext417004* c, Tsym215822* param, Tnode215790* n);
N_NIMCALL(Tnode215790*, newnodei_217401)(NU8 kind, Tlineinfo183337 info, NI children);
N_NIMCALL(Tnode215790*, lastson_218364)(Tnode215790* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_84004, TNimType* mt);
N_NIMCALL(Tnode215790*, extractrange_240593)(NU8 k, Tnode215790* n, NI a, NI b);
N_NIMCALL(Tnode215790*, newsymnode_217241)(Tsym215822* sym, Tlineinfo183337 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_418078)(Tnode215790* params);
N_NIMCALL(NU8, whichalias_287047)(Tsym215822* p);
N_NIMCALL(void, addtoarglist_418122)(Tnode215790* result, Tnode215790* n);
N_NIMCALL(NU8, ispartof_416328)(Tnode215790* a, Tnode215790* b);
N_NIMCALL(void, markused_363244)(Tlineinfo183337 info, Tsym215822* s);
STRING_LITERAL(TMP3352, "|", 1);
STRING_LITERAL(TMP3353, "*", 1);
STRING_LITERAL(TMP3354, "**", 2);
STRING_LITERAL(TMP3355, "~", 1);
STRING_LITERAL(TMP3361, "invalid pattern", 15);
extern TNimType NTI215784; /* TNodeSeq */
extern Gcheap49818 gch_49859;
TNimType NTI417484; /* object */
extern TNimType NTI326021; /* range -1..0(int) */
extern TNimType NTI215782; /* PNode */
TNimType NTI417483; /* ref object */

static N_INLINE(NI, len_216059)(Tnode215790* 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_417243)(Tpatterncontext417004* c, Tnode215790* 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(Tnode215790*, getlazy_417013)(Tpatterncontext417004* c, Tsym215822* sym) {
	Tnode215790* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_417056)(Tnode215790* 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_417060)(Tnode215790* a, Tnode215790* 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_417056(a);
	LOC4 = 0;
	LOC4 = canonkind_417056(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_417085)(Tnode215790* a, Tnode215790* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_417060(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_245638((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_218351(a);
				LOC17 = 0;
				LOC17 = sonslen_218351(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_417122;
					NI HEX3Atmp_417126;
					NI LOC21;
					NI res_417129;
					i_417122 = 0;
					HEX3Atmp_417126 = 0;
					LOC21 = 0;
					LOC21 = sonslen_218351(a);
					HEX3Atmp_417126 = (NI)(LOC21 - ((NI) 1));
					res_417129 = ((NI) 0);
					{
						while (1) {
							if (!(res_417129 <= HEX3Atmp_417126)) goto LA23;
							i_417122 = res_417129;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_417085((*a).kindU.S6.sons->data[i_417122], (*b).kindU.S6.sons->data[i_417122]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_417129 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_417202)(Tpatterncontext417004* c, Tsym215822* p, Tnode215790* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_288042((*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_369396((*c).c, (*p).typ, (*n).typ);
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(void, rtladdzct_53001)(Cell47504* c) {
	addzct_51417((&gch_49859.zct), c);
}

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

N_NIMCALL(void, putlazy_417027)(Tpatterncontext417004* c, Tsym215822* sym, Tnode215790* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq215784*) newSeq((&NTI215784), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_417314)(Tpatterncontext417004* c, Tsym215822* param, Tnode215790* n) {
	NIM_BOOL result;
	Tnode215790* pp;
	result = 0;
	pp = getlazy_417013(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_417085(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_417202(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_417027(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_417133)(Tnode215790* sc, Tnode215790* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_417165;
			NI HEX3Atmp_417195;
			NI LOC6;
			NI res_417198;
			i_417165 = 0;
			HEX3Atmp_417195 = 0;
			LOC6 = 0;
			LOC6 = len_216059(sc);
			HEX3Atmp_417195 = (LOC6 - 1);
			res_417198 = ((NI) 0);
			{
				while (1) {
					if (!(res_417198 <= HEX3Atmp_417195)) goto LA8;
					i_417165 = res_417198;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_417165]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_417198 += ((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_417280)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_417304;
		NI HEX3Atmp_417307;
		NI LOC2;
		NI res_417310;
		i_417304 = 0;
		HEX3Atmp_417307 = 0;
		LOC2 = 0;
		LOC2 = len_216059(p);
		HEX3Atmp_417307 = (LOC2 - 1);
		res_417310 = ((NI) 1);
		{
			while (1) {
				if (!(res_417310 <= HEX3Atmp_417307)) goto LA4;
				i_417304 = res_417310;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_417051(c, (*p).kindU.S6.sons->data[i_417304], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_417310 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3357)(void* p, NI op) {
	TY417484* a;
	a = (TY417484*)p;
	nimGCvisit((void*)(*a).p417374, op);
}

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

N_CLOSURE(NIM_BOOL, matchstaraux_417378)(Tpatterncontext417004* c, Tnode215790* op, Tnode215790* n_417382, Tnode215790* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY417484* HEX3Aenvp_417487;
{	result = 0;
	HEX3Aenvp_417487 = (TY417484*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_417382).kind == ((NU8) 27) || (*n_417382).kind == ((NU8) 29) || (*n_417382).kind == ((NU8) 30) || (*n_417382).kind == ((NU8) 31) || (*n_417382).kind == ((NU8) 26) || (*n_417382).kind == ((NU8) 28) || (*n_417382).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_417051(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_417382).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_417407;
			NI HEX3Atmp_417453;
			NI LOC8;
			NI res_417456;
			i_417407 = 0;
			HEX3Atmp_417453 = 0;
			LOC8 = 0;
			LOC8 = sonslen_218351(n_417382);
			HEX3Atmp_417453 = (NI)(LOC8 - ((NI) 1));
			res_417456 = ((NI) 1);
			{
				while (1) {
					if (!(res_417456 <= HEX3Atmp_417453)) goto LA10;
					i_417407 = res_417456;
					{
						TY417379 LOC13;
						Tnode215790* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_417378; LOC13.ClEnv = HEX3Aenvp_417487;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_216238(n_417382, i_417407);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3358)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_417456 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_216114(arglist, (*n_417382).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode215790* n;
		LOC23 = 0;
		LOC23 = ((*n_417382).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_417382).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_417382).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_417449;
			NI HEX3Atmp_417461;
			NI LOC28;
			NI res_417464;
			i_417449 = 0;
			HEX3Atmp_417461 = 0;
			LOC28 = 0;
			LOC28 = len_216059(n);
			HEX3Atmp_417461 = (LOC28 - 1);
			res_417464 = ((NI) 0);
			{
				while (1) {
					if (!(res_417464 <= HEX3Atmp_417461)) goto LA30;
					i_417449 = res_417464;
					{
						TY417379 LOC33;
						Tnode215790* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_417378; LOC33.ClEnv = HEX3Aenvp_417487;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_216238(n, i_417449);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3359)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_417464 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_417202(c, (*(*(*HEX3Aenvp_417487).p417374).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_417382);
		if (!LOC39) goto LA40;
		add_216114(arglist, n_417382);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_417371)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY417484* HEX3Aenv_417489;
{	result = 0;
	HEX3Aenv_417489 = 0;
	HEX3Aenv_417489 = (TY417484*) newObj((&NTI417483), sizeof(TY417484));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_417489).p417374), 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;
		Tnode215790* arglist;
		LOC7 = 0;
		LOC7 = matches_417051(c, (*(*HEX3Aenv_417489).p417374).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_217248(((NU8) 152), (*n).info);
		{
			TY417379 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_417378; LOC12.ClEnv = HEX3Aenv_417489;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_417489).p417374, n, arglist, rpn, LOC12.ClEnv):((TMP3360)(LOC12.ClPrc))(c, (*HEX3Aenv_417489).p417374, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_417314(c, (*(*(*HEX3Aenv_417489).p417374).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_417342)(Tpatterncontext417004* c, Tsym215822* param, Tnode215790* n) {
	Tnode215790* pp;
	pp = getlazy_417013(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_216114(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_217401(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_417027(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_417051)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n_417055) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!(((*n_417055).flags &(1U<<((NU)(((NU8) 6))&15U)))!=0)) goto LA3;
		result = NIM_FALSE;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ispatternparam_417243(c, p);
		if (!LOC6) goto LA7;
		result = bindorcheck_417314(c, (*p).kindU.S4.sym, n_417055);
	}
	goto LA1;
	LA7: ;
	{
		NIM_BOOL LOC10;
		LOC10 = 0;
		LOC10 = ((*n_417055).kind == ((NU8) 3));
		if (!(LOC10)) goto LA11;
		LOC10 = ((*p).kind == ((NU8) 2));
		LA11: ;
		if (!LOC10) goto LA12;
		result = ((*(*p).kindU.S5.ident).Sup.id == (*(*(*n_417055).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA12: ;
	{
		NIM_BOOL LOC15;
		LOC15 = 0;
		LOC15 = ((*n_417055).kind == ((NU8) 3));
		if (!(LOC15)) goto LA16;
		LOC15 = insymchoice_417133(p, n_417055);
		LA16: ;
		if (!LOC15) goto LA17;
		result = NIM_TRUE;
	}
	goto LA1;
	LA17: ;
	{
		NIM_BOOL LOC20;
		LOC20 = 0;
		LOC20 = ((*n_417055).kind == ((NU8) 3));
		if (!(LOC20)) goto LA21;
		LOC20 = ((*(*n_417055).kindU.S4.sym).kind == ((NU8) 10));
		LA21: ;
		if (!LOC20) goto LA22;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA26;
			result = ((*p).kindU.S4.sym == (*n_417055).kindU.S4.sym);
		}
		goto LA24;
		LA26: ;
		{
			NIM_BOOL LOC29;
			LOC29 = 0;
			LOC29 = matches_417051(c, p, (*(*n_417055).kindU.S4.sym).ast);
			if (!LOC29) goto LA30;
			result = NIM_TRUE;
		}
		goto LA24;
		LA30: ;
		LA24: ;
	}
	goto LA1;
	LA22: ;
	{
		NimStringDesc* opr;
		if (!((*p).kind == ((NU8) 153))) goto LA33;
		opr = (*(*(*p).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident).s;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3352))) goto LA35;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3353))) goto LA36;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3354))) goto LA37;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3355))) goto LA38;
		goto LA39;
		LA35: ;
		{
			result = matchchoice_417280(c, p, n_417055);
		}
		goto LA40;
		LA36: ;
		{
			result = matchnested_417371(c, p, n_417055, NIM_FALSE);
		}
		goto LA40;
		LA37: ;
		{
			result = matchnested_417371(c, p, n_417055, NIM_TRUE);
		}
		goto LA40;
		LA38: ;
		{
			NIM_BOOL LOC45;
			LOC45 = 0;
			LOC45 = matches_417051(c, (*p).kindU.S6.sons->data[((NI) 1)], n_417055);
			result = !(LOC45);
		}
		goto LA40;
		LA39: ;
		{
			internalerror_188100((*p).info, ((NimStringDesc*) &TMP3361));
		}
		LA40: ;
	}
	goto LA1;
	LA33: ;
	{
		if (!((*p).kind == ((NU8) 40))) goto LA48;
		{
			if (!((*(*p).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 30))) goto LA52;
			{
				NIM_BOOL LOC56;
				LOC56 = 0;
				LOC56 = matches_417051(c, (*p).kindU.S6.sons->data[((NI) 0)], n_417055);
				if (!LOC56) goto LA57;
				gather_417342(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_417055);
				result = NIM_TRUE;
			}
			LA57: ;
		}
		goto LA50;
		LA52: ;
		{
			{
				NIM_BOOL LOC62;
				LOC62 = 0;
				LOC62 = matches_417051(c, (*p).kindU.S6.sons->data[((NI) 0)], n_417055);
				if (!LOC62) goto LA63;
				result = bindorcheck_417314(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_417055);
			}
			LA63: ;
		}
		LA50: ;
	}
	goto LA1;
	LA48: ;
	{
		NIM_BOOL LOC66;
		LOC66 = 0;
		LOC66 = samekinds_417060(p, n_417055);
		if (!LOC66) goto LA67;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_417055).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_417055).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_417055).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_417055).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_417055).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode215790* v;
			plen = sonslen_218351(p);
			v = lastson_218364(p);
			{
				NIM_BOOL LOC78;
				Tnode215790* arglist;
				LOC78 = 0;
				LOC78 = ispatternparam_417243(c, v);
				if (!(LOC78)) goto LA79;
				LOC78 = ((*(*(*v).kindU.S4.sym).typ).kind == ((NU8) 48));
				LA79: ;
				if (!LOC78) goto LA80;
				arglist = 0;
				{
					NI LOC84;
					LOC84 = 0;
					LOC84 = sonslen_218351(n_417055);
					if (!(plen <= LOC84)) goto LA85;
					{
						NI i_417850;
						NI HEX3Atmp_417942;
						NI res_417945;
						i_417850 = 0;
						HEX3Atmp_417942 = 0;
						HEX3Atmp_417942 = (NI)(plen - ((NI) 2));
						res_417945 = ((NI) 0);
						{
							while (1) {
								if (!(res_417945 <= HEX3Atmp_417942)) goto LA89;
								i_417850 = res_417945;
								{
									NIM_BOOL LOC92;
									LOC92 = 0;
									LOC92 = matches_417051(c, (*p).kindU.S6.sons->data[i_417850], (*n_417055).kindU.S6.sons->data[i_417850]);
									if (!!(LOC92)) goto LA93;
									goto BeforeRet;
								}
								LA93: ;
								res_417945 += ((NI) 1);
							} LA89: ;
						}
					}
					{
						NIM_BOOL LOC97;
						NIM_BOOL LOC98;
						NI LOC99;
						Tnode215790* LOC101;
						Tnode215790* LOC103;
						Tnode215790* n;
						Tnode215790* LOC106;
						NI LOC107;
						LOC97 = 0;
						LOC98 = 0;
						LOC99 = 0;
						LOC99 = sonslen_218351(n_417055);
						LOC98 = (plen == LOC99);
						if (!(LOC98)) goto LA100;
						LOC101 = 0;
						LOC101 = lastson_218364(n_417055);
						LOC98 = ((*LOC101).kind == ((NU8) 58));
						LA100: ;
						LOC97 = LOC98;
						if (!(LOC97)) goto LA102;
						LOC103 = 0;
						LOC103 = lastson_218364(n_417055);
						LOC97 = ((*(*LOC103).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA102: ;
						if (!LOC97) goto LA104;
						LOC106 = 0;
						LOC106 = lastson_218364(n_417055);
						n = (*LOC106).kindU.S6.sons->data[((NI) 1)];
						LOC107 = 0;
						LOC107 = len_216059(n);
						arglist = newnodei_217401(((NU8) 152), (*n).info, LOC107);
						{
							NI i_417893;
							NI HEX3Atmp_417950;
							NI LOC109;
							NI res_417953;
							i_417893 = 0;
							HEX3Atmp_417950 = 0;
							LOC109 = 0;
							LOC109 = len_216059(n);
							HEX3Atmp_417950 = (LOC109 - 1);
							res_417953 = ((NI) 0);
							{
								while (1) {
									if (!(res_417953 <= HEX3Atmp_417950)) goto LA111;
									i_417893 = res_417953;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_417893]), (*n).kindU.S6.sons->data[i_417893]);
									res_417953 += ((NI) 1);
								} LA111: ;
							}
						}
					}
					goto LA95;
					LA104: ;
					{
						NI LOC113;
						LOC113 = 0;
						LOC113 = sonslen_218351(n_417055);
						arglist = newnodei_217401(((NU8) 152), (*n_417055).info, (NI)((NI)(LOC113 - plen) + ((NI) 1)));
						{
							NI i_417907;
							NI HEX3Atmp_417958;
							NI LOC115;
							NI res_417961;
							i_417907 = 0;
							HEX3Atmp_417958 = 0;
							LOC115 = 0;
							LOC115 = sonslen_218351(n_417055);
							HEX3Atmp_417958 = (NI)(LOC115 - plen);
							res_417961 = ((NI) 0);
							{
								while (1) {
									if (!(res_417961 <= HEX3Atmp_417958)) goto LA117;
									i_417907 = res_417961;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_417907]), (*n_417055).kindU.S6.sons->data[(NI)((NI)(i_417907 + plen) - ((NI) 1))]);
									res_417961 += ((NI) 1);
								} LA117: ;
							}
						}
					}
					LA95: ;
					result = bindorcheck_417314(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA85: ;
				{
					NI LOC119;
					LOC119 = 0;
					LOC119 = sonslen_218351(n_417055);
					if (!((NI)(plen - ((NI) 1)) == LOC119)) goto LA120;
					{
						NI i_417922;
						NI HEX3Atmp_417966;
						NI res_417969;
						i_417922 = 0;
						HEX3Atmp_417966 = 0;
						HEX3Atmp_417966 = (NI)(plen - ((NI) 2));
						res_417969 = ((NI) 0);
						{
							while (1) {
								if (!(res_417969 <= HEX3Atmp_417966)) goto LA124;
								i_417922 = res_417969;
								{
									NIM_BOOL LOC127;
									LOC127 = 0;
									LOC127 = matches_417051(c, (*p).kindU.S6.sons->data[i_417922], (*n_417055).kindU.S6.sons->data[i_417922]);
									if (!!(LOC127)) goto LA128;
									goto BeforeRet;
								}
								LA128: ;
								res_417969 += ((NI) 1);
							} LA124: ;
						}
					}
					arglist = newnodei_217248(((NU8) 152), (*n_417055).info);
					result = bindorcheck_417314(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA120: ;
				LA82: ;
			}
			LA80: ;
			{
				NI LOC132;
				LOC132 = 0;
				LOC132 = sonslen_218351(n_417055);
				if (!(plen == LOC132)) goto LA133;
				{
					NI i_417937;
					NI HEX3Atmp_417974;
					NI LOC136;
					NI res_417977;
					i_417937 = 0;
					HEX3Atmp_417974 = 0;
					LOC136 = 0;
					LOC136 = sonslen_218351(p);
					HEX3Atmp_417974 = (NI)(LOC136 - ((NI) 1));
					res_417977 = ((NI) 0);
					{
						while (1) {
							if (!(res_417977 <= HEX3Atmp_417974)) goto LA138;
							i_417937 = res_417977;
							{
								NIM_BOOL LOC141;
								LOC141 = 0;
								LOC141 = matches_417051(c, (*p).kindU.S6.sons->data[i_417937], (*n_417055).kindU.S6.sons->data[i_417937]);
								if (!!(LOC141)) goto LA142;
								goto BeforeRet;
							}
							LA142: ;
							res_417977 += ((NI) 1);
						} LA138: ;
					}
				}
				result = NIM_TRUE;
			}
			LA133: ;
		}
		break;
		}
	}
	goto LA1;
	LA67: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_417987)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_418012;
		NI HEX3Atmp_418024;
		NI LOC2;
		NI res_418027;
		j_418012 = 0;
		HEX3Atmp_418024 = 0;
		LOC2 = 0;
		LOC2 = len_216059(p);
		HEX3Atmp_418024 = (LOC2 - 1);
		res_418027 = ((NI) 0);
		{
			while (1) {
				if (!(res_418027 <= HEX3Atmp_418024)) goto LA4;
				j_418012 = res_418027;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_417051(c, (*p).kindU.S6.sons->data[j_418012], (*n).kindU.S6.sons->data[(NI)(i + j_418012)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI215784));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_418027 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode215790*, matchstmtlist_417981)(Tpatterncontext417004* c, Tnode215790* p, Tnode215790* n_417985) {
	Tnode215790* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode215790* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_417985).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_216059(p);
		LOC8 = 0;
		LOC8 = len_216059(n_417985);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_240587(n_417985);
		{
			NI i_418063;
			NI HEX3Atmp_418071;
			NI LOC12;
			NI LOC13;
			NI res_418074;
			i_418063 = 0;
			HEX3Atmp_418071 = 0;
			LOC12 = 0;
			LOC12 = len_216059(n);
			LOC13 = 0;
			LOC13 = len_216059(p);
			HEX3Atmp_418071 = (NI)(LOC12 - LOC13);
			res_418074 = ((NI) 0);
			{
				while (1) {
					if (!(res_418074 <= HEX3Atmp_418071)) goto LA15;
					i_418063 = res_418074;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_417987(c, p, n, i_418063);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_217401(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_240593(((NU8) 115), n, ((NI) 0), (NI)(i_418063 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_216059(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_240593(((NU8) 115), n, i_418063, (NI)((NI)(i_418063 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_216059(p);
						LOC23 = 0;
						LOC23 = len_216059(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_240593(((NU8) 115), n, (NI)(i_418063 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_418074 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_417051(c, p, n_417985);
		if (!LOC25) goto LA26;
		result = n_417985;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_418078)(Tnode215790* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_216059(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_418101;
			NI HEX3Atmp_418115;
			NI LOC7;
			NI res_418118;
			i_418101 = 0;
			HEX3Atmp_418115 = 0;
			LOC7 = 0;
			LOC7 = len_216059(params);
			HEX3Atmp_418115 = (LOC7 - 1);
			res_418118 = ((NI) 1);
			{
				while (1) {
					Tsym215822* param;
					if (!(res_418118 <= HEX3Atmp_418115)) goto LA9;
					i_418101 = res_418118;
					param = (*(*params).kindU.S6.sons->data[i_418101]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_287047(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_418118 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_418122)(Tnode215790* result, Tnode215790* 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_216114(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_418175;
				NI HEX3Atmp_418179;
				NI LOC13;
				NI res_418182;
				i_418175 = 0;
				HEX3Atmp_418179 = 0;
				LOC13 = 0;
				LOC13 = len_216059(n);
				HEX3Atmp_418179 = (LOC13 - 1);
				res_418182 = ((NI) 0);
				{
					while (1) {
						if (!(res_418182 <= HEX3Atmp_418179)) goto LA15;
						i_418175 = res_418182;
						add_216114(result, (*n).kindU.S6.sons->data[i_418175]);
						res_418182 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode215790*, applyrule_418186)(Tcontext265020* c, Tsym215822* s, Tnode215790* n) {
	Tnode215790* result;
	Tpatterncontext417004 ctx;
	NI LOC1;
	Tnode215790* m;
	Tnode215790* LOC6;
	Tnode215790* params;
	NIM_BOOL requiresaa;
	Tnode215790* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_218327((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_417981((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_217248(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_217241(s, (*n).info);
	add_216114(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_418078(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_217248(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_418229;
		NI HEX3Atmp_418405;
		NI LOC12;
		NI res_418408;
		i_418229 = 0;
		HEX3Atmp_418405 = 0;
		LOC12 = 0;
		LOC12 = len_216059(params);
		HEX3Atmp_418405 = (LOC12 - 1);
		res_418408 = ((NI) 1);
		{
			while (1) {
				Tsym215822* param;
				Tnode215790* x;
				if (!(res_418408 <= HEX3Atmp_418405)) goto LA14;
				i_418229 = res_418408;
				param = (*(*params).kindU.S6.sons->data[i_418229]).kindU.S4.sym;
				x = getlazy_417013((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_216114(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_418122(args, x);
				}
				LA21: ;
				res_418408 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_418262;
			NI HEX3Atmp_418435;
			NI LOC28;
			NI res_418438;
			i_418262 = 0;
			HEX3Atmp_418435 = 0;
			LOC28 = 0;
			LOC28 = len_216059(params);
			HEX3Atmp_418435 = (LOC28 - 1);
			res_418438 = ((NI) 1);
			{
				while (1) {
					Tnode215790* rs;
					Tsym215822* param;
					NU8 LOC31;
					if (!(res_418438 <= HEX3Atmp_418435)) goto LA30;
					i_418262 = res_418438;
					rs = (*result).kindU.S6.sons->data[i_418262];
					param = (*(*params).kindU.S6.sons->data[i_418262]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_287047(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode215790* arg_418269;
							arg_418269 = 0;
							{
								NI i_418417;
								NI HEX3Atmp_418419;
								NI LOC36;
								NI res_418421;
								i_418417 = 0;
								HEX3Atmp_418419 = 0;
								LOC36 = 0;
								LOC36 = len_216059(args);
								HEX3Atmp_418419 = (LOC36 - 1);
								res_418421 = ((NI) 0);
								{
									while (1) {
										if (!(res_418421 <= HEX3Atmp_418419)) goto LA38;
										i_418417 = res_418421;
										arg_418269 = (*args).kindU.S6.sons->data[i_418417];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_418269 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_416328(rs, arg_418269);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_418421 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode215790* arg_418291;
							arg_418291 = 0;
							{
								NI i_418428;
								NI HEX3Atmp_418430;
								NI LOC53;
								NI res_418432;
								i_418428 = 0;
								HEX3Atmp_418430 = 0;
								LOC53 = 0;
								LOC53 = len_216059(args);
								HEX3Atmp_418430 = (LOC53 - 1);
								res_418432 = ((NI) 0);
								{
									while (1) {
										if (!(res_418432 <= HEX3Atmp_418430)) goto LA55;
										i_418428 = res_418432;
										arg_418291 = (*args).kindU.S6.sons->data[i_418428];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_418291 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_416328(rs, arg_418291);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_418432 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_418438 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_363244((*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, compiler_patternsInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_patternsDatInit000)(void) {
static TNimNode* TMP3356[2];
static TNimNode TMP1031[3];
NTI417484.size = sizeof(TY417484);
NTI417484.kind = 18;
NTI417484.base = 0;
NTI417484.flags = 2;
TMP3356[0] = &TMP1031[1];
TMP1031[1].kind = 1;
TMP1031[1].offset = offsetof(TY417484, HEX3Astate);
TMP1031[1].typ = (&NTI326021);
TMP1031[1].name = ":state";
TMP3356[1] = &TMP1031[2];
TMP1031[2].kind = 1;
TMP1031[2].offset = offsetof(TY417484, p417374);
TMP1031[2].typ = (&NTI215782);
TMP1031[2].name = "p417374";
TMP1031[0].len = 2; TMP1031[0].kind = 2; TMP1031[0].sons = &TMP3356[0];
NTI417484.node = &TMP1031[0];
NTI417483.size = sizeof(TY417484*);
NTI417483.kind = 22;
NTI417483.base = (&NTI417484);
NTI417483.flags = 2;
NTI417483.marker = TMP3357;
}

