/* Generated by Nim Compiler v0.12.0 */
/*   (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
typedef struct Tnode224809 Tnode224809;
typedef struct Tcontext279023 Tcontext279023;
typedef struct Tsym224841 Tsym224841;
typedef struct Tpatterncontext447013 Tpatterncontext447013;
typedef struct Tnodeseq224803 Tnodeseq224803;
typedef struct Ttype224847 Ttype224847;
typedef struct Tidobj197015 Tidobj197015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq224843 Ttypeseq224843;
typedef struct Tscope224835 Tscope224835;
typedef struct TY224944 TY224944;
typedef struct Tstrtable224813 Tstrtable224813;
typedef struct Tsymseq224811 Tsymseq224811;
typedef struct Tident197021 Tident197021;
typedef struct Tlineinfo189352 Tlineinfo189352;
typedef struct Tloc224823 Tloc224823;
typedef struct Ropeobj175009 Ropeobj175009;
typedef struct Tlib224827 Tlib224827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell48946 Cell48946;
typedef struct Cellseq48962 Cellseq48962;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48958 Cellset48958;
typedef struct Pagedesc48954 Pagedesc48954;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct TY447596 TY447596;
typedef struct Tpasscontext276005 Tpasscontext276005;
typedef struct Tproccon279011 Tproccon279011;
typedef struct Intset221056 Intset221056;
typedef struct Trunk221052 Trunk221052;
typedef struct Trunkseq221054 Trunkseq221054;
typedef struct Tlinkedlist140028 Tlinkedlist140028;
typedef struct Tlistentry140022 Tlistentry140022;
typedef struct Tidtable224859 Tidtable224859;
typedef struct Tidpairseq224857 Tidpairseq224857;
typedef struct Tctx278048 Tctx278048;
typedef struct TY279143 TY279143;
typedef struct Tinstantiation224831 Tinstantiation224831;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Tidpair224855 Tidpair224855;
typedef struct TY278254 TY278254;
typedef struct TY190420 TY190420;
typedef struct PprocHEX3Aobjecttype278233 PprocHEX3Aobjecttype278233;
typedef struct TY278273 TY278273;
typedef struct Tinstantiationpair279013 Tinstantiationpair279013;
typedef struct TY224932 TY224932;
typedef struct TY278234 TY278234;
typedef struct TY278239 TY278239;
typedef struct TY278274 TY278274;
typedef struct Vmargs278042 Vmargs278042;
typedef struct Tblock278030 Tblock278030;
typedef struct TY278214 TY278214;
struct  Tpatterncontext447013  {
Tsym224841* owner;
Tnodeseq224803* mapping;
NI formals;
Tcontext279023* c;
NIM_BOOL submatch;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj197015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable224813  {
NI counter;
Tsymseq224811* data;
};
struct  Tlineinfo189352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc224823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype224847* t;
Ropeobj175009* r;
Ropeobj175009* heaproot;
};
struct  Tsym224841  {
  Tidobj197015 Sup;
NU8 kind;
union{
struct {Ttypeseq224843* typeinstcache;
Tscope224835* typscope;
} S1;
struct {TY224944* procinstcache;
Tsym224841* gcunsafetyreason;
} S2;
struct {TY224944* usedgenerics;
Tstrtable224813 tab;
} S3;
struct {Tsym224841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype224847* typ;
Tident197021* name;
Tlineinfo189352 info;
Tsym224841* owner;
NU32 flags;
Tnode224809* ast;
NU32 options;
NI position;
NI offset;
Tloc224823 loc;
Tlib224827* annex;
Tnode224809* constraint;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode224809  {
Ttype224847* typ;
Tlineinfo189352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym224841* sym;
} S4;
struct {Tident197021* ident;
} S5;
struct {Tnodeseq224803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident197021  {
  Tidobj197015 Sup;
NimStringDesc* s;
Tident197021* next;
NI h;
};
struct  Ttype224847  {
  Tidobj197015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq224843* sons;
Tnode224809* n;
Tsym224841* owner;
Tsym224841* sym;
Tsym224841* destructor;
Tsym224841* deepcopy;
Tsym224841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc224823 loc;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Cell48946  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48962  {
NI len;
NI cap;
Cell48946** d;
};
struct  Cellset48958  {
NI counter;
NI max;
Pagedesc48954* head;
Pagedesc48954** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48962 zct;
Cellseq48962 decstack;
Cellset48958 cycleroots;
Cellseq48962 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  TY447596  {
NI HEX3Astate;
Tnode224809* p447485;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY447490;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3321) (Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3322) (Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3323) (Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn);
struct  Tpasscontext276005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset221056  {
NI counter;
NI max;
Trunk221052* head;
Trunkseq221054* data;
};
struct  Tlinkedlist140028  {
Tlistentry140022* head;
Tlistentry140022* tail;
NI counter;
};
struct  Tidtable224859  {
NI counter;
Tidpairseq224857* data;
};
typedef N_NIMCALL_PTR(Tnode224809*, TY279074) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279079) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279087) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279095) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279100) (Tcontext279023* c, Tnode224809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode224809*, TY279108) (Tcontext279023* c, Tnode224809* n);
typedef N_NIMCALL_PTR(Tnode224809*, TY279113) (Tcontext279023* c, Tnode224809* n, Tnode224809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype224847*, TY279120) (Tcontext279023* c, Tnode224809* n, Ttype224847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode224809*, ClPrc) (Tcontext279023* c, Tidtable224859 pt, Tnode224809* n, void* ClEnv);
void* ClEnv;
} TY279126;
typedef struct {
N_NIMCALL_PTR(Tsym224841*, ClPrc) (Tcontext279023* c, Tsym224841* fn, Tidtable224859 pt, Tlineinfo189352 info, void* ClEnv);
void* ClEnv;
} TY279132;
typedef N_NIMCALL_PTR(Tsym224841*, TY279148) (Tcontext279023* c, Tsym224841* dc, Ttype224847* t, Tlineinfo189352 info, NU8 op);
struct  Tcontext279023  {
  Tpasscontext276005 Sup;
Tsym224841* module;
Tscope224835* currentscope;
Tscope224835* importtable;
Tscope224835* toplevelscope;
Tproccon279011* p;
Tsymseq224811* friendmodules;
NI instcounter;
Intset221056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq224811* converters;
Tsymseq224811* patterns;
Tlinkedlist140028 optionstack;
Tidtable224859 symmapping;
Tlinkedlist140028 libs;
TY279074 semconstexpr;
TY279079 semexpr;
TY279087 semtryexpr;
TY279095 semtryconstexpr;
TY279100 semoperand;
TY279108 semconstboolexpr;
TY279113 semoverloadedcall;
TY279120 semtypenode;
TY279126 seminferredlambda;
TY279132 semgenerateinstance;
Intset221056 includedfiles;
Tstrtable224813 userpragmas;
Tctx278048* evalcontext;
Intset221056 unknownidents;
TY279143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY279148 insttypeboundop;
};
struct  Tscope224835  {
NI depthlevel;
Tstrtable224813 symbols;
Tnodeseq224803* usingsyms;
Tscope224835* parent;
};
struct  Ropeobj175009  {
  TNimObject Sup;
Ropeobj175009* left;
Ropeobj175009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry140022  {
  TNimObject Sup;
Tlistentry140022* prev;
Tlistentry140022* next;
};
struct  Tlib224827  {
  Tlistentry140022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj175009* name;
Tnode224809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48954  {
Pagedesc48954* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon279011  {
Tsym224841* owner;
Tsym224841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon279011* next;
NIM_BOOL wasforwarded;
Tnode224809* bracketexpr;
};
struct  Trunk221052  {
Trunk221052* next;
NI key;
TY30821 bits;
};
struct  Tidpair224855  {
Tidobj197015* key;
TNimObject* val;
};
struct  Tctx278048  {
  Tpasscontext276005 Sup;
TY278254* code;
TY190420* debug;
Tnode224809* globals;
Tnode224809* constants;
Ttypeseq224843* types;
Tnode224809* currentexceptiona;
Tnode224809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype278233* prc;
Tsym224841* module;
Tnode224809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo189352 comesfromheuristic;
TY278273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair279013  {
Tsym224841* genericsym;
Tinstantiation224831* inst;
};
struct  Tinstantiation224831  {
Tsym224841* sym;
Ttypeseq224843* concretetypes;
TY224932* usedby;
NI compilesid;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY278239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY278239 TY278242[256];
struct  PprocHEX3Aobjecttype278233  {
TY278234* blocks;
Tsym224841* sym;
TY278242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs278042* args, void* ClEnv);
void* ClEnv;
} Vmcallback278044;
struct TY278274 {
NimStringDesc* Field0;
Vmcallback278044 Field1;
};
struct  Tblock278030  {
Tsym224841* label;
TY278214* fixups;
};
struct  Vmargs278042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode224809* currentexception;
};
struct Tnodeseq224803 {
  TGenericSeq Sup;
  Tnode224809* data[SEQ_DECL_SIZE];
};
struct Ttypeseq224843 {
  TGenericSeq Sup;
  Ttype224847* data[SEQ_DECL_SIZE];
};
struct TY224944 {
  TGenericSeq Sup;
  Tinstantiation224831* data[SEQ_DECL_SIZE];
};
struct Tsymseq224811 {
  TGenericSeq Sup;
  Tsym224841* data[SEQ_DECL_SIZE];
};
struct Trunkseq221054 {
  TGenericSeq Sup;
  Trunk221052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq224857 {
  TGenericSeq Sup;
  Tidpair224855 data[SEQ_DECL_SIZE];
};
struct TY279143 {
  TGenericSeq Sup;
  Tinstantiationpair279013 data[SEQ_DECL_SIZE];
};
struct TY278254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY190420 {
  TGenericSeq Sup;
  Tlineinfo189352 data[SEQ_DECL_SIZE];
};
struct TY278273 {
  TGenericSeq Sup;
  TY278274 data[SEQ_DECL_SIZE];
};
struct TY224932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY278234 {
  TGenericSeq Sup;
  Tblock278030 data[SEQ_DECL_SIZE];
};
struct TY278214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_227351)(Ttype224847* n);
N_NIMCALL(Tnode224809*, matchstmtlist_448037)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n_448041);
static N_INLINE(NI, len_225098)(Tnode224809* n);
N_NIMCALL(Tnode224809*, flattenstmts_253773)(Tnode224809* n);
N_NIMCALL(NIM_BOOL, matchrange_448043)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n, NI i);
N_NIMCALL(NIM_BOOL, matches_447075)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n_447079);
static N_INLINE(NIM_BOOL, ispatternparam_447320)(Tpatterncontext447013* c, Tnode224809* p);
N_NIMCALL(NIM_BOOL, bindorcheck_447413)(Tpatterncontext447013* c, Tsym224841* param, Tnode224809* n);
N_NIMCALL(Tnode224809*, getlazy_447025)(Tpatterncontext447013* c, Tsym224841* sym);
N_NIMCALL(NIM_BOOL, sametrees_447124)(Tnode224809* a, Tnode224809* b);
static N_INLINE(NIM_BOOL, samekinds_447093)(Tnode224809* a, Tnode224809* b);
N_NIMCALL(NU8, canonkind_447083)(Tnode224809* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_259108)(Ttype224847* a, Ttype224847* b, NU8 flags);
N_NIMCALL(NI, sonslen_227387)(Tnode224809* n);
N_NIMCALL(NIM_BOOL, checktypes_447273)(Tpatterncontext447013* c, Tsym224841* p, Tnode224809* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_305302)(Tnode224809* p, Tnode224809* n);
N_NIMCALL(NIM_BOOL, argtypematches_393817)(Tcontext279023* c, Ttype224847* f, Ttype224847* a);
N_NIMCALL(void, putlazy_447045)(Tpatterncontext447013* c, Tsym224841* sym, Tnode224809* 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(Cell48946*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48946* c);
N_NOINLINE(void, addzct_52617)(Cellseq48962* s, Cell48946* c);
N_NIMCALL(NIM_BOOL, insymchoice_447188)(Tnode224809* sc, Tnode224809* x);
N_NIMCALL(NIM_BOOL, matchchoice_447363)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n);
N_NIMCALL(NIM_BOOL, matchnested_447482)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3320)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode224809*, newnodei_226351)(NU8 kind, Tlineinfo189352 info);
N_CLOSURE(NIM_BOOL, matchstaraux_447489)(Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode224809*, HEX5BHEX5D_225244)(Tnode224809* n, NI i);
N_NIMCALL(void, add_225165)(Tnode224809* father, Tnode224809* son);
N_NIMCALL(void, internalerror_195172)(Tlineinfo189352 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_447447)(Tpatterncontext447013* c, Tsym224841* param, Tnode224809* n);
N_NIMCALL(Tnode224809*, newnodei_226407)(NU8 kind, Tlineinfo189352 info, NI children);
N_NIMCALL(Tnode224809*, lastson_227406)(Tnode224809* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_85804, TNimType* mt);
N_NIMCALL(Tnode224809*, extractrange_253785)(NU8 k, Tnode224809* n, NI a, NI b);
N_NIMCALL(Tnode224809*, newsymnode_226338)(Tsym224841* sym, Tlineinfo189352 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_448163)(Tnode224809* params);
N_NIMCALL(NU8, whichalias_304080)(Tsym224841* p);
N_NIMCALL(void, addtoarglist_448223)(Tnode224809* result, Tnode224809* n);
N_NIMCALL(NU8, ispartof_446375)(Tnode224809* a, Tnode224809* b);
N_NIMCALL(void, markused_387253)(Tlineinfo189352 info, Tsym224841* s);
STRING_LITERAL(TMP3315, "|", 1);
STRING_LITERAL(TMP3316, "*", 1);
STRING_LITERAL(TMP3317, "**", 2);
STRING_LITERAL(TMP3318, "~", 1);
STRING_LITERAL(TMP3324, "invalid pattern", 15);
extern TNimType NTI224803; /* TNodeSeq */
extern Gcheap51018 gch_51059;
TNimType NTI447596; /* object */
extern TNimType NTI345033; /* range -1..0(int) */
extern TNimType NTI224801; /* PNode */
TNimType NTI447624; /* ref object */

static N_INLINE(NI, len_225098)(Tnode224809* 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_447320)(Tpatterncontext447013* c, Tnode224809* 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(Tnode224809*, getlazy_447025)(Tpatterncontext447013* c, Tsym224841* sym) {
	Tnode224809* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_447083)(Tnode224809* 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_447093)(Tnode224809* a, Tnode224809* 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_447083(a);
	LOC4 = 0;
	LOC4 = canonkind_447083(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_447124)(Tnode224809* a, Tnode224809* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_447093(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_259108((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_227387(a);
				LOC17 = 0;
				LOC17 = sonslen_227387(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_447162;
					NI HEX3Atmp_447166;
					NI LOC21;
					NI res_447169;
					i_447162 = 0;
					HEX3Atmp_447166 = 0;
					LOC21 = 0;
					LOC21 = sonslen_227387(a);
					HEX3Atmp_447166 = (NI)(LOC21 - ((NI) 1));
					res_447169 = ((NI) 0);
					{
						while (1) {
							if (!(res_447169 <= HEX3Atmp_447166)) goto LA23;
							i_447162 = res_447169;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_447124((*a).kindU.S6.sons->data[i_447162], (*b).kindU.S6.sons->data[i_447162]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_447169 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_447273)(Tpatterncontext447013* c, Tsym224841* p, Tnode224809* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_305302((*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_393817((*c).c, (*p).typ, (*n).typ);
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

static N_INLINE(void, rtladdzct_54204)(Cell48946* c) {
	addzct_52617((&gch_51059.zct), c);
}

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

N_NIMCALL(void, putlazy_447045)(Tpatterncontext447013* c, Tsym224841* sym, Tnode224809* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq224803*) newSeq((&NTI224803), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_447413)(Tpatterncontext447013* c, Tsym224841* param, Tnode224809* n) {
	NIM_BOOL result;
	Tnode224809* pp;
	result = 0;
	pp = getlazy_447025(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_447124(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_447273(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_447045(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_447188)(Tnode224809* sc, Tnode224809* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_447221;
			NI HEX3Atmp_447251;
			NI LOC6;
			NI res_447254;
			i_447221 = 0;
			HEX3Atmp_447251 = 0;
			LOC6 = 0;
			LOC6 = len_225098(sc);
			HEX3Atmp_447251 = (LOC6 - 1);
			res_447254 = ((NI) 0);
			{
				while (1) {
					if (!(res_447254 <= HEX3Atmp_447251)) goto LA8;
					i_447221 = res_447254;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_447221]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_447254 += ((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_447363)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_447388;
		NI HEX3Atmp_447391;
		NI LOC2;
		NI res_447394;
		i_447388 = 0;
		HEX3Atmp_447391 = 0;
		LOC2 = 0;
		LOC2 = len_225098(p);
		HEX3Atmp_447391 = (LOC2 - 1);
		res_447394 = ((NI) 1);
		{
			while (1) {
				if (!(res_447394 <= HEX3Atmp_447391)) goto LA4;
				i_447388 = res_447394;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_447075(c, (*p).kindU.S6.sons->data[i_447388], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_447394 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3320)(void* p, NI op) {
	TY447596* a;
	a = (TY447596*)p;
	nimGCvisit((void*)(*a).p447485, op);
}

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

N_CLOSURE(NIM_BOOL, matchstaraux_447489)(Tpatterncontext447013* c, Tnode224809* op, Tnode224809* n_447493, Tnode224809* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY447596* HEX3Aenvp_447620;
{	result = 0;
	HEX3Aenvp_447620 = (TY447596*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_447493).kind == ((NU8) 27) || (*n_447493).kind == ((NU8) 29) || (*n_447493).kind == ((NU8) 30) || (*n_447493).kind == ((NU8) 31) || (*n_447493).kind == ((NU8) 26) || (*n_447493).kind == ((NU8) 28) || (*n_447493).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_447075(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_447493).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_447519;
			NI HEX3Atmp_447566;
			NI LOC8;
			NI res_447569;
			i_447519 = 0;
			HEX3Atmp_447566 = 0;
			LOC8 = 0;
			LOC8 = sonslen_227387(n_447493);
			HEX3Atmp_447566 = (NI)(LOC8 - ((NI) 1));
			res_447569 = ((NI) 1);
			{
				while (1) {
					if (!(res_447569 <= HEX3Atmp_447566)) goto LA10;
					i_447519 = res_447569;
					{
						TY447490 LOC13;
						Tnode224809* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_447489; LOC13.ClEnv = HEX3Aenvp_447620;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_225244(n_447493, i_447519);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3321)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_447569 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_225165(arglist, (*n_447493).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode224809* n;
		LOC23 = 0;
		LOC23 = ((*n_447493).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_447493).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_447493).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_447562;
			NI HEX3Atmp_447574;
			NI LOC28;
			NI res_447577;
			i_447562 = 0;
			HEX3Atmp_447574 = 0;
			LOC28 = 0;
			LOC28 = len_225098(n);
			HEX3Atmp_447574 = (LOC28 - 1);
			res_447577 = ((NI) 0);
			{
				while (1) {
					if (!(res_447577 <= HEX3Atmp_447574)) goto LA30;
					i_447562 = res_447577;
					{
						TY447490 LOC33;
						Tnode224809* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_447489; LOC33.ClEnv = HEX3Aenvp_447620;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_225244(n, i_447562);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3322)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_447577 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_447273(c, (*(*(*HEX3Aenvp_447620).p447485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_447493);
		if (!LOC39) goto LA40;
		add_225165(arglist, n_447493);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_447482)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY447596* HEX3Aenv_447623;
{	result = 0;
	HEX3Aenv_447623 = 0;
	HEX3Aenv_447623 = (TY447596*) newObj((&NTI447624), sizeof(TY447596));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_447623).p447485), 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;
		Tnode224809* arglist;
		LOC7 = 0;
		LOC7 = matches_447075(c, (*(*HEX3Aenv_447623).p447485).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_226351(((NU8) 152), (*n).info);
		{
			TY447490 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_447489; LOC12.ClEnv = HEX3Aenv_447623;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_447623).p447485, n, arglist, rpn, LOC12.ClEnv):((TMP3323)(LOC12.ClPrc))(c, (*HEX3Aenv_447623).p447485, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_447413(c, (*(*(*HEX3Aenv_447623).p447485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_447447)(Tpatterncontext447013* c, Tsym224841* param, Tnode224809* n) {
	Tnode224809* pp;
	pp = getlazy_447025(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_225165(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_226407(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_447045(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_447075)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n_447079) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!(((*n_447079).flags &(1<<((((NU8) 6))&15)))!=0)) goto LA3;
		result = NIM_FALSE;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ispatternparam_447320(c, p);
		if (!LOC6) goto LA7;
		result = bindorcheck_447413(c, (*p).kindU.S4.sym, n_447079);
	}
	goto LA1;
	LA7: ;
	{
		NIM_BOOL LOC10;
		LOC10 = 0;
		LOC10 = ((*n_447079).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_447079).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA12: ;
	{
		NIM_BOOL LOC15;
		LOC15 = 0;
		LOC15 = ((*n_447079).kind == ((NU8) 3));
		if (!(LOC15)) goto LA16;
		LOC15 = insymchoice_447188(p, n_447079);
		LA16: ;
		if (!LOC15) goto LA17;
		result = NIM_TRUE;
	}
	goto LA1;
	LA17: ;
	{
		NIM_BOOL LOC20;
		LOC20 = 0;
		LOC20 = ((*n_447079).kind == ((NU8) 3));
		if (!(LOC20)) goto LA21;
		LOC20 = ((*(*n_447079).kindU.S4.sym).kind == ((NU8) 10));
		LA21: ;
		if (!LOC20) goto LA22;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA26;
			result = ((*p).kindU.S4.sym == (*n_447079).kindU.S4.sym);
		}
		goto LA24;
		LA26: ;
		{
			NIM_BOOL LOC29;
			LOC29 = 0;
			LOC29 = matches_447075(c, p, (*(*n_447079).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*) &TMP3315))) goto LA35;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3316))) goto LA36;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3317))) goto LA37;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3318))) goto LA38;
		goto LA39;
		LA35: ;
		{
			result = matchchoice_447363(c, p, n_447079);
		}
		goto LA40;
		LA36: ;
		{
			result = matchnested_447482(c, p, n_447079, NIM_FALSE);
		}
		goto LA40;
		LA37: ;
		{
			result = matchnested_447482(c, p, n_447079, NIM_TRUE);
		}
		goto LA40;
		LA38: ;
		{
			NIM_BOOL LOC45;
			LOC45 = 0;
			LOC45 = matches_447075(c, (*p).kindU.S6.sons->data[((NI) 1)], n_447079);
			result = !(LOC45);
		}
		goto LA40;
		LA39: ;
		{
			internalerror_195172((*p).info, ((NimStringDesc*) &TMP3324));
		}
		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_447075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_447079);
				if (!LOC56) goto LA57;
				gather_447447(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_447079);
				result = NIM_TRUE;
			}
			LA57: ;
		}
		goto LA50;
		LA52: ;
		{
			{
				NIM_BOOL LOC62;
				LOC62 = 0;
				LOC62 = matches_447075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_447079);
				if (!LOC62) goto LA63;
				result = bindorcheck_447413(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_447079);
			}
			LA63: ;
		}
		LA50: ;
	}
	goto LA1;
	LA48: ;
	{
		NIM_BOOL LOC66;
		LOC66 = 0;
		LOC66 = samekinds_447093(p, n_447079);
		if (!LOC66) goto LA67;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_447079).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_447079).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_447079).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_447079).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_447079).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode224809* v;
			plen = sonslen_227387(p);
			v = lastson_227406(p);
			{
				NIM_BOOL LOC78;
				Tnode224809* arglist;
				LOC78 = 0;
				LOC78 = ispatternparam_447320(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_227387(n_447079);
					if (!(plen <= LOC84)) goto LA85;
					{
						NI i_447851;
						NI HEX3Atmp_447947;
						NI res_447950;
						i_447851 = 0;
						HEX3Atmp_447947 = 0;
						HEX3Atmp_447947 = (NI)(plen - ((NI) 2));
						res_447950 = ((NI) 0);
						{
							while (1) {
								if (!(res_447950 <= HEX3Atmp_447947)) goto LA89;
								i_447851 = res_447950;
								{
									NIM_BOOL LOC92;
									LOC92 = 0;
									LOC92 = matches_447075(c, (*p).kindU.S6.sons->data[i_447851], (*n_447079).kindU.S6.sons->data[i_447851]);
									if (!!(LOC92)) goto LA93;
									goto BeforeRet;
								}
								LA93: ;
								res_447950 += ((NI) 1);
							} LA89: ;
						}
					}
					{
						NIM_BOOL LOC97;
						NIM_BOOL LOC98;
						NI LOC99;
						Tnode224809* LOC101;
						Tnode224809* LOC103;
						Tnode224809* n;
						Tnode224809* LOC106;
						NI LOC107;
						LOC97 = 0;
						LOC98 = 0;
						LOC99 = 0;
						LOC99 = sonslen_227387(n_447079);
						LOC98 = (plen == LOC99);
						if (!(LOC98)) goto LA100;
						LOC101 = 0;
						LOC101 = lastson_227406(n_447079);
						LOC98 = ((*LOC101).kind == ((NU8) 58));
						LA100: ;
						LOC97 = LOC98;
						if (!(LOC97)) goto LA102;
						LOC103 = 0;
						LOC103 = lastson_227406(n_447079);
						LOC97 = ((*(*LOC103).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA102: ;
						if (!LOC97) goto LA104;
						LOC106 = 0;
						LOC106 = lastson_227406(n_447079);
						n = (*LOC106).kindU.S6.sons->data[((NI) 1)];
						LOC107 = 0;
						LOC107 = len_225098(n);
						arglist = newnodei_226407(((NU8) 152), (*n).info, LOC107);
						{
							NI i_447895;
							NI HEX3Atmp_447955;
							NI LOC109;
							NI res_447958;
							i_447895 = 0;
							HEX3Atmp_447955 = 0;
							LOC109 = 0;
							LOC109 = len_225098(n);
							HEX3Atmp_447955 = (LOC109 - 1);
							res_447958 = ((NI) 0);
							{
								while (1) {
									if (!(res_447958 <= HEX3Atmp_447955)) goto LA111;
									i_447895 = res_447958;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_447895]), (*n).kindU.S6.sons->data[i_447895]);
									res_447958 += ((NI) 1);
								} LA111: ;
							}
						}
					}
					goto LA95;
					LA104: ;
					{
						NI LOC113;
						LOC113 = 0;
						LOC113 = sonslen_227387(n_447079);
						arglist = newnodei_226407(((NU8) 152), (*n_447079).info, (NI)((NI)(LOC113 - plen) + ((NI) 1)));
						{
							NI i_447910;
							NI HEX3Atmp_447963;
							NI LOC115;
							NI res_447966;
							i_447910 = 0;
							HEX3Atmp_447963 = 0;
							LOC115 = 0;
							LOC115 = sonslen_227387(n_447079);
							HEX3Atmp_447963 = (NI)(LOC115 - plen);
							res_447966 = ((NI) 0);
							{
								while (1) {
									if (!(res_447966 <= HEX3Atmp_447963)) goto LA117;
									i_447910 = res_447966;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_447910]), (*n_447079).kindU.S6.sons->data[(NI)((NI)(i_447910 + plen) - ((NI) 1))]);
									res_447966 += ((NI) 1);
								} LA117: ;
							}
						}
					}
					LA95: ;
					result = bindorcheck_447413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA85: ;
				{
					NI LOC119;
					LOC119 = 0;
					LOC119 = sonslen_227387(n_447079);
					if (!((NI)(plen - ((NI) 1)) == LOC119)) goto LA120;
					{
						NI i_447926;
						NI HEX3Atmp_447971;
						NI res_447974;
						i_447926 = 0;
						HEX3Atmp_447971 = 0;
						HEX3Atmp_447971 = (NI)(plen - ((NI) 2));
						res_447974 = ((NI) 0);
						{
							while (1) {
								if (!(res_447974 <= HEX3Atmp_447971)) goto LA124;
								i_447926 = res_447974;
								{
									NIM_BOOL LOC127;
									LOC127 = 0;
									LOC127 = matches_447075(c, (*p).kindU.S6.sons->data[i_447926], (*n_447079).kindU.S6.sons->data[i_447926]);
									if (!!(LOC127)) goto LA128;
									goto BeforeRet;
								}
								LA128: ;
								res_447974 += ((NI) 1);
							} LA124: ;
						}
					}
					arglist = newnodei_226351(((NU8) 152), (*n_447079).info);
					result = bindorcheck_447413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA120: ;
				LA82: ;
			}
			LA80: ;
			{
				NI LOC132;
				LOC132 = 0;
				LOC132 = sonslen_227387(n_447079);
				if (!(plen == LOC132)) goto LA133;
				{
					NI i_447942;
					NI HEX3Atmp_447979;
					NI LOC136;
					NI res_447982;
					i_447942 = 0;
					HEX3Atmp_447979 = 0;
					LOC136 = 0;
					LOC136 = sonslen_227387(p);
					HEX3Atmp_447979 = (NI)(LOC136 - ((NI) 1));
					res_447982 = ((NI) 0);
					{
						while (1) {
							if (!(res_447982 <= HEX3Atmp_447979)) goto LA138;
							i_447942 = res_447982;
							{
								NIM_BOOL LOC141;
								LOC141 = 0;
								LOC141 = matches_447075(c, (*p).kindU.S6.sons->data[i_447942], (*n_447079).kindU.S6.sons->data[i_447942]);
								if (!!(LOC141)) goto LA142;
								goto BeforeRet;
							}
							LA142: ;
							res_447982 += ((NI) 1);
						} LA138: ;
					}
				}
				result = NIM_TRUE;
			}
			LA133: ;
		}
		break;
		}
	}
	goto LA1;
	LA67: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_448043)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_448069;
		NI HEX3Atmp_448081;
		NI LOC2;
		NI res_448084;
		j_448069 = 0;
		HEX3Atmp_448081 = 0;
		LOC2 = 0;
		LOC2 = len_225098(p);
		HEX3Atmp_448081 = (LOC2 - 1);
		res_448084 = ((NI) 0);
		{
			while (1) {
				if (!(res_448084 <= HEX3Atmp_448081)) goto LA4;
				j_448069 = res_448084;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_447075(c, (*p).kindU.S6.sons->data[j_448069], (*n).kindU.S6.sons->data[(NI)(i + j_448069)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI224803));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_448084 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode224809*, matchstmtlist_448037)(Tpatterncontext447013* c, Tnode224809* p, Tnode224809* n_448041) {
	Tnode224809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode224809* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_448041).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_225098(p);
		LOC8 = 0;
		LOC8 = len_225098(n_448041);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_253773(n_448041);
		{
			NI i_448121;
			NI HEX3Atmp_448129;
			NI LOC12;
			NI LOC13;
			NI res_448132;
			i_448121 = 0;
			HEX3Atmp_448129 = 0;
			LOC12 = 0;
			LOC12 = len_225098(n);
			LOC13 = 0;
			LOC13 = len_225098(p);
			HEX3Atmp_448129 = (NI)(LOC12 - LOC13);
			res_448132 = ((NI) 0);
			{
				while (1) {
					if (!(res_448132 <= HEX3Atmp_448129)) goto LA15;
					i_448121 = res_448132;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_448043(c, p, n, i_448121);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_226407(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_253785(((NU8) 115), n, ((NI) 0), (NI)(i_448121 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_225098(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_253785(((NU8) 115), n, i_448121, (NI)((NI)(i_448121 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_225098(p);
						LOC23 = 0;
						LOC23 = len_225098(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_253785(((NU8) 115), n, (NI)(i_448121 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_448132 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_447075(c, p, n_448041);
		if (!LOC25) goto LA26;
		result = n_448041;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_448163)(Tnode224809* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_225098(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_448187;
			NI HEX3Atmp_448201;
			NI LOC7;
			NI res_448204;
			i_448187 = 0;
			HEX3Atmp_448201 = 0;
			LOC7 = 0;
			LOC7 = len_225098(params);
			HEX3Atmp_448201 = (LOC7 - 1);
			res_448204 = ((NI) 1);
			{
				while (1) {
					Tsym224841* param;
					if (!(res_448204 <= HEX3Atmp_448201)) goto LA9;
					i_448187 = res_448204;
					param = (*(*params).kindU.S6.sons->data[i_448187]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_304080(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_448204 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_448223)(Tnode224809* result, Tnode224809* 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_225165(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_448277;
				NI HEX3Atmp_448281;
				NI LOC13;
				NI res_448284;
				i_448277 = 0;
				HEX3Atmp_448281 = 0;
				LOC13 = 0;
				LOC13 = len_225098(n);
				HEX3Atmp_448281 = (LOC13 - 1);
				res_448284 = ((NI) 0);
				{
					while (1) {
						if (!(res_448284 <= HEX3Atmp_448281)) goto LA15;
						i_448277 = res_448284;
						add_225165(result, (*n).kindU.S6.sons->data[i_448277]);
						res_448284 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode224809*, applyrule_448303)(Tcontext279023* c, Tsym224841* s, Tnode224809* n) {
	Tnode224809* result;
	Tpatterncontext447013 ctx;
	NI LOC1;
	Tnode224809* m;
	Tnode224809* LOC6;
	Tnode224809* params;
	NIM_BOOL requiresaa;
	Tnode224809* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_227351((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_448037((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_226351(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_226338(s, (*n).info);
	add_225165(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_448163(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_226351(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_448347;
		NI HEX3Atmp_448605;
		NI LOC12;
		NI res_448608;
		i_448347 = 0;
		HEX3Atmp_448605 = 0;
		LOC12 = 0;
		LOC12 = len_225098(params);
		HEX3Atmp_448605 = (LOC12 - 1);
		res_448608 = ((NI) 1);
		{
			while (1) {
				Tsym224841* param;
				Tnode224809* x;
				if (!(res_448608 <= HEX3Atmp_448605)) goto LA14;
				i_448347 = res_448608;
				param = (*(*params).kindU.S6.sons->data[i_448347]).kindU.S4.sym;
				x = getlazy_447025((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_225165(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_448223(args, x);
				}
				LA21: ;
				res_448608 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_448381;
			NI HEX3Atmp_448635;
			NI LOC28;
			NI res_448638;
			i_448381 = 0;
			HEX3Atmp_448635 = 0;
			LOC28 = 0;
			LOC28 = len_225098(params);
			HEX3Atmp_448635 = (LOC28 - 1);
			res_448638 = ((NI) 1);
			{
				while (1) {
					Tnode224809* rs;
					Tsym224841* param;
					NU8 LOC31;
					if (!(res_448638 <= HEX3Atmp_448635)) goto LA30;
					i_448381 = res_448638;
					rs = (*result).kindU.S6.sons->data[i_448381];
					param = (*(*params).kindU.S6.sons->data[i_448381]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_304080(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode224809* arg_448388;
							arg_448388 = 0;
							{
								NI i_448617;
								NI HEX3Atmp_448619;
								NI LOC36;
								NI res_448621;
								i_448617 = 0;
								HEX3Atmp_448619 = 0;
								LOC36 = 0;
								LOC36 = len_225098(args);
								HEX3Atmp_448619 = (LOC36 - 1);
								res_448621 = ((NI) 0);
								{
									while (1) {
										if (!(res_448621 <= HEX3Atmp_448619)) goto LA38;
										i_448617 = res_448621;
										arg_448388 = (*args).kindU.S6.sons->data[i_448617];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_448388 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_446375(rs, arg_448388);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_448621 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode224809* arg_448410;
							arg_448410 = 0;
							{
								NI i_448628;
								NI HEX3Atmp_448630;
								NI LOC53;
								NI res_448632;
								i_448628 = 0;
								HEX3Atmp_448630 = 0;
								LOC53 = 0;
								LOC53 = len_225098(args);
								HEX3Atmp_448630 = (LOC53 - 1);
								res_448632 = ((NI) 0);
								{
									while (1) {
										if (!(res_448632 <= HEX3Atmp_448630)) goto LA55;
										i_448628 = res_448632;
										arg_448410 = (*args).kindU.S6.sons->data[i_448628];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_448410 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_446375(rs, arg_448410);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_448632 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_448638 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_387253((*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* TMP3319[2];
static TNimNode TMP1025[3];
NTI447596.size = sizeof(TY447596);
NTI447596.kind = 18;
NTI447596.base = 0;
NTI447596.flags = 2;
TMP3319[0] = &TMP1025[1];
TMP1025[1].kind = 1;
TMP1025[1].offset = offsetof(TY447596, HEX3Astate);
TMP1025[1].typ = (&NTI345033);
TMP1025[1].name = ":state";
TMP3319[1] = &TMP1025[2];
TMP1025[2].kind = 1;
TMP1025[2].offset = offsetof(TY447596, p447485);
TMP1025[2].typ = (&NTI224801);
TMP1025[2].name = "p447485";
TMP1025[0].len = 2; TMP1025[0].kind = 2; TMP1025[0].sons = &TMP3319[0];
NTI447596.node = &TMP1025[0];
NTI447624.size = sizeof(TY447596*);
NTI447624.kind = 22;
NTI447624.base = (&NTI447596);
NTI447624.flags = 2;
NTI447624.marker = TMP3320;
}

