/* 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 Tnode214790 Tnode214790;
typedef struct Tcontext264020 Tcontext264020;
typedef struct Tsym214822 Tsym214822;
typedef struct Tpatterncontext416004 Tpatterncontext416004;
typedef struct Tnodeseq214784 Tnodeseq214784;
typedef struct Ttype214828 Ttype214828;
typedef struct Tidobj189006 Tidobj189006;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq214824 Ttypeseq214824;
typedef struct Tscope214816 Tscope214816;
typedef struct TY214925 TY214925;
typedef struct Tstrtable214794 Tstrtable214794;
typedef struct Tsymseq214792 Tsymseq214792;
typedef struct Tident189012 Tident189012;
typedef struct Tlineinfo182337 Tlineinfo182337;
typedef struct Tloc214804 Tloc214804;
typedef struct Ropeobj169006 Ropeobj169006;
typedef struct Tlib214808 Tlib214808;
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 TY416484 TY416484;
typedef struct Tpasscontext261002 Tpasscontext261002;
typedef struct Tproccon264008 Tproccon264008;
typedef struct Intset211035 Intset211035;
typedef struct Trunk211031 Trunk211031;
typedef struct Trunkseq211033 Trunkseq211033;
typedef struct Tlinkedlist135016 Tlinkedlist135016;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct Tidtable214840 Tidtable214840;
typedef struct Tidpairseq214838 Tidpairseq214838;
typedef struct Tctx263036 Tctx263036;
typedef struct TY264140 TY264140;
typedef struct Tinstantiation214812 Tinstantiation214812;
typedef struct Basechunk29637 Basechunk29637;
typedef struct Freecell29629 Freecell29629;
typedef struct Tidpair214836 Tidpair214836;
typedef struct TY263242 TY263242;
typedef struct TY183093 TY183093;
typedef struct PprocHEX3Aobjecttype263221 PprocHEX3Aobjecttype263221;
typedef struct TY263261 TY263261;
typedef struct Tinstantiationpair264010 Tinstantiationpair264010;
typedef struct TY214913 TY214913;
typedef struct TY263222 TY263222;
typedef struct TY263227 TY263227;
typedef struct TY263262 TY263262;
typedef struct Vmargs263030 Vmargs263030;
typedef struct Tblock263018 Tblock263018;
typedef struct TY263202 TY263202;
struct  Tpatterncontext416004  {
Tsym214822* owner;
Tnodeseq214784* mapping;
NI formals;
Tcontext264020* 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  Tidobj189006  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable214794  {
NI counter;
Tsymseq214792* data;
};
struct  Tlineinfo182337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc214804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype214828* t;
Ropeobj169006* r;
Ropeobj169006* heaproot;
};
struct  Tsym214822  {
  Tidobj189006 Sup;
NU8 kind;
union{
struct {Ttypeseq214824* typeinstcache;
Tscope214816* typscope;
} S1;
struct {TY214925* procinstcache;
Tsym214822* gcunsafetyreason;
} S2;
struct {TY214925* usedgenerics;
Tstrtable214794 tab;
} S3;
struct {Tsym214822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype214828* typ;
Tident189012* name;
Tlineinfo182337 info;
Tsym214822* owner;
NU32 flags;
Tnode214790* ast;
NU32 options;
NI position;
NI offset;
Tloc214804 loc;
Tlib214808* annex;
Tnode214790* constraint;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode214790  {
Ttype214828* typ;
Tlineinfo182337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym214822* sym;
} S4;
struct {Tident189012* ident;
} S5;
struct {Tnodeseq214784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident189012  {
  Tidobj189006 Sup;
NimStringDesc* s;
Tident189012* next;
NI h;
};
struct  Ttype214828  {
  Tidobj189006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq214824* sons;
Tnode214790* n;
Tsym214822* owner;
Tsym214822* sym;
Tsym214822* destructor;
Tsym214822* deepcopy;
Tsym214822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc214804 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  TY416484  {
NI HEX3Astate;
Tnode214790* p416374;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY416379;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3355) (Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3356) (Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3357) (Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn);
struct  Tpasscontext261002  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset211035  {
NI counter;
NI max;
Trunk211031* head;
Trunkseq211033* data;
};
struct  Tlinkedlist135016  {
Tlistentry135010* head;
Tlistentry135010* tail;
NI counter;
};
struct  Tidtable214840  {
NI counter;
Tidpairseq214838* data;
};
typedef N_NIMCALL_PTR(Tnode214790*, TY264071) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264076) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264084) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264092) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264097) (Tcontext264020* c, Tnode214790* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode214790*, TY264105) (Tcontext264020* c, Tnode214790* n);
typedef N_NIMCALL_PTR(Tnode214790*, TY264110) (Tcontext264020* c, Tnode214790* n, Tnode214790* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype214828*, TY264117) (Tcontext264020* c, Tnode214790* n, Ttype214828* prev);
typedef struct {
N_NIMCALL_PTR(Tnode214790*, ClPrc) (Tcontext264020* c, Tidtable214840 pt, Tnode214790* n, void* ClEnv);
void* ClEnv;
} TY264123;
typedef struct {
N_NIMCALL_PTR(Tsym214822*, ClPrc) (Tcontext264020* c, Tsym214822* fn, Tidtable214840 pt, Tlineinfo182337 info, void* ClEnv);
void* ClEnv;
} TY264129;
typedef N_NIMCALL_PTR(Tsym214822*, TY264145) (Tcontext264020* c, Tsym214822* dc, Ttype214828* t, Tlineinfo182337 info, NU8 op);
struct  Tcontext264020  {
  Tpasscontext261002 Sup;
Tsym214822* module;
Tscope214816* currentscope;
Tscope214816* importtable;
Tscope214816* toplevelscope;
Tproccon264008* p;
Tsymseq214792* friendmodules;
NI instcounter;
Intset211035 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq214792* converters;
Tsymseq214792* patterns;
Tlinkedlist135016 optionstack;
Tidtable214840 symmapping;
Tlinkedlist135016 libs;
TY264071 semconstexpr;
TY264076 semexpr;
TY264084 semtryexpr;
TY264092 semtryconstexpr;
TY264097 semoperand;
TY264105 semconstboolexpr;
TY264110 semoverloadedcall;
TY264117 semtypenode;
TY264123 seminferredlambda;
TY264129 semgenerateinstance;
Intset211035 includedfiles;
Tstrtable214794 userpragmas;
Tctx263036* evalcontext;
Intset211035 unknownidents;
TY264140* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY264145 insttypeboundop;
};
struct  Tscope214816  {
NI depthlevel;
Tstrtable214794 symbols;
Tnodeseq214784* usingsyms;
Tscope214816* parent;
};
struct  Ropeobj169006  {
  TNimObject Sup;
Ropeobj169006* left;
Ropeobj169006* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib214808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj169006* name;
Tnode214790* 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  Tproccon264008  {
Tsym214822* owner;
Tsym214822* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon264008* next;
NIM_BOOL wasforwarded;
Tnode214790* bracketexpr;
};
struct  Trunk211031  {
Trunk211031* next;
NI key;
TY29618 bits;
};
struct  Tidpair214836  {
Tidobj189006* key;
TNimObject* val;
};
struct  Tctx263036  {
  Tpasscontext261002 Sup;
TY263242* code;
TY183093* debug;
Tnode214790* globals;
Tnode214790* constants;
Ttypeseq214824* types;
Tnode214790* currentexceptiona;
Tnode214790* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype263221* prc;
Tsym214822* module;
Tnode214790* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo182337 comesfromheuristic;
TY263261* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair264010  {
Tsym214822* genericsym;
Tinstantiation214812* inst;
};
struct  Tinstantiation214812  {
Tsym214822* sym;
Ttypeseq214824* concretetypes;
TY214913* usedby;
NI compilesid;
};
struct  Freecell29629  {
Freecell29629* next;
NI zerofield;
};
struct TY263227 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY263227 TY263230[256];
struct  PprocHEX3Aobjecttype263221  {
TY263222* blocks;
Tsym214822* sym;
TY263230 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs263030* args, void* ClEnv);
void* ClEnv;
} Vmcallback263032;
struct TY263262 {
NimStringDesc* Field0;
Vmcallback263032 Field1;
};
struct  Tblock263018  {
Tsym214822* label;
TY263202* fixups;
};
struct  Vmargs263030  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode214790* currentexception;
};
struct Tnodeseq214784 {
  TGenericSeq Sup;
  Tnode214790* data[SEQ_DECL_SIZE];
};
struct Ttypeseq214824 {
  TGenericSeq Sup;
  Ttype214828* data[SEQ_DECL_SIZE];
};
struct TY214925 {
  TGenericSeq Sup;
  Tinstantiation214812* data[SEQ_DECL_SIZE];
};
struct Tsymseq214792 {
  TGenericSeq Sup;
  Tsym214822* data[SEQ_DECL_SIZE];
};
struct Trunkseq211033 {
  TGenericSeq Sup;
  Trunk211031* data[SEQ_DECL_SIZE];
};
struct Tidpairseq214838 {
  TGenericSeq Sup;
  Tidpair214836 data[SEQ_DECL_SIZE];
};
struct TY264140 {
  TGenericSeq Sup;
  Tinstantiationpair264010 data[SEQ_DECL_SIZE];
};
struct TY263242 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY183093 {
  TGenericSeq Sup;
  Tlineinfo182337 data[SEQ_DECL_SIZE];
};
struct TY263261 {
  TGenericSeq Sup;
  TY263262 data[SEQ_DECL_SIZE];
};
struct TY214913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY263222 {
  TGenericSeq Sup;
  Tblock263018 data[SEQ_DECL_SIZE];
};
struct TY263202 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_217327)(Ttype214828* n);
N_NIMCALL(Tnode214790*, matchstmtlist_416981)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n_416985);
static N_INLINE(NI, len_215059)(Tnode214790* n);
N_NIMCALL(Tnode214790*, flattenstmts_239587)(Tnode214790* n);
N_NIMCALL(NIM_BOOL, matchrange_416987)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n, NI i);
N_NIMCALL(NIM_BOOL, matches_416051)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n_416055);
static N_INLINE(NIM_BOOL, ispatternparam_416243)(Tpatterncontext416004* c, Tnode214790* p);
N_NIMCALL(NIM_BOOL, bindorcheck_416314)(Tpatterncontext416004* c, Tsym214822* param, Tnode214790* n);
N_NIMCALL(Tnode214790*, getlazy_416013)(Tpatterncontext416004* c, Tsym214822* sym);
N_NIMCALL(NIM_BOOL, sametrees_416085)(Tnode214790* a, Tnode214790* b);
static N_INLINE(NIM_BOOL, samekinds_416060)(Tnode214790* a, Tnode214790* b);
N_NIMCALL(NU8, canonkind_416056)(Tnode214790* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_244638)(Ttype214828* a, Ttype214828* b, NU8 flags);
N_NIMCALL(NI, sonslen_217351)(Tnode214790* n);
N_NIMCALL(NIM_BOOL, checktypes_416202)(Tpatterncontext416004* c, Tsym214822* p, Tnode214790* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_287042)(Tnode214790* p, Tnode214790* n);
N_NIMCALL(NIM_BOOL, argtypematches_368396)(Tcontext264020* c, Ttype214828* f, Ttype214828* a);
N_NIMCALL(void, putlazy_416027)(Tpatterncontext416004* c, Tsym214822* sym, Tnode214790* 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_416133)(Tnode214790* sc, Tnode214790* x);
N_NIMCALL(NIM_BOOL, matchchoice_416280)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n);
N_NIMCALL(NIM_BOOL, matchnested_416371)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3354)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode214790*, newnodei_216248)(NU8 kind, Tlineinfo182337 info);
N_CLOSURE(NIM_BOOL, matchstaraux_416378)(Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode214790*, HEX5BHEX5D_215238)(Tnode214790* n, NI i);
N_NIMCALL(void, add_215114)(Tnode214790* father, Tnode214790* son);
N_NIMCALL(void, internalerror_187100)(Tlineinfo182337 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_416342)(Tpatterncontext416004* c, Tsym214822* param, Tnode214790* n);
N_NIMCALL(Tnode214790*, newnodei_216401)(NU8 kind, Tlineinfo182337 info, NI children);
N_NIMCALL(Tnode214790*, lastson_217364)(Tnode214790* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_84004, TNimType* mt);
N_NIMCALL(Tnode214790*, extractrange_239593)(NU8 k, Tnode214790* n, NI a, NI b);
N_NIMCALL(Tnode214790*, newsymnode_216241)(Tsym214822* sym, Tlineinfo182337 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_417078)(Tnode214790* params);
N_NIMCALL(NU8, whichalias_286047)(Tsym214822* p);
N_NIMCALL(void, addtoarglist_417122)(Tnode214790* result, Tnode214790* n);
N_NIMCALL(NU8, ispartof_415328)(Tnode214790* a, Tnode214790* b);
N_NIMCALL(void, markused_362244)(Tlineinfo182337 info, Tsym214822* s);
STRING_LITERAL(TMP3349, "|", 1);
STRING_LITERAL(TMP3350, "*", 1);
STRING_LITERAL(TMP3351, "**", 2);
STRING_LITERAL(TMP3352, "~", 1);
STRING_LITERAL(TMP3358, "invalid pattern", 15);
extern TNimType NTI214784; /* TNodeSeq */
extern Gcheap49818 gch_49859;
TNimType NTI416484; /* object */
extern TNimType NTI325021; /* range -1..0(int) */
extern TNimType NTI214782; /* PNode */
TNimType NTI416483; /* ref object */

static N_INLINE(NI, len_215059)(Tnode214790* 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_416243)(Tpatterncontext416004* c, Tnode214790* 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(Tnode214790*, getlazy_416013)(Tpatterncontext416004* c, Tsym214822* sym) {
	Tnode214790* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_416056)(Tnode214790* 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_416060)(Tnode214790* a, Tnode214790* 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_416056(a);
	LOC4 = 0;
	LOC4 = canonkind_416056(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_416085)(Tnode214790* a, Tnode214790* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_416060(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_244638((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_217351(a);
				LOC17 = 0;
				LOC17 = sonslen_217351(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_416122;
					NI HEX3Atmp_416126;
					NI LOC21;
					NI res_416129;
					i_416122 = 0;
					HEX3Atmp_416126 = 0;
					LOC21 = 0;
					LOC21 = sonslen_217351(a);
					HEX3Atmp_416126 = (NI)(LOC21 - ((NI) 1));
					res_416129 = ((NI) 0);
					{
						while (1) {
							if (!(res_416129 <= HEX3Atmp_416126)) goto LA23;
							i_416122 = res_416129;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_416085((*a).kindU.S6.sons->data[i_416122], (*b).kindU.S6.sons->data[i_416122]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_416129 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_416202)(Tpatterncontext416004* c, Tsym214822* p, Tnode214790* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_287042((*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_368396((*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_416027)(Tpatterncontext416004* c, Tsym214822* sym, Tnode214790* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq214784*) newSeq((&NTI214784), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_416314)(Tpatterncontext416004* c, Tsym214822* param, Tnode214790* n) {
	NIM_BOOL result;
	Tnode214790* pp;
	result = 0;
	pp = getlazy_416013(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_416085(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_416202(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_416027(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_416133)(Tnode214790* sc, Tnode214790* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_416165;
			NI HEX3Atmp_416195;
			NI LOC6;
			NI res_416198;
			i_416165 = 0;
			HEX3Atmp_416195 = 0;
			LOC6 = 0;
			LOC6 = len_215059(sc);
			HEX3Atmp_416195 = (LOC6 - 1);
			res_416198 = ((NI) 0);
			{
				while (1) {
					if (!(res_416198 <= HEX3Atmp_416195)) goto LA8;
					i_416165 = res_416198;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_416165]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_416198 += ((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_416280)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_416304;
		NI HEX3Atmp_416307;
		NI LOC2;
		NI res_416310;
		i_416304 = 0;
		HEX3Atmp_416307 = 0;
		LOC2 = 0;
		LOC2 = len_215059(p);
		HEX3Atmp_416307 = (LOC2 - 1);
		res_416310 = ((NI) 1);
		{
			while (1) {
				if (!(res_416310 <= HEX3Atmp_416307)) goto LA4;
				i_416304 = res_416310;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_416051(c, (*p).kindU.S6.sons->data[i_416304], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_416310 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3354)(void* p, NI op) {
	TY416484* a;
	a = (TY416484*)p;
	nimGCvisit((void*)(*a).p416374, op);
}

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

N_CLOSURE(NIM_BOOL, matchstaraux_416378)(Tpatterncontext416004* c, Tnode214790* op, Tnode214790* n_416382, Tnode214790* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY416484* HEX3Aenvp_416487;
{	result = 0;
	HEX3Aenvp_416487 = (TY416484*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_416382).kind == ((NU8) 27) || (*n_416382).kind == ((NU8) 29) || (*n_416382).kind == ((NU8) 30) || (*n_416382).kind == ((NU8) 31) || (*n_416382).kind == ((NU8) 26) || (*n_416382).kind == ((NU8) 28) || (*n_416382).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_416051(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_416382).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_416407;
			NI HEX3Atmp_416453;
			NI LOC8;
			NI res_416456;
			i_416407 = 0;
			HEX3Atmp_416453 = 0;
			LOC8 = 0;
			LOC8 = sonslen_217351(n_416382);
			HEX3Atmp_416453 = (NI)(LOC8 - ((NI) 1));
			res_416456 = ((NI) 1);
			{
				while (1) {
					if (!(res_416456 <= HEX3Atmp_416453)) goto LA10;
					i_416407 = res_416456;
					{
						TY416379 LOC13;
						Tnode214790* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_416378; LOC13.ClEnv = HEX3Aenvp_416487;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_215238(n_416382, i_416407);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3355)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_416456 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_215114(arglist, (*n_416382).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode214790* n;
		LOC23 = 0;
		LOC23 = ((*n_416382).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_416382).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_416382).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_416449;
			NI HEX3Atmp_416461;
			NI LOC28;
			NI res_416464;
			i_416449 = 0;
			HEX3Atmp_416461 = 0;
			LOC28 = 0;
			LOC28 = len_215059(n);
			HEX3Atmp_416461 = (LOC28 - 1);
			res_416464 = ((NI) 0);
			{
				while (1) {
					if (!(res_416464 <= HEX3Atmp_416461)) goto LA30;
					i_416449 = res_416464;
					{
						TY416379 LOC33;
						Tnode214790* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_416378; LOC33.ClEnv = HEX3Aenvp_416487;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_215238(n, i_416449);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3356)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_416464 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_416202(c, (*(*(*HEX3Aenvp_416487).p416374).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_416382);
		if (!LOC39) goto LA40;
		add_215114(arglist, n_416382);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_416371)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY416484* HEX3Aenv_416489;
{	result = 0;
	HEX3Aenv_416489 = 0;
	HEX3Aenv_416489 = (TY416484*) newObj((&NTI416483), sizeof(TY416484));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_416489).p416374), 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;
		Tnode214790* arglist;
		LOC7 = 0;
		LOC7 = matches_416051(c, (*(*HEX3Aenv_416489).p416374).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_216248(((NU8) 152), (*n).info);
		{
			TY416379 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_416378; LOC12.ClEnv = HEX3Aenv_416489;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_416489).p416374, n, arglist, rpn, LOC12.ClEnv):((TMP3357)(LOC12.ClPrc))(c, (*HEX3Aenv_416489).p416374, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_416314(c, (*(*(*HEX3Aenv_416489).p416374).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_416342)(Tpatterncontext416004* c, Tsym214822* param, Tnode214790* n) {
	Tnode214790* pp;
	pp = getlazy_416013(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_215114(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_216401(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_416027(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_416051)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n_416055) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!(((*n_416055).flags &(1U<<((NU)(((NU8) 6))&15U)))!=0)) goto LA3;
		result = NIM_FALSE;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ispatternparam_416243(c, p);
		if (!LOC6) goto LA7;
		result = bindorcheck_416314(c, (*p).kindU.S4.sym, n_416055);
	}
	goto LA1;
	LA7: ;
	{
		NIM_BOOL LOC10;
		LOC10 = 0;
		LOC10 = ((*n_416055).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_416055).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA12: ;
	{
		NIM_BOOL LOC15;
		LOC15 = 0;
		LOC15 = ((*n_416055).kind == ((NU8) 3));
		if (!(LOC15)) goto LA16;
		LOC15 = insymchoice_416133(p, n_416055);
		LA16: ;
		if (!LOC15) goto LA17;
		result = NIM_TRUE;
	}
	goto LA1;
	LA17: ;
	{
		NIM_BOOL LOC20;
		LOC20 = 0;
		LOC20 = ((*n_416055).kind == ((NU8) 3));
		if (!(LOC20)) goto LA21;
		LOC20 = ((*(*n_416055).kindU.S4.sym).kind == ((NU8) 10));
		LA21: ;
		if (!LOC20) goto LA22;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA26;
			result = ((*p).kindU.S4.sym == (*n_416055).kindU.S4.sym);
		}
		goto LA24;
		LA26: ;
		{
			NIM_BOOL LOC29;
			LOC29 = 0;
			LOC29 = matches_416051(c, p, (*(*n_416055).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*) &TMP3349))) goto LA35;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3350))) goto LA36;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3351))) goto LA37;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3352))) goto LA38;
		goto LA39;
		LA35: ;
		{
			result = matchchoice_416280(c, p, n_416055);
		}
		goto LA40;
		LA36: ;
		{
			result = matchnested_416371(c, p, n_416055, NIM_FALSE);
		}
		goto LA40;
		LA37: ;
		{
			result = matchnested_416371(c, p, n_416055, NIM_TRUE);
		}
		goto LA40;
		LA38: ;
		{
			NIM_BOOL LOC45;
			LOC45 = 0;
			LOC45 = matches_416051(c, (*p).kindU.S6.sons->data[((NI) 1)], n_416055);
			result = !(LOC45);
		}
		goto LA40;
		LA39: ;
		{
			internalerror_187100((*p).info, ((NimStringDesc*) &TMP3358));
		}
		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_416051(c, (*p).kindU.S6.sons->data[((NI) 0)], n_416055);
				if (!LOC56) goto LA57;
				gather_416342(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_416055);
				result = NIM_TRUE;
			}
			LA57: ;
		}
		goto LA50;
		LA52: ;
		{
			{
				NIM_BOOL LOC62;
				LOC62 = 0;
				LOC62 = matches_416051(c, (*p).kindU.S6.sons->data[((NI) 0)], n_416055);
				if (!LOC62) goto LA63;
				result = bindorcheck_416314(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_416055);
			}
			LA63: ;
		}
		LA50: ;
	}
	goto LA1;
	LA48: ;
	{
		NIM_BOOL LOC66;
		LOC66 = 0;
		LOC66 = samekinds_416060(p, n_416055);
		if (!LOC66) goto LA67;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_416055).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_416055).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_416055).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_416055).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_416055).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode214790* v;
			plen = sonslen_217351(p);
			v = lastson_217364(p);
			{
				NIM_BOOL LOC78;
				Tnode214790* arglist;
				LOC78 = 0;
				LOC78 = ispatternparam_416243(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_217351(n_416055);
					if (!(plen <= LOC84)) goto LA85;
					{
						NI i_416850;
						NI HEX3Atmp_416942;
						NI res_416945;
						i_416850 = 0;
						HEX3Atmp_416942 = 0;
						HEX3Atmp_416942 = (NI)(plen - ((NI) 2));
						res_416945 = ((NI) 0);
						{
							while (1) {
								if (!(res_416945 <= HEX3Atmp_416942)) goto LA89;
								i_416850 = res_416945;
								{
									NIM_BOOL LOC92;
									LOC92 = 0;
									LOC92 = matches_416051(c, (*p).kindU.S6.sons->data[i_416850], (*n_416055).kindU.S6.sons->data[i_416850]);
									if (!!(LOC92)) goto LA93;
									goto BeforeRet;
								}
								LA93: ;
								res_416945 += ((NI) 1);
							} LA89: ;
						}
					}
					{
						NIM_BOOL LOC97;
						NIM_BOOL LOC98;
						NI LOC99;
						Tnode214790* LOC101;
						Tnode214790* LOC103;
						Tnode214790* n;
						Tnode214790* LOC106;
						NI LOC107;
						LOC97 = 0;
						LOC98 = 0;
						LOC99 = 0;
						LOC99 = sonslen_217351(n_416055);
						LOC98 = (plen == LOC99);
						if (!(LOC98)) goto LA100;
						LOC101 = 0;
						LOC101 = lastson_217364(n_416055);
						LOC98 = ((*LOC101).kind == ((NU8) 58));
						LA100: ;
						LOC97 = LOC98;
						if (!(LOC97)) goto LA102;
						LOC103 = 0;
						LOC103 = lastson_217364(n_416055);
						LOC97 = ((*(*LOC103).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA102: ;
						if (!LOC97) goto LA104;
						LOC106 = 0;
						LOC106 = lastson_217364(n_416055);
						n = (*LOC106).kindU.S6.sons->data[((NI) 1)];
						LOC107 = 0;
						LOC107 = len_215059(n);
						arglist = newnodei_216401(((NU8) 152), (*n).info, LOC107);
						{
							NI i_416893;
							NI HEX3Atmp_416950;
							NI LOC109;
							NI res_416953;
							i_416893 = 0;
							HEX3Atmp_416950 = 0;
							LOC109 = 0;
							LOC109 = len_215059(n);
							HEX3Atmp_416950 = (LOC109 - 1);
							res_416953 = ((NI) 0);
							{
								while (1) {
									if (!(res_416953 <= HEX3Atmp_416950)) goto LA111;
									i_416893 = res_416953;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_416893]), (*n).kindU.S6.sons->data[i_416893]);
									res_416953 += ((NI) 1);
								} LA111: ;
							}
						}
					}
					goto LA95;
					LA104: ;
					{
						NI LOC113;
						LOC113 = 0;
						LOC113 = sonslen_217351(n_416055);
						arglist = newnodei_216401(((NU8) 152), (*n_416055).info, (NI)((NI)(LOC113 - plen) + ((NI) 1)));
						{
							NI i_416907;
							NI HEX3Atmp_416958;
							NI LOC115;
							NI res_416961;
							i_416907 = 0;
							HEX3Atmp_416958 = 0;
							LOC115 = 0;
							LOC115 = sonslen_217351(n_416055);
							HEX3Atmp_416958 = (NI)(LOC115 - plen);
							res_416961 = ((NI) 0);
							{
								while (1) {
									if (!(res_416961 <= HEX3Atmp_416958)) goto LA117;
									i_416907 = res_416961;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_416907]), (*n_416055).kindU.S6.sons->data[(NI)((NI)(i_416907 + plen) - ((NI) 1))]);
									res_416961 += ((NI) 1);
								} LA117: ;
							}
						}
					}
					LA95: ;
					result = bindorcheck_416314(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA85: ;
				{
					NI LOC119;
					LOC119 = 0;
					LOC119 = sonslen_217351(n_416055);
					if (!((NI)(plen - ((NI) 1)) == LOC119)) goto LA120;
					{
						NI i_416922;
						NI HEX3Atmp_416966;
						NI res_416969;
						i_416922 = 0;
						HEX3Atmp_416966 = 0;
						HEX3Atmp_416966 = (NI)(plen - ((NI) 2));
						res_416969 = ((NI) 0);
						{
							while (1) {
								if (!(res_416969 <= HEX3Atmp_416966)) goto LA124;
								i_416922 = res_416969;
								{
									NIM_BOOL LOC127;
									LOC127 = 0;
									LOC127 = matches_416051(c, (*p).kindU.S6.sons->data[i_416922], (*n_416055).kindU.S6.sons->data[i_416922]);
									if (!!(LOC127)) goto LA128;
									goto BeforeRet;
								}
								LA128: ;
								res_416969 += ((NI) 1);
							} LA124: ;
						}
					}
					arglist = newnodei_216248(((NU8) 152), (*n_416055).info);
					result = bindorcheck_416314(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA120: ;
				LA82: ;
			}
			LA80: ;
			{
				NI LOC132;
				LOC132 = 0;
				LOC132 = sonslen_217351(n_416055);
				if (!(plen == LOC132)) goto LA133;
				{
					NI i_416937;
					NI HEX3Atmp_416974;
					NI LOC136;
					NI res_416977;
					i_416937 = 0;
					HEX3Atmp_416974 = 0;
					LOC136 = 0;
					LOC136 = sonslen_217351(p);
					HEX3Atmp_416974 = (NI)(LOC136 - ((NI) 1));
					res_416977 = ((NI) 0);
					{
						while (1) {
							if (!(res_416977 <= HEX3Atmp_416974)) goto LA138;
							i_416937 = res_416977;
							{
								NIM_BOOL LOC141;
								LOC141 = 0;
								LOC141 = matches_416051(c, (*p).kindU.S6.sons->data[i_416937], (*n_416055).kindU.S6.sons->data[i_416937]);
								if (!!(LOC141)) goto LA142;
								goto BeforeRet;
							}
							LA142: ;
							res_416977 += ((NI) 1);
						} LA138: ;
					}
				}
				result = NIM_TRUE;
			}
			LA133: ;
		}
		break;
		}
	}
	goto LA1;
	LA67: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_416987)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_417012;
		NI HEX3Atmp_417024;
		NI LOC2;
		NI res_417027;
		j_417012 = 0;
		HEX3Atmp_417024 = 0;
		LOC2 = 0;
		LOC2 = len_215059(p);
		HEX3Atmp_417024 = (LOC2 - 1);
		res_417027 = ((NI) 0);
		{
			while (1) {
				if (!(res_417027 <= HEX3Atmp_417024)) goto LA4;
				j_417012 = res_417027;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_416051(c, (*p).kindU.S6.sons->data[j_417012], (*n).kindU.S6.sons->data[(NI)(i + j_417012)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI214784));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_417027 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode214790*, matchstmtlist_416981)(Tpatterncontext416004* c, Tnode214790* p, Tnode214790* n_416985) {
	Tnode214790* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode214790* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_416985).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_215059(p);
		LOC8 = 0;
		LOC8 = len_215059(n_416985);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_239587(n_416985);
		{
			NI i_417063;
			NI HEX3Atmp_417071;
			NI LOC12;
			NI LOC13;
			NI res_417074;
			i_417063 = 0;
			HEX3Atmp_417071 = 0;
			LOC12 = 0;
			LOC12 = len_215059(n);
			LOC13 = 0;
			LOC13 = len_215059(p);
			HEX3Atmp_417071 = (NI)(LOC12 - LOC13);
			res_417074 = ((NI) 0);
			{
				while (1) {
					if (!(res_417074 <= HEX3Atmp_417071)) goto LA15;
					i_417063 = res_417074;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_416987(c, p, n, i_417063);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_216401(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_239593(((NU8) 115), n, ((NI) 0), (NI)(i_417063 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_215059(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_239593(((NU8) 115), n, i_417063, (NI)((NI)(i_417063 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_215059(p);
						LOC23 = 0;
						LOC23 = len_215059(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_239593(((NU8) 115), n, (NI)(i_417063 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_417074 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_416051(c, p, n_416985);
		if (!LOC25) goto LA26;
		result = n_416985;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_417078)(Tnode214790* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_215059(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_417101;
			NI HEX3Atmp_417115;
			NI LOC7;
			NI res_417118;
			i_417101 = 0;
			HEX3Atmp_417115 = 0;
			LOC7 = 0;
			LOC7 = len_215059(params);
			HEX3Atmp_417115 = (LOC7 - 1);
			res_417118 = ((NI) 1);
			{
				while (1) {
					Tsym214822* param;
					if (!(res_417118 <= HEX3Atmp_417115)) goto LA9;
					i_417101 = res_417118;
					param = (*(*params).kindU.S6.sons->data[i_417101]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_286047(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_417118 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_417122)(Tnode214790* result, Tnode214790* 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_215114(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_417175;
				NI HEX3Atmp_417179;
				NI LOC13;
				NI res_417182;
				i_417175 = 0;
				HEX3Atmp_417179 = 0;
				LOC13 = 0;
				LOC13 = len_215059(n);
				HEX3Atmp_417179 = (LOC13 - 1);
				res_417182 = ((NI) 0);
				{
					while (1) {
						if (!(res_417182 <= HEX3Atmp_417179)) goto LA15;
						i_417175 = res_417182;
						add_215114(result, (*n).kindU.S6.sons->data[i_417175]);
						res_417182 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode214790*, applyrule_417186)(Tcontext264020* c, Tsym214822* s, Tnode214790* n) {
	Tnode214790* result;
	Tpatterncontext416004 ctx;
	NI LOC1;
	Tnode214790* m;
	Tnode214790* LOC6;
	Tnode214790* params;
	NIM_BOOL requiresaa;
	Tnode214790* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_217327((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_416981((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_216248(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_216241(s, (*n).info);
	add_215114(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_417078(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_216248(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_417229;
		NI HEX3Atmp_417405;
		NI LOC12;
		NI res_417408;
		i_417229 = 0;
		HEX3Atmp_417405 = 0;
		LOC12 = 0;
		LOC12 = len_215059(params);
		HEX3Atmp_417405 = (LOC12 - 1);
		res_417408 = ((NI) 1);
		{
			while (1) {
				Tsym214822* param;
				Tnode214790* x;
				if (!(res_417408 <= HEX3Atmp_417405)) goto LA14;
				i_417229 = res_417408;
				param = (*(*params).kindU.S6.sons->data[i_417229]).kindU.S4.sym;
				x = getlazy_416013((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_215114(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_417122(args, x);
				}
				LA21: ;
				res_417408 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_417262;
			NI HEX3Atmp_417435;
			NI LOC28;
			NI res_417438;
			i_417262 = 0;
			HEX3Atmp_417435 = 0;
			LOC28 = 0;
			LOC28 = len_215059(params);
			HEX3Atmp_417435 = (LOC28 - 1);
			res_417438 = ((NI) 1);
			{
				while (1) {
					Tnode214790* rs;
					Tsym214822* param;
					NU8 LOC31;
					if (!(res_417438 <= HEX3Atmp_417435)) goto LA30;
					i_417262 = res_417438;
					rs = (*result).kindU.S6.sons->data[i_417262];
					param = (*(*params).kindU.S6.sons->data[i_417262]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_286047(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode214790* arg_417269;
							arg_417269 = 0;
							{
								NI i_417417;
								NI HEX3Atmp_417419;
								NI LOC36;
								NI res_417421;
								i_417417 = 0;
								HEX3Atmp_417419 = 0;
								LOC36 = 0;
								LOC36 = len_215059(args);
								HEX3Atmp_417419 = (LOC36 - 1);
								res_417421 = ((NI) 0);
								{
									while (1) {
										if (!(res_417421 <= HEX3Atmp_417419)) goto LA38;
										i_417417 = res_417421;
										arg_417269 = (*args).kindU.S6.sons->data[i_417417];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_417269 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_415328(rs, arg_417269);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_417421 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode214790* arg_417291;
							arg_417291 = 0;
							{
								NI i_417428;
								NI HEX3Atmp_417430;
								NI LOC53;
								NI res_417432;
								i_417428 = 0;
								HEX3Atmp_417430 = 0;
								LOC53 = 0;
								LOC53 = len_215059(args);
								HEX3Atmp_417430 = (LOC53 - 1);
								res_417432 = ((NI) 0);
								{
									while (1) {
										if (!(res_417432 <= HEX3Atmp_417430)) goto LA55;
										i_417428 = res_417432;
										arg_417291 = (*args).kindU.S6.sons->data[i_417428];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_417291 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_415328(rs, arg_417291);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_417432 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_417438 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_362244((*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* TMP3353[2];
static TNimNode TMP1029[3];
NTI416484.size = sizeof(TY416484);
NTI416484.kind = 18;
NTI416484.base = 0;
NTI416484.flags = 2;
TMP3353[0] = &TMP1029[1];
TMP1029[1].kind = 1;
TMP1029[1].offset = offsetof(TY416484, HEX3Astate);
TMP1029[1].typ = (&NTI325021);
TMP1029[1].name = ":state";
TMP3353[1] = &TMP1029[2];
TMP1029[2].kind = 1;
TMP1029[2].offset = offsetof(TY416484, p416374);
TMP1029[2].typ = (&NTI214782);
TMP1029[2].name = "p416374";
TMP1029[0].len = 2; TMP1029[0].kind = 2; TMP1029[0].sons = &TMP3353[0];
NTI416484.node = &TMP1029[0];
NTI416483.size = sizeof(TY416484*);
NTI416483.kind = 22;
NTI416483.base = (&NTI416484);
NTI416483.flags = 2;
NTI416483.marker = TMP3354;
}

