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

#include <string.h>
typedef struct Tnode190813 Tnode190813;
typedef struct Tcontext244023 Tcontext244023;
typedef struct Tsym190843 Tsym190843;
typedef struct Tpatterncontext400013 Tpatterncontext400013;
typedef struct Tnodeseq190807 Tnodeseq190807;
typedef struct Ttype190849 Ttype190849;
typedef struct Tidobj167015 Tidobj167015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq190845 Ttypeseq190845;
typedef struct Tscope190837 Tscope190837;
typedef struct TY190944 TY190944;
typedef struct Tstrtable190817 Tstrtable190817;
typedef struct Tsymseq190815 Tsymseq190815;
typedef struct Tident167021 Tident167021;
typedef struct Tlineinfo163338 Tlineinfo163338;
typedef struct Tloc190827 Tloc190827;
typedef struct Ropeobj161009 Ropeobj161009;
typedef struct Tlib190831 Tlib190831;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tcell46346 Tcell46346;
typedef struct Tcellseq46362 Tcellseq46362;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46358 Tcellset46358;
typedef struct Tpagedesc46354 Tpagedesc46354;
typedef struct Tmemregion28210 Tmemregion28210;
typedef struct Tsmallchunk27440 Tsmallchunk27440;
typedef struct Tllchunk28204 Tllchunk28204;
typedef struct Tbigchunk27442 Tbigchunk27442;
typedef struct Tintset27417 Tintset27417;
typedef struct Ttrunk27413 Ttrunk27413;
typedef struct Tavlnode28208 Tavlnode28208;
typedef struct Tgcstat48214 Tgcstat48214;
typedef struct TY400596 TY400596;
typedef struct Tpasscontext241005 Tpasscontext241005;
typedef struct Tproccon244011 Tproccon244011;
typedef struct Intset187056 Intset187056;
typedef struct Ttrunk187052 Ttrunk187052;
typedef struct Ttrunkseq187054 Ttrunkseq187054;
typedef struct Tlinkedlist130028 Tlinkedlist130028;
typedef struct Tlistentry130022 Tlistentry130022;
typedef struct Tidtable190861 Tidtable190861;
typedef struct Tidpairseq190859 Tidpairseq190859;
typedef struct Tctx243048 Tctx243048;
typedef struct TY244141 TY244141;
typedef struct Tinstantiation190833 Tinstantiation190833;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Tidpair190857 Tidpair190857;
typedef struct TY243253 TY243253;
typedef struct TY164036 TY164036;
typedef struct PprocHEX3Aobjecttype243232 PprocHEX3Aobjecttype243232;
typedef struct TY243272 TY243272;
typedef struct Tinstantiationpair244013 Tinstantiationpair244013;
typedef struct TY190933 TY190933;
typedef struct TY243233 TY243233;
typedef struct TY243239 TY243239;
typedef struct TY243273 TY243273;
typedef struct Vmargs243042 Vmargs243042;
typedef struct Tblock243030 Tblock243030;
typedef struct TY243213 TY243213;
struct  Tpatterncontext400013  {
Tsym190843* owner;
Tnodeseq190807* mapping;
NI formals;
Tcontext244023* c;
NIM_BOOL submatch;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj167015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable190817  {
NI counter;
Tsymseq190815* data;
};
struct  Tlineinfo163338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tloc190827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype190849* t;
Ropeobj161009* r;
Ropeobj161009* heaproot;
};
struct  Tsym190843  {
  Tidobj167015 Sup;
NU8 kind;
union{
struct {Ttypeseq190845* typeinstcache;
Tscope190837* typscope;
} S1;
struct {TY190944* procinstcache;
Tsym190843* gcunsafetyreason;
} S2;
struct {TY190944* usedgenerics;
Tstrtable190817 tab;
} S3;
struct {Tsym190843* guard;
} S4;
} kindU;
NU16 magic;
Ttype190849* typ;
Tident167021* name;
Tlineinfo163338 info;
Tsym190843* owner;
NU32 flags;
Tnode190813* ast;
NU32 options;
NI position;
NI offset;
Tloc190827 loc;
Tlib190831* annex;
Tnode190813* constraint;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tnode190813  {
Ttype190849* typ;
Tlineinfo163338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym190843* sym;
} S4;
struct {Tident167021* ident;
} S5;
struct {Tnodeseq190807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tident167021  {
  Tidobj167015 Sup;
NimStringDesc* s;
Tident167021* next;
NI h;
};
struct  Ttype190849  {
  Tidobj167015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq190845* sons;
Tnode190813* n;
Tsym190843* owner;
Tsym190843* sym;
Tsym190843* destructor;
Tsym190843* deepcopy;
Tsym190843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc190827 loc;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tcell46346  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46362  {
NI len;
NI cap;
Tcell46346** d;
};
struct  Tcellset46358  {
NI counter;
NI max;
Tpagedesc46354* head;
Tpagedesc46354** data;
};
typedef Tsmallchunk27440* TY28222[512];
typedef Ttrunk27413* Ttrunkbuckets27415[256];
struct  Tintset27417  {
Ttrunkbuckets27415 data;
};
struct  Tmemregion28210  {
NI minlargeobj;
NI maxlargeobj;
TY28222 freesmallchunks;
Tllchunk28204* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27442* freechunkslist;
Tintset27417 chunkstarts;
Tavlnode28208* root;
Tavlnode28208* deleted;
Tavlnode28208* last;
Tavlnode28208* freeavlnodes;
};
struct  Tgcstat48214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48216  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46362 zct;
Tcellseq46362 decstack;
Tcellset46358 cycleroots;
Tcellseq46362 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  TY400596  {
NI HEX3Astate;
Tnode190813* p400485;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn, void* ClEnv);
void* ClEnv;
} TY400490;
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3182) (Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3183) (Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn);
typedef N_CLOSURE_PTR(NIM_BOOL, TMP3184) (Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn);
struct  Tpasscontext241005  {
  TNimObject Sup;
NIM_BOOL fromcache;
};
struct  Intset187056  {
NI counter;
NI max;
Ttrunk187052* head;
Ttrunkseq187054* data;
};
struct  Tlinkedlist130028  {
Tlistentry130022* head;
Tlistentry130022* tail;
NI counter;
};
struct  Tidtable190861  {
NI counter;
Tidpairseq190859* data;
};
typedef N_NIMCALL_PTR(Tnode190813*, TY244072) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244077) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244085) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244093) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244098) (Tcontext244023* c, Tnode190813* n, NU16 flags);
typedef N_NIMCALL_PTR(Tnode190813*, TY244106) (Tcontext244023* c, Tnode190813* n);
typedef N_NIMCALL_PTR(Tnode190813*, TY244111) (Tcontext244023* c, Tnode190813* n, Tnode190813* norig, NU32 filter);
typedef N_NIMCALL_PTR(Ttype190849*, TY244118) (Tcontext244023* c, Tnode190813* n, Ttype190849* prev);
typedef struct {
N_NIMCALL_PTR(Tnode190813*, ClPrc) (Tcontext244023* c, Tidtable190861 pt, Tnode190813* n, void* ClEnv);
void* ClEnv;
} TY244124;
typedef struct {
N_NIMCALL_PTR(Tsym190843*, ClPrc) (Tcontext244023* c, Tsym190843* fn, Tidtable190861 pt, Tlineinfo163338 info, void* ClEnv);
void* ClEnv;
} TY244130;
typedef N_NIMCALL_PTR(Tsym190843*, TY244146) (Tcontext244023* c, Tsym190843* dc, Ttype190849* t, Tlineinfo163338 info, NU8 op);
struct  Tcontext244023  {
  Tpasscontext241005 Sup;
Tsym190843* module;
Tscope190837* currentscope;
Tscope190837* importtable;
Tscope190837* toplevelscope;
Tproccon244011* p;
Tsymseq190815* friendmodules;
NI instcounter;
Intset187056 ambiguoussymbols;
NI intypeclass;
NI ingenericcontext;
NI inunrolledcontext;
NI incompilescontext;
NI ingenericinst;
Tsymseq190815* converters;
Tsymseq190815* patterns;
Tlinkedlist130028 optionstack;
Tidtable190861 symmapping;
Tlinkedlist130028 libs;
TY244072 semconstexpr;
TY244077 semexpr;
TY244085 semtryexpr;
TY244093 semtryconstexpr;
TY244098 semoperand;
TY244106 semconstboolexpr;
TY244111 semoverloadedcall;
TY244118 semtypenode;
TY244124 seminferredlambda;
TY244130 semgenerateinstance;
Intset187056 includedfiles;
Tstrtable190817 userpragmas;
Tctx243048* evalcontext;
Intset187056 unknownidents;
TY244141* generics;
NI lastgenericidx;
NI hloloopdetector;
NI inparallelstmt;
TY244146 insttypeboundop;
};
struct  Tscope190837  {
NI depthlevel;
Tstrtable190817 symbols;
Tnodeseq190807* usingsyms;
Tscope190837* parent;
};
struct  Ropeobj161009  {
  TNimObject Sup;
Ropeobj161009* left;
Ropeobj161009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry130022  {
  TNimObject Sup;
Tlistentry130022* prev;
Tlistentry130022* next;
};
struct  Tlib190831  {
  Tlistentry130022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj161009* name;
Tnode190813* path;
};
typedef NI TY27420[16];
struct  Tpagedesc46354  {
Tpagedesc46354* next;
NI key;
TY27420 bits;
};
struct  Tbasechunk27438  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27440  {
  Tbasechunk27438 Sup;
Tsmallchunk27440* next;
Tsmallchunk27440* prev;
Tfreecell27430* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28204  {
NI size;
NI acc;
Tllchunk28204* next;
};
struct  Tbigchunk27442  {
  Tbasechunk27438 Sup;
Tbigchunk27442* next;
Tbigchunk27442* prev;
NI align;
NF data;
};
struct  Ttrunk27413  {
Ttrunk27413* next;
NI key;
TY27420 bits;
};
typedef Tavlnode28208* TY28214[2];
struct  Tavlnode28208  {
TY28214 link;
NI key;
NI upperbound;
NI level;
};
struct  Tproccon244011  {
Tsym190843* owner;
Tsym190843* resultsym;
NI nestedloopcounter;
NI nestedblockcounter;
NI intrystmt;
Tproccon244011* next;
NIM_BOOL wasforwarded;
Tnode190813* bracketexpr;
};
struct  Ttrunk187052  {
Ttrunk187052* next;
NI key;
TY27420 bits;
};
struct  Tidpair190857  {
Tidobj167015* key;
TNimObject* val;
};
struct  Tctx243048  {
  Tpasscontext241005 Sup;
TY243253* code;
TY164036* debug;
Tnode190813* globals;
Tnode190813* constants;
Ttypeseq190845* types;
Tnode190813* currentexceptiona;
Tnode190813* currentexceptionb;
NI exceptioninstr;
PprocHEX3Aobjecttype243232* prc;
Tsym190843* module;
Tnode190813* callsite;
NU8 mode;
NU8 features;
NIM_BOOL traceactive;
NI loopiterations;
Tlineinfo163338 comesfromheuristic;
TY243272* callbacks;
NimStringDesc* errorflag;
};
struct  Tinstantiationpair244013  {
Tsym190843* genericsym;
Tinstantiation190833* inst;
};
struct  Tinstantiation190833  {
Tsym190843* sym;
Ttypeseq190845* concretetypes;
TY190933* usedby;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct TY243239 {
NIM_BOOL Field0;
NU8 Field1;
};
typedef TY243239 TY243236[256];
struct  PprocHEX3Aobjecttype243232  {
TY243233* blocks;
Tsym190843* sym;
TY243236 slots;
NI maxslots;
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Vmargs243042* args, void* ClEnv);
void* ClEnv;
} Vmcallback243044;
struct TY243273 {
NimStringDesc* Field0;
Vmcallback243044 Field1;
};
struct  Tblock243030  {
Tsym190843* label;
TY243213* fixups;
};
struct  Vmargs243042  {
NI ra;
NI rb;
NI rc;
void* slots;
Tnode190813* currentexception;
};
struct Tnodeseq190807 {
  TGenericSeq Sup;
  Tnode190813* data[SEQ_DECL_SIZE];
};
struct Ttypeseq190845 {
  TGenericSeq Sup;
  Ttype190849* data[SEQ_DECL_SIZE];
};
struct TY190944 {
  TGenericSeq Sup;
  Tinstantiation190833* data[SEQ_DECL_SIZE];
};
struct Tsymseq190815 {
  TGenericSeq Sup;
  Tsym190843* data[SEQ_DECL_SIZE];
};
struct Ttrunkseq187054 {
  TGenericSeq Sup;
  Ttrunk187052* data[SEQ_DECL_SIZE];
};
struct Tidpairseq190859 {
  TGenericSeq Sup;
  Tidpair190857 data[SEQ_DECL_SIZE];
};
struct TY244141 {
  TGenericSeq Sup;
  Tinstantiationpair244013 data[SEQ_DECL_SIZE];
};
struct TY243253 {
  TGenericSeq Sup;
  NU32 data[SEQ_DECL_SIZE];
};
struct TY164036 {
  TGenericSeq Sup;
  Tlineinfo163338 data[SEQ_DECL_SIZE];
};
struct TY243272 {
  TGenericSeq Sup;
  TY243273 data[SEQ_DECL_SIZE];
};
struct TY190933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct TY243233 {
  TGenericSeq Sup;
  Tblock243030 data[SEQ_DECL_SIZE];
};
struct TY243213 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_NIMCALL(NI, sonslen_193351)(Ttype190849* n);
N_NIMCALL(Tnode190813*, matchstmtlist_401037)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n_401041);
static N_INLINE(NI, len_191097)(Tnode190813* n);
N_NIMCALL(Tnode190813*, flattenstmts_219759)(Tnode190813* n);
N_NIMCALL(NIM_BOOL, matchrange_401043)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n, NI i);
N_NIMCALL(NIM_BOOL, matches_400075)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n_400079);
static N_INLINE(NIM_BOOL, ispatternparam_400320)(Tpatterncontext400013* c, Tnode190813* p);
N_NIMCALL(NIM_BOOL, bindorcheck_400413)(Tpatterncontext400013* c, Tsym190843* param, Tnode190813* n);
N_NIMCALL(Tnode190813*, getlazy_400025)(Tpatterncontext400013* c, Tsym190843* sym);
N_NIMCALL(NIM_BOOL, sametrees_400124)(Tnode190813* a, Tnode190813* b);
static N_INLINE(NIM_BOOL, samekinds_400093)(Tnode190813* a, Tnode190813* b);
N_NIMCALL(NU8, canonkind_400083)(Tnode190813* n);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(NIM_BOOL, sametypeornil_225108)(Ttype190849* a, Ttype190849* b, NU8 flags);
N_NIMCALL(NI, sonslen_193403)(Tnode190813* n);
N_NIMCALL(NIM_BOOL, checktypes_400273)(Tpatterncontext400013* c, Tsym190843* p, Tnode190813* n);
N_NIMCALL(NIM_BOOL, matchnodekinds_269284)(Tnode190813* p, Tnode190813* n);
N_NIMCALL(NIM_BOOL, argtypematches_350522)(Tcontext244023* c, Ttype190849* f, Ttype190849* a);
N_NIMCALL(void, putlazy_400045)(Tpatterncontext400013* c, Tsym190843* sym, Tnode190813* 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(Tcell46346*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46346* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46362* s, Tcell46346* c);
N_NIMCALL(NIM_BOOL, insymchoice_400188)(Tnode190813* sc, Tnode190813* x);
N_NIMCALL(NIM_BOOL, matchchoice_400363)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n);
N_NIMCALL(NIM_BOOL, matchnested_400482)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n, NIM_BOOL rpn);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP3181)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(Tnode190813*, newnodei_192351)(NU8 kind, Tlineinfo163338 info);
N_CLOSURE(NIM_BOOL, matchstaraux_400489)(Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn, void* ClEnv);
static N_INLINE(Tnode190813*, HEX5BHEX5D_191244)(Tnode190813* n, NI i);
N_NIMCALL(void, add_191164)(Tnode190813* father, Tnode190813* son);
N_NIMCALL(void, internalerror_165199)(Tlineinfo163338 info, NimStringDesc* errmsg);
N_NIMCALL(void, gather_400447)(Tpatterncontext400013* c, Tsym190843* param, Tnode190813* n);
N_NIMCALL(Tnode190813*, newnodei_192407)(NU8 kind, Tlineinfo163338 info, NI children);
N_NIMCALL(Tnode190813*, lastson_193431)(Tnode190813* n);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_81404, TNimType* mt);
N_NIMCALL(Tnode190813*, extractrange_219771)(NU8 k, Tnode190813* n, NI a, NI b);
N_NIMCALL(Tnode190813*, newsymnode_192338)(Tsym190843* sym, Tlineinfo163338 info);
N_NIMCALL(NIM_BOOL, aliasanalysisrequested_401163)(Tnode190813* params);
N_NIMCALL(NU8, whichalias_268080)(Tsym190843* p);
N_NIMCALL(void, addtoarglist_401223)(Tnode190813* result, Tnode190813* n);
N_NIMCALL(NU8, ispartof_399375)(Tnode190813* a, Tnode190813* b);
N_NIMCALL(void, markused_344251)(Tlineinfo163338 info, Tsym190843* s);
STRING_LITERAL(TMP3176, "|", 1);
STRING_LITERAL(TMP3177, "*", 1);
STRING_LITERAL(TMP3178, "**", 2);
STRING_LITERAL(TMP3179, "~", 1);
STRING_LITERAL(TMP3185, "invalid pattern", 15);
extern TNimType NTI190807; /* TNodeSeq */
extern Tgcheap48216 gch_48244;
TNimType NTI400596; /* object */
extern TNimType NTI310033; /* range -1..0(int) */
extern TNimType NTI190805; /* PNode */
TNimType NTI400624; /* ref object */

static N_INLINE(NI, len_191097)(Tnode190813* 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_400320)(Tpatterncontext400013* c, Tnode190813* 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(Tnode190813*, getlazy_400025)(Tpatterncontext400013* c, Tsym190843* sym) {
	Tnode190813* result;
	result = 0;
	{
		if (!!((*c).mapping == 0)) goto LA3;
		result = (*c).mapping->data[(*sym).position];
	}
	LA3: ;
	return result;
}

N_NIMCALL(NU8, canonkind_400083)(Tnode190813* 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_400093)(Tnode190813* a, Tnode190813* 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_400083(a);
	LOC4 = 0;
	LOC4 = canonkind_400083(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_400124)(Tnode190813* a, Tnode190813* b) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = samekinds_400093(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_225108((*a).typ, (*b).typ, 0);
		}
		break;
		default:
		{
			{
				NI LOC16;
				NI LOC17;
				LOC16 = 0;
				LOC16 = sonslen_193403(a);
				LOC17 = 0;
				LOC17 = sonslen_193403(b);
				if (!(LOC16 == LOC17)) goto LA18;
				{
					NI i_400162;
					NI HEX3Atmp_400166;
					NI LOC21;
					NI res_400169;
					i_400162 = 0;
					HEX3Atmp_400166 = 0;
					LOC21 = 0;
					LOC21 = sonslen_193403(a);
					HEX3Atmp_400166 = (NI)(LOC21 - ((NI) 1));
					res_400169 = ((NI) 0);
					{
						while (1) {
							if (!(res_400169 <= HEX3Atmp_400166)) goto LA23;
							i_400162 = res_400169;
							{
								NIM_BOOL LOC26;
								LOC26 = 0;
								LOC26 = sametrees_400124((*a).kindU.S6.sons->data[i_400162], (*b).kindU.S6.sons->data[i_400162]);
								if (!!(LOC26)) goto LA27;
								goto BeforeRet;
							}
							LA27: ;
							res_400169 += ((NI) 1);
						} LA23: ;
					}
				}
				result = NIM_TRUE;
			}
			LA18: ;
		}
		break;
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, checktypes_400273)(Tpatterncontext400013* c, Tsym190843* p, Tnode190813* n) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(((*p).constraint == NIM_NIL))) goto LA3;
		result = matchnodekinds_269284((*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_350522((*c).c, (*p).typ, (*n).typ);
	}
	LA9: ;
	}BeforeRet: ;
	return result;
}

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

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

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

N_NIMCALL(void, putlazy_400045)(Tpatterncontext400013* c, Tsym190843* sym, Tnode190813* n) {
	{
		if (!(*c).mapping == 0) goto LA3;
		unsureAsgnRef((void**) (&(*c).mapping), (Tnodeseq190807*) newSeq((&NTI190807), ((NI) ((*c).formals))));
	}
	LA3: ;
	asgnRefNoCycle((void**) (&(*c).mapping->data[(*sym).position]), n);
}

N_NIMCALL(NIM_BOOL, bindorcheck_400413)(Tpatterncontext400013* c, Tsym190843* param, Tnode190813* n) {
	NIM_BOOL result;
	Tnode190813* pp;
	result = 0;
	pp = getlazy_400025(c, param);
	{
		if (!!((pp == NIM_NIL))) goto LA3;
		result = sametrees_400124(pp, n);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = ((*n).kind == ((NU8) 152));
		if (LOC6) goto LA7;
		LOC6 = checktypes_400273(c, param, n);
		LA7: ;
		if (!LOC6) goto LA8;
		putlazy_400045(c, param, n);
		result = NIM_TRUE;
	}
	goto LA1;
	LA8: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, insymchoice_400188)(Tnode190813* sc, Tnode190813* x) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!((*sc).kind == ((NU8) 56))) goto LA3;
		{
			NI i_400221;
			NI HEX3Atmp_400251;
			NI LOC6;
			NI res_400254;
			i_400221 = 0;
			HEX3Atmp_400251 = 0;
			LOC6 = 0;
			LOC6 = len_191097(sc);
			HEX3Atmp_400251 = (LOC6 - 1);
			res_400254 = ((NI) 0);
			{
				while (1) {
					if (!(res_400254 <= HEX3Atmp_400251)) goto LA8;
					i_400221 = res_400254;
					{
						if (!((*(*sc).kindU.S6.sons->data[i_400221]).kindU.S4.sym == (*x).kindU.S4.sym)) goto LA11;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA11: ;
					res_400254 += ((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_400363)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n) {
	NIM_BOOL result;
{	result = 0;
	{
		NI i_400388;
		NI HEX3Atmp_400391;
		NI LOC2;
		NI res_400394;
		i_400388 = 0;
		HEX3Atmp_400391 = 0;
		LOC2 = 0;
		LOC2 = len_191097(p);
		HEX3Atmp_400391 = (LOC2 - 1);
		res_400394 = ((NI) 1);
		{
			while (1) {
				if (!(res_400394 <= HEX3Atmp_400391)) goto LA4;
				i_400388 = res_400394;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_400075(c, (*p).kindU.S6.sons->data[i_400388], n);
					if (!LOC7) goto LA8;
					result = NIM_TRUE;
					goto BeforeRet;
				}
				LA8: ;
				res_400394 += ((NI) 1);
			} LA4: ;
		}
	}
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP3181)(void* p, NI op) {
	TY400596* a;
	a = (TY400596*)p;
	nimGCvisit((void*)(*a).p400485, op);
}

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

N_CLOSURE(NIM_BOOL, matchstaraux_400489)(Tpatterncontext400013* c, Tnode190813* op, Tnode190813* n_400493, Tnode190813* arglist, NIM_BOOL rpn, void* ClEnv) {
	NIM_BOOL result;
	TY400596* HEX3Aenvp_400620;
{	result = 0;
	HEX3Aenvp_400620 = (TY400596*) ClEnv;
	result = NIM_TRUE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n_400493).kind == ((NU8) 27) || (*n_400493).kind == ((NU8) 29) || (*n_400493).kind == ((NU8) 30) || (*n_400493).kind == ((NU8) 31) || (*n_400493).kind == ((NU8) 26) || (*n_400493).kind == ((NU8) 28) || (*n_400493).kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = matches_400075(c, (*op).kindU.S6.sons->data[((NI) 1)], (*n_400493).kindU.S6.sons->data[((NI) 0)]);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NI i_400519;
			NI HEX3Atmp_400566;
			NI LOC8;
			NI res_400569;
			i_400519 = 0;
			HEX3Atmp_400566 = 0;
			LOC8 = 0;
			LOC8 = sonslen_193403(n_400493);
			HEX3Atmp_400566 = (NI)(LOC8 - ((NI) 1));
			res_400569 = ((NI) 1);
			{
				while (1) {
					if (!(res_400569 <= HEX3Atmp_400566)) goto LA10;
					i_400519 = res_400569;
					{
						TY400490 LOC13;
						Tnode190813* LOC14;
						NIM_BOOL LOC15;
						memset((void*)(&LOC13), 0, sizeof(LOC13));
						LOC13.ClPrc = matchstaraux_400489; LOC13.ClEnv = HEX3Aenvp_400620;
						LOC14 = 0;
						LOC14 = HEX5BHEX5D_191244(n_400493, i_400519);
						LOC15 = 0;
						LOC15 = LOC13.ClEnv? LOC13.ClPrc(c, op, LOC14, arglist, rpn, LOC13.ClEnv):((TMP3182)(LOC13.ClPrc))(c, op, LOC14, arglist, rpn);
						if (!!(LOC15)) goto LA16;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA16: ;
					res_400569 += ((NI) 1);
				} LA10: ;
			}
		}
		{
			if (!rpn) goto LA20;
			add_191164(arglist, (*n_400493).kindU.S6.sons->data[((NI) 0)]);
		}
		LA20: ;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC23;
		Tnode190813* n;
		LOC23 = 0;
		LOC23 = ((*n_400493).kind == ((NU8) 58));
		if (!(LOC23)) goto LA24;
		LOC23 = ((*(*n_400493).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
		LA24: ;
		if (!LOC23) goto LA25;
		n = (*n_400493).kindU.S6.sons->data[((NI) 1)];
		{
			NI i_400562;
			NI HEX3Atmp_400574;
			NI LOC28;
			NI res_400577;
			i_400562 = 0;
			HEX3Atmp_400574 = 0;
			LOC28 = 0;
			LOC28 = len_191097(n);
			HEX3Atmp_400574 = (LOC28 - 1);
			res_400577 = ((NI) 0);
			{
				while (1) {
					if (!(res_400577 <= HEX3Atmp_400574)) goto LA30;
					i_400562 = res_400577;
					{
						TY400490 LOC33;
						Tnode190813* LOC34;
						NIM_BOOL LOC35;
						memset((void*)(&LOC33), 0, sizeof(LOC33));
						LOC33.ClPrc = matchstaraux_400489; LOC33.ClEnv = HEX3Aenvp_400620;
						LOC34 = 0;
						LOC34 = HEX5BHEX5D_191244(n, i_400562);
						LOC35 = 0;
						LOC35 = LOC33.ClEnv? LOC33.ClPrc(c, op, LOC34, arglist, rpn, LOC33.ClEnv):((TMP3183)(LOC33.ClPrc))(c, op, LOC34, arglist, rpn);
						if (!!(LOC35)) goto LA36;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA36: ;
					res_400577 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	goto LA1;
	LA25: ;
	{
		NIM_BOOL LOC39;
		LOC39 = 0;
		LOC39 = checktypes_400273(c, (*(*(*HEX3Aenvp_400620).p400485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, n_400493);
		if (!LOC39) goto LA40;
		add_191164(arglist, n_400493);
	}
	goto LA1;
	LA40: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchnested_400482)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n, NIM_BOOL rpn) {
	NIM_BOOL result;
	TY400596* HEX3Aenv_400623;
{	result = 0;
	HEX3Aenv_400623 = 0;
	HEX3Aenv_400623 = (TY400596*) newObj((&NTI400624), sizeof(TY400596));
	asgnRefNoCycle((void**) (&(*HEX3Aenv_400623).p400485), 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;
		Tnode190813* arglist;
		LOC7 = 0;
		LOC7 = matches_400075(c, (*(*HEX3Aenv_400623).p400485).kindU.S6.sons->data[((NI) 1)], (*n).kindU.S6.sons->data[((NI) 0)]);
		if (!LOC7) goto LA8;
		arglist = newnodei_192351(((NU8) 152), (*n).info);
		{
			TY400490 LOC12;
			NIM_BOOL LOC13;
			memset((void*)(&LOC12), 0, sizeof(LOC12));
			LOC12.ClPrc = matchstaraux_400489; LOC12.ClEnv = HEX3Aenv_400623;
			LOC13 = 0;
			LOC13 = LOC12.ClEnv? LOC12.ClPrc(c, (*HEX3Aenv_400623).p400485, n, arglist, rpn, LOC12.ClEnv):((TMP3184)(LOC12.ClPrc))(c, (*HEX3Aenv_400623).p400485, n, arglist, rpn);
			if (!LOC13) goto LA14;
			result = bindorcheck_400413(c, (*(*(*HEX3Aenv_400623).p400485).kindU.S6.sons->data[((NI) 2)]).kindU.S4.sym, arglist);
		}
		LA14: ;
	}
	LA8: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, gather_400447)(Tpatterncontext400013* c, Tsym190843* param, Tnode190813* n) {
	Tnode190813* pp;
	pp = getlazy_400025(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_191164(pp, n);
	}
	goto LA1;
	LA5: ;
	{
		pp = newnodei_192407(((NU8) 152), (*n).info, ((NI) 1));
		asgnRefNoCycle((void**) (&(*pp).kindU.S6.sons->data[((NI) 0)]), n);
		putlazy_400045(c, param, pp);
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, matches_400075)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n_400079) {
	NIM_BOOL result;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ispatternparam_400320(c, p);
		if (!LOC3) goto LA4;
		result = bindorcheck_400413(c, (*p).kindU.S4.sym, n_400079);
	}
	goto LA1;
	LA4: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = ((*n_400079).kind == ((NU8) 3));
		if (!(LOC7)) goto LA8;
		LOC7 = ((*p).kind == ((NU8) 2));
		LA8: ;
		if (!LOC7) goto LA9;
		result = ((*(*p).kindU.S5.ident).Sup.id == (*(*(*n_400079).kindU.S4.sym).name).Sup.id);
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = ((*n_400079).kind == ((NU8) 3));
		if (!(LOC12)) goto LA13;
		LOC12 = insymchoice_400188(p, n_400079);
		LA13: ;
		if (!LOC12) goto LA14;
		result = NIM_TRUE;
	}
	goto LA1;
	LA14: ;
	{
		NIM_BOOL LOC17;
		LOC17 = 0;
		LOC17 = ((*n_400079).kind == ((NU8) 3));
		if (!(LOC17)) goto LA18;
		LOC17 = ((*(*n_400079).kindU.S4.sym).kind == ((NU8) 10));
		LA18: ;
		if (!LOC17) goto LA19;
		{
			if (!((*p).kind == ((NU8) 3))) goto LA23;
			result = ((*p).kindU.S4.sym == (*n_400079).kindU.S4.sym);
		}
		goto LA21;
		LA23: ;
		{
			NIM_BOOL LOC26;
			LOC26 = 0;
			LOC26 = matches_400075(c, p, (*(*n_400079).kindU.S4.sym).ast);
			if (!LOC26) goto LA27;
			result = NIM_TRUE;
		}
		goto LA21;
		LA27: ;
		LA21: ;
	}
	goto LA1;
	LA19: ;
	{
		NimStringDesc* opr;
		if (!((*p).kind == ((NU8) 153))) goto LA30;
		opr = (*(*(*p).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident).s;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3176))) goto LA32;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3177))) goto LA33;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3178))) goto LA34;
		if (eqStrings(opr, ((NimStringDesc*) &TMP3179))) goto LA35;
		goto LA36;
		LA32: ;
		{
			result = matchchoice_400363(c, p, n_400079);
		}
		goto LA37;
		LA33: ;
		{
			result = matchnested_400482(c, p, n_400079, NIM_FALSE);
		}
		goto LA37;
		LA34: ;
		{
			result = matchnested_400482(c, p, n_400079, NIM_TRUE);
		}
		goto LA37;
		LA35: ;
		{
			NIM_BOOL LOC42;
			LOC42 = 0;
			LOC42 = matches_400075(c, (*p).kindU.S6.sons->data[((NI) 1)], n_400079);
			result = !(LOC42);
		}
		goto LA37;
		LA36: ;
		{
			internalerror_165199((*p).info, ((NimStringDesc*) &TMP3185));
		}
		LA37: ;
	}
	goto LA1;
	LA30: ;
	{
		if (!((*p).kind == ((NU8) 40))) goto LA45;
		{
			if (!((*(*p).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 30))) goto LA49;
			{
				NIM_BOOL LOC53;
				LOC53 = 0;
				LOC53 = matches_400075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_400079);
				if (!LOC53) goto LA54;
				gather_400447(c, (*(*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_400079);
				result = NIM_TRUE;
			}
			LA54: ;
		}
		goto LA47;
		LA49: ;
		{
			{
				NIM_BOOL LOC59;
				LOC59 = 0;
				LOC59 = matches_400075(c, (*p).kindU.S6.sons->data[((NI) 0)], n_400079);
				if (!LOC59) goto LA60;
				result = bindorcheck_400413(c, (*(*p).kindU.S6.sons->data[((NI) 1)]).kindU.S4.sym, n_400079);
			}
			LA60: ;
		}
		LA47: ;
	}
	goto LA1;
	LA45: ;
	{
		NIM_BOOL LOC63;
		LOC63 = 0;
		LOC63 = samekinds_400093(p, n_400079);
		if (!LOC63) goto LA64;
		switch ((*p).kind) {
		case ((NU8) 3):
		{
			result = ((*p).kindU.S4.sym == (*n_400079).kindU.S4.sym);
		}
		break;
		case ((NU8) 2):
		{
			result = ((*(*p).kindU.S5.ident).Sup.id == (*(*n_400079).kindU.S5.ident).Sup.id);
		}
		break;
		case ((NU8) 5) ... ((NU8) 10):
		{
			result = ((*p).kindU.S1.intval == (*n_400079).kindU.S1.intval);
		}
		break;
		case ((NU8) 16) ... ((NU8) 18):
		{
			result = ((*p).kindU.S2.floatval == (*n_400079).kindU.S2.floatval);
		}
		break;
		case ((NU8) 20) ... ((NU8) 22):
		{
			result = eqStrings((*p).kindU.S3.strval, (*n_400079).kindU.S3.strval);
		}
		break;
		case ((NU8) 1):
		case ((NU8) 23):
		case ((NU8) 4):
		{
			result = NIM_TRUE;
		}
		break;
		default:
		{
			NI plen;
			Tnode190813* v;
			plen = sonslen_193403(p);
			v = lastson_193431(p);
			{
				NIM_BOOL LOC75;
				Tnode190813* arglist;
				LOC75 = 0;
				LOC75 = ispatternparam_400320(c, v);
				if (!(LOC75)) goto LA76;
				LOC75 = ((*(*(*v).kindU.S4.sym).typ).kind == ((NU8) 48));
				LA76: ;
				if (!LOC75) goto LA77;
				arglist = 0;
				{
					NI LOC81;
					LOC81 = 0;
					LOC81 = sonslen_193403(n_400079);
					if (!(plen <= LOC81)) goto LA82;
					{
						NI i_400851;
						NI HEX3Atmp_400947;
						NI res_400950;
						i_400851 = 0;
						HEX3Atmp_400947 = 0;
						HEX3Atmp_400947 = (NI)(plen - ((NI) 2));
						res_400950 = ((NI) 0);
						{
							while (1) {
								if (!(res_400950 <= HEX3Atmp_400947)) goto LA86;
								i_400851 = res_400950;
								{
									NIM_BOOL LOC89;
									LOC89 = 0;
									LOC89 = matches_400075(c, (*p).kindU.S6.sons->data[i_400851], (*n_400079).kindU.S6.sons->data[i_400851]);
									if (!!(LOC89)) goto LA90;
									goto BeforeRet;
								}
								LA90: ;
								res_400950 += ((NI) 1);
							} LA86: ;
						}
					}
					{
						NIM_BOOL LOC94;
						NIM_BOOL LOC95;
						NI LOC96;
						Tnode190813* LOC98;
						Tnode190813* LOC100;
						Tnode190813* n;
						Tnode190813* LOC103;
						NI LOC104;
						LOC94 = 0;
						LOC95 = 0;
						LOC96 = 0;
						LOC96 = sonslen_193403(n_400079);
						LOC95 = (plen == LOC96);
						if (!(LOC95)) goto LA97;
						LOC98 = 0;
						LOC98 = lastson_193431(n_400079);
						LOC95 = ((*LOC98).kind == ((NU8) 58));
						LA97: ;
						LOC94 = LOC95;
						if (!(LOC94)) goto LA99;
						LOC100 = 0;
						LOC100 = lastson_193431(n_400079);
						LOC94 = ((*(*LOC100).kindU.S6.sons->data[((NI) 1)]).kind == ((NU8) 41));
						LA99: ;
						if (!LOC94) goto LA101;
						LOC103 = 0;
						LOC103 = lastson_193431(n_400079);
						n = (*LOC103).kindU.S6.sons->data[((NI) 1)];
						LOC104 = 0;
						LOC104 = len_191097(n);
						arglist = newnodei_192407(((NU8) 152), (*n).info, LOC104);
						{
							NI i_400895;
							NI HEX3Atmp_400955;
							NI LOC106;
							NI res_400958;
							i_400895 = 0;
							HEX3Atmp_400955 = 0;
							LOC106 = 0;
							LOC106 = len_191097(n);
							HEX3Atmp_400955 = (LOC106 - 1);
							res_400958 = ((NI) 0);
							{
								while (1) {
									if (!(res_400958 <= HEX3Atmp_400955)) goto LA108;
									i_400895 = res_400958;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_400895]), (*n).kindU.S6.sons->data[i_400895]);
									res_400958 += ((NI) 1);
								} LA108: ;
							}
						}
					}
					goto LA92;
					LA101: ;
					{
						NI LOC110;
						LOC110 = 0;
						LOC110 = sonslen_193403(n_400079);
						arglist = newnodei_192407(((NU8) 152), (*n_400079).info, (NI)((NI)(LOC110 - plen) + ((NI) 1)));
						{
							NI i_400910;
							NI HEX3Atmp_400963;
							NI LOC112;
							NI res_400966;
							i_400910 = 0;
							HEX3Atmp_400963 = 0;
							LOC112 = 0;
							LOC112 = sonslen_193403(n_400079);
							HEX3Atmp_400963 = (NI)(LOC112 - plen);
							res_400966 = ((NI) 0);
							{
								while (1) {
									if (!(res_400966 <= HEX3Atmp_400963)) goto LA114;
									i_400910 = res_400966;
									asgnRefNoCycle((void**) (&(*arglist).kindU.S6.sons->data[i_400910]), (*n_400079).kindU.S6.sons->data[(NI)((NI)(i_400910 + plen) - ((NI) 1))]);
									res_400966 += ((NI) 1);
								} LA114: ;
							}
						}
					}
					LA92: ;
					result = bindorcheck_400413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA79;
				LA82: ;
				{
					NI LOC116;
					LOC116 = 0;
					LOC116 = sonslen_193403(n_400079);
					if (!((NI)(plen - ((NI) 1)) == LOC116)) goto LA117;
					{
						NI i_400926;
						NI HEX3Atmp_400971;
						NI res_400974;
						i_400926 = 0;
						HEX3Atmp_400971 = 0;
						HEX3Atmp_400971 = (NI)(plen - ((NI) 2));
						res_400974 = ((NI) 0);
						{
							while (1) {
								if (!(res_400974 <= HEX3Atmp_400971)) goto LA121;
								i_400926 = res_400974;
								{
									NIM_BOOL LOC124;
									LOC124 = 0;
									LOC124 = matches_400075(c, (*p).kindU.S6.sons->data[i_400926], (*n_400079).kindU.S6.sons->data[i_400926]);
									if (!!(LOC124)) goto LA125;
									goto BeforeRet;
								}
								LA125: ;
								res_400974 += ((NI) 1);
							} LA121: ;
						}
					}
					arglist = newnodei_192351(((NU8) 152), (*n_400079).info);
					result = bindorcheck_400413(c, (*v).kindU.S4.sym, arglist);
					goto BeforeRet;
				}
				goto LA79;
				LA117: ;
				LA79: ;
			}
			LA77: ;
			{
				NI LOC129;
				LOC129 = 0;
				LOC129 = sonslen_193403(n_400079);
				if (!(plen == LOC129)) goto LA130;
				{
					NI i_400942;
					NI HEX3Atmp_400979;
					NI LOC133;
					NI res_400982;
					i_400942 = 0;
					HEX3Atmp_400979 = 0;
					LOC133 = 0;
					LOC133 = sonslen_193403(p);
					HEX3Atmp_400979 = (NI)(LOC133 - ((NI) 1));
					res_400982 = ((NI) 0);
					{
						while (1) {
							if (!(res_400982 <= HEX3Atmp_400979)) goto LA135;
							i_400942 = res_400982;
							{
								NIM_BOOL LOC138;
								LOC138 = 0;
								LOC138 = matches_400075(c, (*p).kindU.S6.sons->data[i_400942], (*n_400079).kindU.S6.sons->data[i_400942]);
								if (!!(LOC138)) goto LA139;
								goto BeforeRet;
							}
							LA139: ;
							res_400982 += ((NI) 1);
						} LA135: ;
					}
				}
				result = NIM_TRUE;
			}
			LA130: ;
		}
		break;
		}
	}
	goto LA1;
	LA64: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, matchrange_401043)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n, NI i) {
	NIM_BOOL result;
{	result = 0;
	{
		NI j_401069;
		NI HEX3Atmp_401081;
		NI LOC2;
		NI res_401084;
		j_401069 = 0;
		HEX3Atmp_401081 = 0;
		LOC2 = 0;
		LOC2 = len_191097(p);
		HEX3Atmp_401081 = (LOC2 - 1);
		res_401084 = ((NI) 0);
		{
			while (1) {
				if (!(res_401084 <= HEX3Atmp_401081)) goto LA4;
				j_401069 = res_401084;
				{
					NIM_BOOL LOC7;
					LOC7 = 0;
					LOC7 = matches_400075(c, (*p).kindU.S6.sons->data[j_401069], (*n).kindU.S6.sons->data[(NI)(i + j_401069)]);
					if (!!(LOC7)) goto LA8;
					{
						if (!!((*c).mapping == 0)) goto LA12;
						genericSeqAssign((&(*c).mapping), NIM_NIL, (&NTI190807));
					}
					LA12: ;
					result = NIM_FALSE;
					goto BeforeRet;
				}
				LA8: ;
				res_401084 += ((NI) 1);
			} LA4: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode190813*, matchstmtlist_401037)(Tpatterncontext400013* c, Tnode190813* p, Tnode190813* n_401041) {
	Tnode190813* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		NI LOC7;
		NI LOC8;
		Tnode190813* n;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((*p).kind == ((NU8) 115));
		if (!(LOC4)) goto LA5;
		LOC4 = ((*n_401041).kind == (*p).kind);
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC7 = 0;
		LOC7 = len_191097(p);
		LOC8 = 0;
		LOC8 = len_191097(n_401041);
		LOC3 = (LOC7 < LOC8);
		LA6: ;
		if (!LOC3) goto LA9;
		n = flattenstmts_219759(n_401041);
		{
			NI i_401121;
			NI HEX3Atmp_401129;
			NI LOC12;
			NI LOC13;
			NI res_401132;
			i_401121 = 0;
			HEX3Atmp_401129 = 0;
			LOC12 = 0;
			LOC12 = len_191097(n);
			LOC13 = 0;
			LOC13 = len_191097(p);
			HEX3Atmp_401129 = (NI)(LOC12 - LOC13);
			res_401132 = ((NI) 0);
			{
				while (1) {
					if (!(res_401132 <= HEX3Atmp_401129)) goto LA15;
					i_401121 = res_401132;
					{
						NIM_BOOL LOC18;
						NI LOC21;
						NI LOC22;
						NI LOC23;
						LOC18 = 0;
						LOC18 = matchrange_401043(c, p, n, i_401121);
						if (!LOC18) goto LA19;
						(*c).submatch = NIM_TRUE;
						result = newnodei_192407(((NU8) 115), (*n).info, ((NI) 3));
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 0)]), extractrange_219771(((NU8) 115), n, ((NI) 0), (NI)(i_401121 - ((NI) 1))));
						LOC21 = 0;
						LOC21 = len_191097(p);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 1)]), extractrange_219771(((NU8) 115), n, i_401121, (NI)((NI)(i_401121 + LOC21) - ((NI) 1))));
						LOC22 = 0;
						LOC22 = len_191097(p);
						LOC23 = 0;
						LOC23 = len_191097(n);
						asgnRefNoCycle((void**) (&(*result).kindU.S6.sons->data[((NI) 2)]), extractrange_219771(((NU8) 115), n, (NI)(i_401121 + LOC22), (NI)(LOC23 - ((NI) 1))));
						goto LA11;
					}
					LA19: ;
					res_401132 += ((NI) 1);
				} LA15: ;
			}
		} LA11: ;
	}
	goto LA1;
	LA9: ;
	{
		NIM_BOOL LOC25;
		LOC25 = 0;
		LOC25 = matches_400075(c, p, n_401041);
		if (!LOC25) goto LA26;
		result = n_401041;
	}
	goto LA1;
	LA26: ;
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, aliasanalysisrequested_401163)(Tnode190813* params) {
	NIM_BOOL result;
{	result = 0;
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = len_191097(params);
		if (!(((NI) 2) <= LOC3)) goto LA4;
		{
			NI i_401187;
			NI HEX3Atmp_401201;
			NI LOC7;
			NI res_401204;
			i_401187 = 0;
			HEX3Atmp_401201 = 0;
			LOC7 = 0;
			LOC7 = len_191097(params);
			HEX3Atmp_401201 = (LOC7 - 1);
			res_401204 = ((NI) 1);
			{
				while (1) {
					Tsym190843* param;
					if (!(res_401204 <= HEX3Atmp_401201)) goto LA9;
					i_401187 = res_401204;
					param = (*(*params).kindU.S6.sons->data[i_401187]).kindU.S4.sym;
					{
						NU8 LOC12;
						LOC12 = 0;
						LOC12 = whichalias_268080(param);
						if (!!((LOC12 == ((NU8) 1)))) goto LA13;
						result = NIM_TRUE;
						goto BeforeRet;
					}
					LA13: ;
					res_401204 += ((NI) 1);
				} LA9: ;
			}
		}
	}
	LA4: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addtoarglist_401223)(Tnode190813* result, Tnode190813* 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_191164(result, n);
		}
		goto LA7;
		LA9: ;
		{
			{
				NI i_401277;
				NI HEX3Atmp_401281;
				NI LOC13;
				NI res_401284;
				i_401277 = 0;
				HEX3Atmp_401281 = 0;
				LOC13 = 0;
				LOC13 = len_191097(n);
				HEX3Atmp_401281 = (LOC13 - 1);
				res_401284 = ((NI) 0);
				{
					while (1) {
						if (!(res_401284 <= HEX3Atmp_401281)) goto LA15;
						i_401277 = res_401284;
						add_191164(result, (*n).kindU.S6.sons->data[i_401277]);
						res_401284 += ((NI) 1);
					} LA15: ;
				}
			}
		}
		LA7: ;
	}
	LA5: ;
}

N_NIMCALL(Tnode190813*, applyrule_401303)(Tcontext244023* c, Tsym190843* s, Tnode190813* n) {
	Tnode190813* result;
	Tpatterncontext400013 ctx;
	NI LOC1;
	Tnode190813* m;
	Tnode190813* LOC6;
	Tnode190813* params;
	NIM_BOOL requiresaa;
	Tnode190813* args;
{	result = 0;
	memset((void*)(&ctx), 0, sizeof(ctx));
	ctx.owner = s;
	ctx.c = c;
	LOC1 = 0;
	LOC1 = sonslen_193351((*s).typ);
	ctx.formals = (NI)(LOC1 - ((NI) 1));
	m = matchstmtlist_401037((&ctx), (*(*s).ast).kindU.S6.sons->data[((NI) 1)], n);
	{
		if (!m == 0) goto LA4;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA4: ;
	result = newnodei_192351(((NU8) 27), (*n).info);
	LOC6 = 0;
	LOC6 = newsymnode_192338(s, (*n).info);
	add_191164(result, LOC6);
	params = (*(*s).typ).n;
	requiresaa = aliasanalysisrequested_401163(params);
	args = 0;
	{
		if (!requiresaa) goto LA9;
		args = newnodei_192351(((NU8) 152), (*n).info);
	}
	LA9: ;
	{
		NI i_401347;
		NI HEX3Atmp_401605;
		NI LOC12;
		NI res_401608;
		i_401347 = 0;
		HEX3Atmp_401605 = 0;
		LOC12 = 0;
		LOC12 = len_191097(params);
		HEX3Atmp_401605 = (LOC12 - 1);
		res_401608 = ((NI) 1);
		{
			while (1) {
				Tsym190843* param;
				Tnode190813* x;
				if (!(res_401608 <= HEX3Atmp_401605)) goto LA14;
				i_401347 = res_401608;
				param = (*(*params).kindU.S6.sons->data[i_401347]).kindU.S4.sym;
				x = getlazy_400025((&ctx), param);
				{
					if (!x == 0) goto LA17;
					result = NIM_NIL;
					goto BeforeRet;
				}
				LA17: ;
				add_191164(result, x);
				{
					if (!requiresaa) goto LA21;
					addtoarglist_401223(args, x);
				}
				LA21: ;
				res_401608 += ((NI) 1);
			} LA14: ;
		}
	}
	{
		if (!requiresaa) goto LA25;
		{
			NI i_401381;
			NI HEX3Atmp_401635;
			NI LOC28;
			NI res_401638;
			i_401381 = 0;
			HEX3Atmp_401635 = 0;
			LOC28 = 0;
			LOC28 = len_191097(params);
			HEX3Atmp_401635 = (LOC28 - 1);
			res_401638 = ((NI) 1);
			{
				while (1) {
					Tnode190813* rs;
					Tsym190843* param;
					NU8 LOC31;
					if (!(res_401638 <= HEX3Atmp_401635)) goto LA30;
					i_401381 = res_401638;
					rs = (*result).kindU.S6.sons->data[i_401381];
					param = (*(*params).kindU.S6.sons->data[i_401381]).kindU.S4.sym;
					LOC31 = 0;
					LOC31 = whichalias_268080(param);
					switch (LOC31) {
					case ((NU8) 1):
					{
					}
					break;
					case ((NU8) 2):
					{
						NIM_BOOL ok;
						ok = NIM_FALSE;
						{
							Tnode190813* arg_401388;
							arg_401388 = 0;
							{
								NI i_401617;
								NI HEX3Atmp_401619;
								NI LOC36;
								NI res_401621;
								i_401617 = 0;
								HEX3Atmp_401619 = 0;
								LOC36 = 0;
								LOC36 = len_191097(args);
								HEX3Atmp_401619 = (LOC36 - 1);
								res_401621 = ((NI) 0);
								{
									while (1) {
										if (!(res_401621 <= HEX3Atmp_401619)) goto LA38;
										i_401617 = res_401621;
										arg_401388 = (*args).kindU.S6.sons->data[i_401617];
										{
											NIM_BOOL LOC41;
											NU8 LOC43;
											LOC41 = 0;
											LOC41 = !((arg_401388 == rs));
											if (!(LOC41)) goto LA42;
											LOC43 = 0;
											LOC43 = ispartof_399375(rs, arg_401388);
											LOC41 = (LOC43 == ((NU8) 2));
											LA42: ;
											if (!LOC41) goto LA44;
											ok = NIM_TRUE;
											goto LA34;
										}
										LA44: ;
										res_401621 += ((NI) 1);
									} LA38: ;
								}
							}
						} LA34: ;
						{
							if (!!(ok)) goto LA48;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA48: ;
					}
					break;
					case ((NU8) 3):
					{
						NIM_BOOL ok;
						ok = NIM_TRUE;
						{
							Tnode190813* arg_401410;
							arg_401410 = 0;
							{
								NI i_401628;
								NI HEX3Atmp_401630;
								NI LOC53;
								NI res_401632;
								i_401628 = 0;
								HEX3Atmp_401630 = 0;
								LOC53 = 0;
								LOC53 = len_191097(args);
								HEX3Atmp_401630 = (LOC53 - 1);
								res_401632 = ((NI) 0);
								{
									while (1) {
										if (!(res_401632 <= HEX3Atmp_401630)) goto LA55;
										i_401628 = res_401632;
										arg_401410 = (*args).kindU.S6.sons->data[i_401628];
										{
											NIM_BOOL LOC58;
											NU8 LOC60;
											LOC58 = 0;
											LOC58 = !((arg_401410 == rs));
											if (!(LOC58)) goto LA59;
											LOC60 = 0;
											LOC60 = ispartof_399375(rs, arg_401410);
											LOC58 = !((LOC60 == ((NU8) 0)));
											LA59: ;
											if (!LOC58) goto LA61;
											ok = NIM_FALSE;
											goto LA51;
										}
										LA61: ;
										res_401632 += ((NI) 1);
									} LA55: ;
								}
							}
						} LA51: ;
						{
							if (!!(ok)) goto LA65;
							result = NIM_NIL;
							goto BeforeRet;
						}
						LA65: ;
					}
					break;
					}
					res_401638 += ((NI) 1);
				} LA30: ;
			}
		}
	}
	LA25: ;
	markused_344251((*n).info, s);
	{
		if (!ctx.submatch) goto LA69;
		asgnRefNoCycle((void**) (&(*m).kindU.S6.sons->data[((NI) 1)]), result);
		result = m;
	}
	LA69: ;
	}BeforeRet: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_patternsInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, nimsrc_patternsDatInit)(void) {
static TNimNode* TMP3180[2];
static TNimNode TMP946[3];
NTI400596.size = sizeof(TY400596);
NTI400596.kind = 18;
NTI400596.base = 0;
NTI400596.flags = 2;
TMP3180[0] = &TMP946[1];
TMP946[1].kind = 1;
TMP946[1].offset = offsetof(TY400596, HEX3Astate);
TMP946[1].typ = (&NTI310033);
TMP946[1].name = ":state";
TMP3180[1] = &TMP946[2];
TMP946[2].kind = 1;
TMP946[2].offset = offsetof(TY400596, p400485);
TMP946[2].typ = (&NTI190805);
TMP946[2].name = "p400485";
TMP946[0].len = 2; TMP946[0].kind = 2; TMP946[0].sons = &TMP3180[0];
NTI400596.node = &TMP946[0];
NTI400624.size = sizeof(TY400596*);
NTI400624.kind = 22;
NTI400624.base = (&NTI400596);
NTI400624.flags = 2;
NTI400624.marker = TMP3181;
}

