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

#include "nimbase.h"
#include <string.h>
typedef struct Tnode223809 Tnode223809;
typedef struct Tcontext278023 Tcontext278023;
typedef struct Tsym223841 Tsym223841;
typedef struct Tpatterncontext446013 Tpatterncontext446013;
typedef struct Tnodeseq223803 Tnodeseq223803;
typedef struct Ttype223847 Ttype223847;
typedef struct Tidobj196015 Tidobj196015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq223843 Ttypeseq223843;
typedef struct Tscope223835 Tscope223835;
typedef struct TY223944 TY223944;
typedef struct Tstrtable223813 Tstrtable223813;
typedef struct Tsymseq223811 Tsymseq223811;
typedef struct Tident196021 Tident196021;
typedef struct Tlineinfo188352 Tlineinfo188352;
typedef struct Tloc223823 Tloc223823;
typedef struct Ropeobj174009 Ropeobj174009;
typedef struct Tlib223827 Tlib223827;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell48947 Cell48947;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30891 Memregion30891;
typedef struct Smallchunk30843 Smallchunk30843;
typedef struct Llchunk30885 Llchunk30885;
typedef struct Bigchunk30845 Bigchunk30845;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30889 Avlnode30889;
typedef struct Gcstat51014 Gcstat51014;
typedef struct TY446596 TY446596;
typedef struct Tpasscontext275005 Tpasscontext275005;
typedef struct Tproccon278011 Tproccon278011;
typedef struct Intset220056 Intset220056;
typedef struct Trunk220052 Trunk220052;
typedef struct Trunkseq220054 Trunkseq220054;
typedef struct Tlinkedlist139028 Tlinkedlist139028;
typedef struct Tlistentry139022 Tlistentry139022;
typedef struct Tidtable223859 Tidtable223859;
typedef struct Tidpairseq223857 Tidpairseq223857;
typedef struct Tctx277048 Tctx277048;
typedef struct TY278143 TY278143;
typedef struct Tinstantiation223831 Tinstantiation223831;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct Tidpair223855 Tidpair223855;
typedef struct TY277254 TY277254;
typedef struct TY189417 TY189417;
typedef struct PprocHEX3Aobjecttype277233 PprocHEX3Aobjecttype277233;
typedef struct TY277273 TY277273;
typedef struct Tinstantiationpair278013 Tinstantiationpair278013;
typedef struct TY223932 TY223932;
typedef struct TY277234 TY277234;
typedef struct TY277239 TY277239;
typedef struct TY277274 TY277274;
typedef struct Vmargs277042 Vmargs277042;
typedef struct Tblock277030 Tblock277030;
typedef struct TY277214 TY277214;
struct  Tpatterncontext446013  {
Tsym223841* owner;
Tnodeseq223803* mapping;
NI formals;
Tcontext278023* 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  Tidobj196015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable223813  {
NI counter;
Tsymseq223811* data;
};
struct  Tlineinfo188352  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc223823  {
NU8 k;
NU8 s;
NU16 flags;
Ttype223847* t;
Ropeobj174009* r;
Ropeobj174009* heaproot;
};
struct  Tsym223841  {
  Tidobj196015 Sup;
NU8 kind;
union{
struct {Ttypeseq223843* typeinstcache;
Tscope223835* typscope;
} S1;
struct {TY223944* procinstcache;
Tsym223841* gcunsafetyreason;
} S2;
struct {TY223944* usedgenerics;
Tstrtable223813 tab;
} S3;
struct {Tsym223841* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype223847* typ;
Tident196021* name;
Tlineinfo188352 info;
Tsym223841* owner;
NU32 flags;
Tnode223809* ast;
NU32 options;
NI position;
NI offset;
Tloc223823 loc;
Tlib223827* annex;
Tnode223809* constraint;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode223809  {
Ttype223847* typ;
Tlineinfo188352 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym223841* sym;
} S4;
struct {Tident196021* ident;
} S5;
struct {Tnodeseq223803* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident196021  {
  Tidobj196015 Sup;
NimStringDesc* s;
Tident196021* next;
NI h;
};
struct  Ttype223847  {
  Tidobj196015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq223843* sons;
Tnode223809* n;
Tsym223841* owner;
Tsym223841* sym;
Tsym223841* destructor;
Tsym223841* deepcopy;
Tsym223841* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc223823 loc;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30843* TY30906[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30891  {
NI minlargeobj;
NI maxlargeobj;
TY30906 freesmallchunks;
Llchunk30885* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30845* freechunkslist;
Intset30817 chunkstarts;
Avlnode30889* root;
Avlnode30889* deleted;
Avlnode30889* last;
Avlnode30889* 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;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30891 region;
Gcstat51014 stat;
};
struct  TY446596  {
NI HEX3Astate;
Tnode223809* p446485;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY446490;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3322) (Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3323) (Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3324) (Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn);
struct  Tpasscontext275005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset220056  {
NI counter;
NI max;
Trunk220052* head;
Trunkseq220054* data;
};
struct  Tlinkedlist139028  {
Tlistentry139022* head;
Tlistentry139022* tail;
NI counter;
};
struct  Tidtable223859  {
NI counter;
Tidpairseq223857* data;
};
typedef N_NIMCALL_PTR(Tnode223809*, TY278074) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278079) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278087) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278095) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278100) (Tcontext278023* c, Tnode223809* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode223809*, TY278108) (Tcontext278023* c, Tnode223809* n);
typedef N_NIMCALL_PTR(Tnode223809*, TY278113) (Tcontext278023* c, Tnode223809* n, Tnode223809* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype223847*, TY278120) (Tcontext278023* c, Tnode223809* n, Ttype223847* prev);
typedef struct {
N_NIMCALL_PTR(Tnode223809*, ClPrc) (Tcontext278023* c, Tidtable223859 pt, Tnode223809* n, void* ClEnv);
void* ClEnv;
} TY278126;
typedef struct {
N_NIMCALL_PTR(Tsym223841*, ClPrc) (Tcontext278023* c, Tsym223841* fn, Tidtable223859 pt, Tlineinfo188352 info, void* ClEnv);
void* ClEnv;
} TY278132;
typedef N_NIMCALL_PTR(Tsym223841*, TY278148) (Tcontext278023* c, Tsym223841* dc, Ttype223847* t, Tlineinfo188352 info, NU8 op);
struct  Tcontext278023  {
  Tpasscontext275005 Sup;
Tsym223841* module;
Tscope223835* currentscope;
Tscope223835* importtable;
Tscope223835* toplevelscope;
Tproccon278011* p;
Tsymseq223811* friendmodules;
NI instcounter;
Intset220056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI compilescontextid;
NI compilescontextidgenerator;
NI ingenericinst;
Tsymseq223811* converters;
Tsymseq223811* patterns;
Tlinkedlist139028 optionstack;
Tidtable223859 symmapping;
Tlinkedlist139028 libs;
TY278074 semconstexpr;
TY278079 semexpr;
TY278087 semtryexpr;
TY278095 semtryconstexpr;
TY278100 semoperand;
TY278108 semconstboolexpr;
TY278113 semoverloadedcall;
TY278120 semtypenode;
TY278126 seminferredlambda;
TY278132 semgenerateinstance;
Intset220056 includedfiles;
Tstrtable223813 userpragmas;
Tctx277048* evalcontext;
Intset220056 unknownidents;
TY278143* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY278148 insttypeboundop;
};
struct  Tscope223835  {
NI depthlevel;
Tstrtable223813 symbols;
Tnodeseq223803* usingsyms;
Tscope223835* parent;
};
struct  Ropeobj174009  {
  TNimObject Sup;
Ropeobj174009* left;
Ropeobj174009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry139022  {
  TNimObject Sup;
Tlistentry139022* prev;
Tlistentry139022* next;
};
struct  Tlib223827  {
  Tlistentry139022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj174009* name;
Tnode223809* path;
};
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30822[8];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30822 bits;
};
struct  Basechunk30841  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30843  {
  Basechunk30841 Sup;
Smallchunk30843* next;
Smallchunk30843* prev;
Freecell30833* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30885  {
NI size;
NI acc;
Llchunk30885* next;
};
struct  Bigchunk30845  {
  Basechunk30841 Sup;
Bigchunk30845* next;
Bigchunk30845* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30822 bits;
};
typedef Avlnode30889* TY30896[2];
struct  Avlnode30889  {
TY30896 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon278011  {
Tsym223841* owner;
Tsym223841* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon278011* next;
NIM_BOOL wasforwarded;
Tnode223809* bracketexpr;
};
struct  Trunk220052  {
Trunk220052* next;
NI key;
TY30822 bits;
};
struct  Tidpair223855  {
Tidobj196015* key;
TNimObject* val;
};
struct  Tctx277048  {
  Tpasscontext275005 Sup;
TY277254* code;
TY189417* debug;
Tnode223809* globals;
Tnode223809* constants;
Ttypeseq223843* types;
Tnode223809* currentexceptiona;
Tnode223809* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype277233* prc;
Tsym223841* module;
Tnode223809* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo188352 comesfromheuristic;
TY277273* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair278013  {
Tsym223841* genericsym;
Tinstantiation223831* inst;
};
struct  Tinstantiation223831  {
Tsym223841* sym;
Ttypeseq223843* concretetypes;
TY223932* usedby;
NI compilesid;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct TY277239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY277239 TY277242[256];
struct  PprocHEX3Aobjecttype277233  {
TY277234* blocks;
Tsym223841* sym;
TY277242 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs277042* args, void* ClEnv);
void* ClEnv;
} Vmcallback277044;
struct TY277274 {
NimStringDesc* Field0;
Vmcallback277044 Field1;
};
struct  Tblock277030  {
Tsym223841* label;
TY277214* fixups;
};
struct  Vmargs277042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode223809* currentexception;
};
struct Tnodeseq223803 {
  TGenericSeq Sup;
  Tnode223809* data[SEQ_DECL_SIZE];
};
struct Ttypeseq223843 {
  TGenericSeq Sup;
  Ttype223847* data[SEQ_DECL_SIZE];
};
struct TY223944 {
  TGenericSeq Sup;
  Tinstantiation223831* data[SEQ_DECL_SIZE];
};
struct Tsymseq223811 {
  TGenericSeq Sup;
  Tsym223841* data[SEQ_DECL_SIZE];
};
struct Trunkseq220054 {
  TGenericSeq Sup;
  Trunk220052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq223857 {
  TGenericSeq Sup;
  Tidpair223855 data[SEQ_DECL_SIZE];
};
struct TY278143 {
  TGenericSeq Sup;
  Tinstantiationpair278013 data[SEQ_DECL_SIZE];
};
struct TY277254 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY189417 {
  TGenericSeq Sup;
  Tlineinfo188352 data[SEQ_DECL_SIZE];
};
struct TY277273 {
  TGenericSeq Sup;
  TY277274 data[SEQ_DECL_SIZE];
};
struct TY223932 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY277234 {
  TGenericSeq Sup;
  Tblock277030 data[SEQ_DECL_SIZE];
};
struct TY277214 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_226351)(Ttype223847* n);
N_NIMCALL(Tnode223809*, matchstmtlist_447037)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n_447041);
static N_INLINE(NI, len_224098)(Tnode223809* n);
N_NIMCALL(Tnode223809*, flattenstmts_252773)(Tnode223809* n);
N_NIMCALL(NIM_BOOL, matchrange_447043)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n, NI i);
N_NIMCALL(NIM_BOOL, matches_446075)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n_446079);
static N_INLINE(NIM_BOOL, ispatternparam_446320)(Tpatterncontext446013* c, Tnode223809* p);
N_NIMCALL(NIM_BOOL, bindorcheck_446413)(Tpatterncontext446013* c, Tsym223841* param, Tnode223809* n);
N_NIMCALL(Tnode223809*, getlazy_446025)(Tpatterncontext446013* c, Tsym223841* sym);
N_NIMCALL(NIM_BOOL, sametrees_446124)(Tnode223809* a, Tnode223809* b);
static N_INLINE(NIM_BOOL, samekinds_446093)(Tnode223809* a, Tnode223809* b);
N_NIMCALL(NU8, canonkind_446083)(Tnode223809* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_258108)(Ttype223847* a, Ttype223847* b, NU8 flags);
N_NIMCALL(NI, sonslen_226387)(Tnode223809* n);
N_NIMCALL(NIM_BOOL, checktypes_446273)(Tpatterncontext446013* c, Tsym223841* p, Tnode223809* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_304302)(Tnode223809* p, Tnode223809* n);
N_NIMCALL(NIM_BOOL, argtypematches_392817)(Tcontext278023* c, Ttype223847* f, Ttype223847* a);
N_NIMCALL(void, putlazy_446045)(Tpatterncontext446013* c, Tsym223841* sym, Tnode223809* 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(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(NIM_BOOL, insymchoice_446188)(Tnode223809* sc, Tnode223809* x);
N_NIMCALL(NIM_BOOL, matchchoice_446363)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n);
N_NIMCALL(NIM_BOOL, matchnested_446482)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3321)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode223809*, newnodei_225351)(NU8 kind, Tlineinfo188352 info);
N_CLOSURE(NIM_BOOL, matchstaraux_446489)(Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode223809*, HEX5BHEX5D_224244)(Tnode223809* n, NI i);
N_NIMCALL(void, add_224165)(Tnode223809* father, Tnode223809* son);
N_NIMCALL(void, internalerror_194172)(Tlineinfo188352 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_446447)(Tpatterncontext446013* c, Tsym223841* param, Tnode223809* n);
N_NIMCALL(Tnode223809*, newnodei_225407)(NU8 kind, Tlineinfo188352 info, NI children);
N_NIMCALL(Tnode223809*, lastson_226406)(Tnode223809* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_85804, TNimType* mt);
N_NIMCALL(Tnode223809*, extractrange_252785)(NU8 k, Tnode223809* n, NI a, NI b);
N_NIMCALL(Tnode223809*, newsymnode_225338)(Tsym223841* sym, Tlineinfo188352 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_447163)(Tnode223809* params);
N_NIMCALL(NU8, whichalias_303080)(Tsym223841* p);
N_NIMCALL(void, addtoarglist_447223)(Tnode223809* result, Tnode223809* n);
N_NIMCALL(NU8, ispartof_445375)(Tnode223809* a, Tnode223809* b);
N_NIMCALL(void, markused_386253)(Tlineinfo188352 info, Tsym223841* s);
STRING_LITERAL(TMP3316, "|", 1);
STRING_LITERAL(TMP3317, "*", 1);
STRING_LITERAL(TMP3318, "**", 2);
STRING_LITERAL(TMP3319, "~", 1);
STRING_LITERAL(TMP3325, "invalid pattern", 15);
extern TNimType NTI223803; /* TNodeSeq */
extern Gcheap51018 gch_51059;
TNimType NTI446596; /* object */
extern TNimType NTI344033; /* range -1..0(int) */
extern TNimType NTI223801; /* PNode */
TNimType NTI446624; /* ref object */

static N_INLINE(NI, len_224098)(Tnode223809* 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_446320)(Tpatterncontext446013* c, Tnode223809* 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(Tnode223809*, getlazy_446025)(Tpatterncontext446013* c, Tsym223841* sym) {
	Tnode223809* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_446083)(Tnode223809* 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_446093)(Tnode223809* a, Tnode223809* 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_446083(a);
	LOC4 = 0;
	LOC4 = canonkind_446083(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_446124)(Tnode223809* a, Tnode223809* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_446093(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_258108((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_226387(a);
				LOC17 = 0;
				LOC17 = sonslen_226387(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_446162;
					NI HEX3Atmp_446166;
					NI LOC21;
					NI res_446169;
					i_446162 = 0;
					HEX3Atmp_446166 = 0;
					LOC21 = 0;
					LOC21 = sonslen_226387(a);
					HEX3Atmp_446166 = (NI)(LOC21 - ((NI) 1));
					res_446169 = ((NI) 0);
					{
						while (1) {
							if (!(res_446169 <= HEX3Atmp_446166)) goto LA23;
							i_446162 = res_446169;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_446124((*a).kindU.S6.sons->data[i_446162], (*b).kindU.S6.sons->data[i_446162]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_446169 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_446273)(Tpatterncontext446013* c, Tsym223841* p, Tnode223809* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_304302((*p).constraint, n);
		{
			if (!!(result)) goto LA7;
			goto BeforeRet;
		}
		LA7: ;
	}
	LA3: ;
	{
		if (!(*n).typ == 0) goto LA11;
		result = ((136 &(IL64(1)<<(((*(*p).typ).kind)&IL64(63))))!=0);
	}
	goto LA9;
	LA11: ;
	{
		result = argtypematches_392817((*c).c, (*p).typ, (*n).typ);
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

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

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

N_NIMCALL(void, putlazy_446045)(Tpatterncontext446013* c, Tsym223841* sym, Tnode223809* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq223803*) newSeq((&NTI223803), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_446413)(Tpatterncontext446013* c, Tsym223841* param, Tnode223809* n) {
	NIM_BOOL result;
	Tnode223809* pp;
	result = 0;
	pp = getlazy_446025(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_446124(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_446273(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_446045(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_446188)(Tnode223809* sc, Tnode223809* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_446221;
			NI HEX3Atmp_446251;
			NI LOC6;
			NI res_446254;
			i_446221 = 0;
			HEX3Atmp_446251 = 0;
			LOC6 = 0;
			LOC6 = len_224098(sc);
			HEX3Atmp_446251 = (LOC6 - 1);
			res_446254 = ((NI) 0);
			{
				while (1) {
					if (!(res_446254 <= HEX3Atmp_446251)) goto LA8;
					i_446221 = res_446254;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_446221]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_446254 += ((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_446363)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_446388;
		NI HEX3Atmp_446391;
		NI LOC2;
		NI res_446394;
		i_446388 = 0;
		HEX3Atmp_446391 = 0;
		LOC2 = 0;
		LOC2 = len_224098(p);
		HEX3Atmp_446391 = (LOC2 - 1);
		res_446394 = ((NI) 1);
		{
			while (1) {
				if (!(res_446394 <= HEX3Atmp_446391)) goto LA4;
				i_446388 = res_446394;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_446075(c, (*p).kindU.S6.sons->data[i_446388], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_446394 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3321)(void* p, NI op) {
	TY446596* a;
	a = (TY446596*)p;
	nimGCvisit((void*)(*a).p446485, op);
}

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

N_CLOSURE(NIM_BOOL, matchstaraux_446489)(Tpatterncontext446013* c, Tnode223809* op, Tnode223809* n_446493, Tnode223809* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY446596* HEX3Aenvp_446620;
{	result = 0;
	HEX3Aenvp_446620 = (TY446596*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_446493).kind == ((NU8) 27) || (*n_446493).kind == ((NU8) 29) || (*n_446493).kind == ((NU8) 30) || (*n_446493).kind == ((NU8) 31) || (*n_446493).kind == ((NU8) 26) || (*n_446493).kind == ((NU8) 28) || (*n_446493).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_446075(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_446493).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_446519;
			NI HEX3Atmp_446566;
			NI LOC8;
			NI res_446569;
			i_446519 = 0;
			HEX3Atmp_446566 = 0;
			LOC8 = 0;
			LOC8 = sonslen_226387(n_446493);
			HEX3Atmp_446566 = (NI)(LOC8 - ((NI) 1));
			res_446569 = ((NI) 1);
			{
				while (1) {
					if (!(res_446569 <= HEX3Atmp_446566)) goto LA10;
					i_446519 = res_446569;
					{
						TY446490 LOC13;
						Tnode223809* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_446489; LOC13.ClEnv = HEX3Aenvp_446620;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_224244(n_446493, i_446519);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3322)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_446569 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_224165(arglist, (*n_446493).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode223809* n;
		LOC23 = 0;
		LOC23 = ((*n_446493).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_446493).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_446493).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_446562;
			NI HEX3Atmp_446574;
			NI LOC28;
			NI res_446577;
			i_446562 = 0;
			HEX3Atmp_446574 = 0;
			LOC28 = 0;
			LOC28 = len_224098(n);
			HEX3Atmp_446574 = (LOC28 - 1);
			res_446577 = ((NI) 0);
			{
				while (1) {
					if (!(res_446577 <= HEX3Atmp_446574)) goto LA30;
					i_446562 = res_446577;
					{
						TY446490 LOC33;
						Tnode223809* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_446489; LOC33.ClEnv = HEX3Aenvp_446620;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_224244(n, i_446562);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3323)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_446577 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_446273(c, (*(*(*HEX3Aenvp_446620).p446485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_446493);
		if (!LOC39) goto LA40;
		add_224165(arglist, n_446493);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_446482)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY446596* HEX3Aenv_446623;
{	result = 0;
	HEX3Aenv_446623 = 0;
	HEX3Aenv_446623 = (TY446596*) newObj((&NTI446624), sizeof(TY446596));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_446623).p446485), 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;
		Tnode223809* arglist;
		LOC7 = 0;
		LOC7 = matches_446075(c, (*(*HEX3Aenv_446623).p446485).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_225351(((NU8) 152), (*n).info);
		{
			TY446490 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_446489; LOC12.ClEnv = HEX3Aenv_446623;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_446623).p446485, n, arglist, rpn, LOC12.ClEnv):((TMP3324)(LOC12.ClPrc))(c, (*HEX3Aenv_446623).p446485, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_446413(c, (*(*(*HEX3Aenv_446623).p446485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_446447)(Tpatterncontext446013* c, Tsym223841* param, Tnode223809* n) {
	Tnode223809* pp;
	pp = getlazy_446025(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_224165(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_225407(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_446045(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_446075)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n_446079) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!(((*n_446079).flags &(1<<((((NU8) 6))&15)))!=0)) goto LA3;
		result = NIM_FALSE;
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ispatternparam_446320(c, p);
		if (!LOC6) goto LA7;
		result = bindorcheck_446413(c, (*p).kindU.S4.sym, n_446079);
	}
	goto LA1;
	LA7: ;
	{
		NIM_BOOL LOC10;
		LOC10 = 0;
		LOC10 = ((*n_446079).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_446079).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA12: ;
	{
		NIM_BOOL LOC15;
		LOC15 = 0;
		LOC15 = ((*n_446079).kind == ((NU8) 3));
		if (!(LOC15)) goto LA16;
		LOC15 = insymchoice_446188(p, n_446079);
		LA16: ;
		if (!LOC15) goto LA17;
		result = NIM_TRUE;
	}
	goto LA1;
	LA17: ;
	{
		NIM_BOOL LOC20;
		LOC20 = 0;
		LOC20 = ((*n_446079).kind == ((NU8) 3));
		if (!(LOC20)) goto LA21;
		LOC20 = ((*(*n_446079).kindU.S4.sym).kind == ((NU8) 10));
		LA21: ;
		if (!LOC20) goto LA22;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA26;
			result = ((*p).kindU.S4.sym == (*n_446079).kindU.S4.sym);
		}
		goto LA24;
		LA26: ;
		{
			NIM_BOOL LOC29;
			LOC29 = 0;
			LOC29 = matches_446075(c, p, (*(*n_446079).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*) &TMP3316))) goto LA35;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3317))) goto LA36;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3318))) goto LA37;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3319))) goto LA38;
		goto LA39;
		LA35: ;
		{
			result = matchchoice_446363(c, p, n_446079);
		}
		goto LA40;
		LA36: ;
		{
			result = matchnested_446482(c, p, n_446079, NIM_FALSE);
		}
		goto LA40;
		LA37: ;
		{
			result = matchnested_446482(c, p, n_446079, NIM_TRUE);
		}
		goto LA40;
		LA38: ;
		{
			NIM_BOOL LOC45;
			LOC45 = 0;
			LOC45 = matches_446075(c, (*p).kindU.S6.sons->data[((NI) 1)], n_446079);
			result = !(LOC45);
		}
		goto LA40;
		LA39: ;
		{
			internalerror_194172((*p).info, ((NimStringDesc*) &TMP3325));
		}
		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_446075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_446079);
				if (!LOC56) goto LA57;
				gather_446447(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_446079);
				result = NIM_TRUE;
			}
			LA57: ;
		}
		goto LA50;
		LA52: ;
		{
			{
				NIM_BOOL LOC62;
				LOC62 = 0;
				LOC62 = matches_446075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_446079);
				if (!LOC62) goto LA63;
				result = bindorcheck_446413(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_446079);
			}
			LA63: ;
		}
		LA50: ;
	}
	goto LA1;
	LA48: ;
	{
		NIM_BOOL LOC66;
		LOC66 = 0;
		LOC66 = samekinds_446093(p, n_446079);
		if (!LOC66) goto LA67;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_446079).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_446079).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_446079).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_446079).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_446079).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode223809* v;
			plen = sonslen_226387(p);
			v = lastson_226406(p);
			{
				NIM_BOOL LOC78;
				Tnode223809* arglist;
				LOC78 = 0;
				LOC78 = ispatternparam_446320(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_226387(n_446079);
					if (!(plen <= LOC84)) goto LA85;
					{
						NI i_446851;
						NI HEX3Atmp_446947;
						NI res_446950;
						i_446851 = 0;
						HEX3Atmp_446947 = 0;
						HEX3Atmp_446947 = (NI)(plen - ((NI) 2));
						res_446950 = ((NI) 0);
						{
							while (1) {
								if (!(res_446950 <= HEX3Atmp_446947)) goto LA89;
								i_446851 = res_446950;
								{
									NIM_BOOL LOC92;
									LOC92 = 0;
									LOC92 = matches_446075(c, (*p).kindU.S6.sons->data[i_446851], (*n_446079).kindU.S6.sons->data[i_446851]);
									if (!!(LOC92)) goto LA93;
									goto BeforeRet;
								}
								LA93: ;
								res_446950 += ((NI) 1);
							} LA89: ;
						}
					}
					{
						NIM_BOOL LOC97;
						NIM_BOOL LOC98;
						NI LOC99;
						Tnode223809* LOC101;
						Tnode223809* LOC103;
						Tnode223809* n;
						Tnode223809* LOC106;
						NI LOC107;
						LOC97 = 0;
						LOC98 = 0;
						LOC99 = 0;
						LOC99 = sonslen_226387(n_446079);
						LOC98 = (plen == LOC99);
						if (!(LOC98)) goto LA100;
						LOC101 = 0;
						LOC101 = lastson_226406(n_446079);
						LOC98 = ((*LOC101).kind == ((NU8) 58));
						LA100: ;
						LOC97 = LOC98;
						if (!(LOC97)) goto LA102;
						LOC103 = 0;
						LOC103 = lastson_226406(n_446079);
						LOC97 = ((*(*LOC103).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA102: ;
						if (!LOC97) goto LA104;
						LOC106 = 0;
						LOC106 = lastson_226406(n_446079);
						n = (*LOC106).kindU.S6.sons->data[((NI) 1)];
						LOC107 = 0;
						LOC107 = len_224098(n);
						arglist = newnodei_225407(((NU8) 152), (*n).info, LOC107);
						{
							NI i_446895;
							NI HEX3Atmp_446955;
							NI LOC109;
							NI res_446958;
							i_446895 = 0;
							HEX3Atmp_446955 = 0;
							LOC109 = 0;
							LOC109 = len_224098(n);
							HEX3Atmp_446955 = (LOC109 - 1);
							res_446958 = ((NI) 0);
							{
								while (1) {
									if (!(res_446958 <= HEX3Atmp_446955)) goto LA111;
									i_446895 = res_446958;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_446895]), (*n).kindU.S6.sons->data[i_446895]);
									res_446958 += ((NI) 1);
								} LA111: ;
							}
						}
					}
					goto LA95;
					LA104: ;
					{
						NI LOC113;
						LOC113 = 0;
						LOC113 = sonslen_226387(n_446079);
						arglist = newnodei_225407(((NU8) 152), (*n_446079).info, (NI)((NI)(LOC113 - plen) + ((NI) 1)));
						{
							NI i_446910;
							NI HEX3Atmp_446963;
							NI LOC115;
							NI res_446966;
							i_446910 = 0;
							HEX3Atmp_446963 = 0;
							LOC115 = 0;
							LOC115 = sonslen_226387(n_446079);
							HEX3Atmp_446963 = (NI)(LOC115 - plen);
							res_446966 = ((NI) 0);
							{
								while (1) {
									if (!(res_446966 <= HEX3Atmp_446963)) goto LA117;
									i_446910 = res_446966;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_446910]), (*n_446079).kindU.S6.sons->data[(NI)((NI)(i_446910 + plen) - ((NI) 1))]);
									res_446966 += ((NI) 1);
								} LA117: ;
							}
						}
					}
					LA95: ;
					result = bindorcheck_446413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA85: ;
				{
					NI LOC119;
					LOC119 = 0;
					LOC119 = sonslen_226387(n_446079);
					if (!((NI)(plen - ((NI) 1)) == LOC119)) goto LA120;
					{
						NI i_446926;
						NI HEX3Atmp_446971;
						NI res_446974;
						i_446926 = 0;
						HEX3Atmp_446971 = 0;
						HEX3Atmp_446971 = (NI)(plen - ((NI) 2));
						res_446974 = ((NI) 0);
						{
							while (1) {
								if (!(res_446974 <= HEX3Atmp_446971)) goto LA124;
								i_446926 = res_446974;
								{
									NIM_BOOL LOC127;
									LOC127 = 0;
									LOC127 = matches_446075(c, (*p).kindU.S6.sons->data[i_446926], (*n_446079).kindU.S6.sons->data[i_446926]);
									if (!!(LOC127)) goto LA128;
									goto BeforeRet;
								}
								LA128: ;
								res_446974 += ((NI) 1);
							} LA124: ;
						}
					}
					arglist = newnodei_225351(((NU8) 152), (*n_446079).info);
					result = bindorcheck_446413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA82;
				LA120: ;
				LA82: ;
			}
			LA80: ;
			{
				NI LOC132;
				LOC132 = 0;
				LOC132 = sonslen_226387(n_446079);
				if (!(plen == LOC132)) goto LA133;
				{
					NI i_446942;
					NI HEX3Atmp_446979;
					NI LOC136;
					NI res_446982;
					i_446942 = 0;
					HEX3Atmp_446979 = 0;
					LOC136 = 0;
					LOC136 = sonslen_226387(p);
					HEX3Atmp_446979 = (NI)(LOC136 - ((NI) 1));
					res_446982 = ((NI) 0);
					{
						while (1) {
							if (!(res_446982 <= HEX3Atmp_446979)) goto LA138;
							i_446942 = res_446982;
							{
								NIM_BOOL LOC141;
								LOC141 = 0;
								LOC141 = matches_446075(c, (*p).kindU.S6.sons->data[i_446942], (*n_446079).kindU.S6.sons->data[i_446942]);
								if (!!(LOC141)) goto LA142;
								goto BeforeRet;
							}
							LA142: ;
							res_446982 += ((NI) 1);
						} LA138: ;
					}
				}
				result = NIM_TRUE;
			}
			LA133: ;
		}
		break;
		}
	}
	goto LA1;
	LA67: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_447043)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_447069;
		NI HEX3Atmp_447081;
		NI LOC2;
		NI res_447084;
		j_447069 = 0;
		HEX3Atmp_447081 = 0;
		LOC2 = 0;
		LOC2 = len_224098(p);
		HEX3Atmp_447081 = (LOC2 - 1);
		res_447084 = ((NI) 0);
		{
			while (1) {
				if (!(res_447084 <= HEX3Atmp_447081)) goto LA4;
				j_447069 = res_447084;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_446075(c, (*p).kindU.S6.sons->data[j_447069], (*n).kindU.S6.sons->data[(NI)(i + j_447069)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI223803));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_447084 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode223809*, matchstmtlist_447037)(Tpatterncontext446013* c, Tnode223809* p, Tnode223809* n_447041) {
	Tnode223809* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode223809* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_447041).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_224098(p);
		LOC8 = 0;
		LOC8 = len_224098(n_447041);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_252773(n_447041);
		{
			NI i_447121;
			NI HEX3Atmp_447129;
			NI LOC12;
			NI LOC13;
			NI res_447132;
			i_447121 = 0;
			HEX3Atmp_447129 = 0;
			LOC12 = 0;
			LOC12 = len_224098(n);
			LOC13 = 0;
			LOC13 = len_224098(p);
			HEX3Atmp_447129 = (NI)(LOC12 - LOC13);
			res_447132 = ((NI) 0);
			{
				while (1) {
					if (!(res_447132 <= HEX3Atmp_447129)) goto LA15;
					i_447121 = res_447132;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_447043(c, p, n, i_447121);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_225407(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_252785(((NU8) 115), n, ((NI) 0), (NI)(i_447121 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_224098(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_252785(((NU8) 115), n, i_447121, (NI)((NI)(i_447121 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_224098(p);
						LOC23 = 0;
						LOC23 = len_224098(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_252785(((NU8) 115), n, (NI)(i_447121 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_447132 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_446075(c, p, n_447041);
		if (!LOC25) goto LA26;
		result = n_447041;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_447163)(Tnode223809* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_224098(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_447187;
			NI HEX3Atmp_447201;
			NI LOC7;
			NI res_447204;
			i_447187 = 0;
			HEX3Atmp_447201 = 0;
			LOC7 = 0;
			LOC7 = len_224098(params);
			HEX3Atmp_447201 = (LOC7 - 1);
			res_447204 = ((NI) 1);
			{
				while (1) {
					Tsym223841* param;
					if (!(res_447204 <= HEX3Atmp_447201)) goto LA9;
					i_447187 = res_447204;
					param = (*(*params).kindU.S6.sons->data[i_447187]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_303080(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_447204 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_447223)(Tnode223809* result, Tnode223809* 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_224165(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_447277;
				NI HEX3Atmp_447281;
				NI LOC13;
				NI res_447284;
				i_447277 = 0;
				HEX3Atmp_447281 = 0;
				LOC13 = 0;
				LOC13 = len_224098(n);
				HEX3Atmp_447281 = (LOC13 - 1);
				res_447284 = ((NI) 0);
				{
					while (1) {
						if (!(res_447284 <= HEX3Atmp_447281)) goto LA15;
						i_447277 = res_447284;
						add_224165(result, (*n).kindU.S6.sons->data[i_447277]);
						res_447284 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode223809*, applyrule_447303)(Tcontext278023* c, Tsym223841* s, Tnode223809* n) {
	Tnode223809* result;
	Tpatterncontext446013 ctx;
	NI LOC1;
	Tnode223809* m;
	Tnode223809* LOC6;
	Tnode223809* params;
	NIM_BOOL requiresaa;
	Tnode223809* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_226351((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_447037((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_225351(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_225338(s, (*n).info);
	add_224165(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_447163(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_225351(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_447347;
		NI HEX3Atmp_447605;
		NI LOC12;
		NI res_447608;
		i_447347 = 0;
		HEX3Atmp_447605 = 0;
		LOC12 = 0;
		LOC12 = len_224098(params);
		HEX3Atmp_447605 = (LOC12 - 1);
		res_447608 = ((NI) 1);
		{
			while (1) {
				Tsym223841* param;
				Tnode223809* x;
				if (!(res_447608 <= HEX3Atmp_447605)) goto LA14;
				i_447347 = res_447608;
				param = (*(*params).kindU.S6.sons->data[i_447347]).kindU.S4.sym;
				x = getlazy_446025((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_224165(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_447223(args, x);
				}
				LA21: ;
				res_447608 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_447381;
			NI HEX3Atmp_447635;
			NI LOC28;
			NI res_447638;
			i_447381 = 0;
			HEX3Atmp_447635 = 0;
			LOC28 = 0;
			LOC28 = len_224098(params);
			HEX3Atmp_447635 = (LOC28 - 1);
			res_447638 = ((NI) 1);
			{
				while (1) {
					Tnode223809* rs;
					Tsym223841* param;
					NU8 LOC31;
					if (!(res_447638 <= HEX3Atmp_447635)) goto LA30;
					i_447381 = res_447638;
					rs = (*result).kindU.S6.sons->data[i_447381];
					param = (*(*params).kindU.S6.sons->data[i_447381]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_303080(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode223809* arg_447388;
							arg_447388 = 0;
							{
								NI i_447617;
								NI HEX3Atmp_447619;
								NI LOC36;
								NI res_447621;
								i_447617 = 0;
								HEX3Atmp_447619 = 0;
								LOC36 = 0;
								LOC36 = len_224098(args);
								HEX3Atmp_447619 = (LOC36 - 1);
								res_447621 = ((NI) 0);
								{
									while (1) {
										if (!(res_447621 <= HEX3Atmp_447619)) goto LA38;
										i_447617 = res_447621;
										arg_447388 = (*args).kindU.S6.sons->data[i_447617];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_447388 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_445375(rs, arg_447388);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_447621 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode223809* arg_447410;
							arg_447410 = 0;
							{
								NI i_447628;
								NI HEX3Atmp_447630;
								NI LOC53;
								NI res_447632;
								i_447628 = 0;
								HEX3Atmp_447630 = 0;
								LOC53 = 0;
								LOC53 = len_224098(args);
								HEX3Atmp_447630 = (LOC53 - 1);
								res_447632 = ((NI) 0);
								{
									while (1) {
										if (!(res_447632 <= HEX3Atmp_447630)) goto LA55;
										i_447628 = res_447632;
										arg_447410 = (*args).kindU.S6.sons->data[i_447628];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_447410 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_445375(rs, arg_447410);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_447632 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_447638 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_386253((*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* TMP3320[2];
static TNimNode TMP1025[3];
NTI446596.size = sizeof(TY446596);
NTI446596.kind = 18;
NTI446596.base = 0;
NTI446596.flags = 2;
TMP3320[0] = &TMP1025[1];
TMP1025[1].kind = 1;
TMP1025[1].offset = offsetof(TY446596, HEX3Astate);
TMP1025[1].typ = (&NTI344033);
TMP1025[1].name = ":state";
TMP3320[1] = &TMP1025[2];
TMP1025[2].kind = 1;
TMP1025[2].offset = offsetof(TY446596, p446485);
TMP1025[2].typ = (&NTI223801);
TMP1025[2].name = "p446485";
TMP1025[0].len = 2; TMP1025[0].kind = 2; TMP1025[0].sons = &TMP3320[0];
NTI446596.node = &TMP1025[0];
NTI446624.size = sizeof(TY446596*);
NTI446624.kind = 22;
NTI446624.base = (&NTI446596);
NTI446624.flags = 2;
NTI446624.marker = TMP3321;
}

