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

#include "nimbase.h"
#include <string.h>
#include <io.h>
#include <fcntl.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <signal.h>
typedef struct Exception Exception;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Avlnode29485 Avlnode29485;
typedef struct Gcheap49618 Gcheap49618;
typedef struct Gcstack49616 Gcstack49616;
typedef struct Cellseq47320 Cellseq47320;
typedef struct Cell47304 Cell47304;
typedef struct Cellset47316 Cellset47316;
typedef struct Pagedesc47312 Pagedesc47312;
typedef struct Memregion29487 Memregion29487;
typedef struct Smallchunk29439 Smallchunk29439;
typedef struct Llchunk29481 Llchunk29481;
typedef struct Bigchunk29441 Bigchunk29441;
typedef struct Intset29414 Intset29414;
typedef struct Trunk29410 Trunk29410;
typedef struct Gcstat49614 Gcstat49614;
typedef struct Basechunk29437 Basechunk29437;
typedef struct Freecell29429 Freecell29429;
typedef struct TGenericSeq TGenericSeq;
typedef struct NimStringDesc NimStringDesc;
typedef struct TSafePoint TSafePoint;
typedef struct TNimObject TNimObject;
typedef struct Overflowerror3640 Overflowerror3640;
typedef struct Arithmeticerror3636 Arithmeticerror3636;
typedef struct Systemerror3626 Systemerror3626;
typedef struct Outofmemerror3650 Outofmemerror3650;
typedef struct Valueerror3646 Valueerror3646;
typedef struct Ioerror3628 Ioerror3628;
typedef struct Reraiseerror3660 Reraiseerror3660;
typedef struct TY89887 TY89887;
typedef struct Tnodeseq216784 Tnodeseq216784;
typedef struct Tnode216790 Tnode216790;
typedef struct Oserror3630 Oserror3630;
typedef struct Keyerror3648 Keyerror3648;
typedef struct Rangeerror3656 Rangeerror3656;
typedef struct TY216913 TY216913;
typedef struct Assertionerror3644 Assertionerror3644;
typedef struct Ttypeseq216824 Ttypeseq216824;
typedef struct Ttype216828 Ttype216828;
typedef struct TY246443 TY246443;
typedef struct Tinstantiation216812 Tinstantiation216812;
typedef struct Tsym216822 Tsym216822;
typedef struct TY216925 TY216925;
typedef struct Slice89480 Slice89480;
typedef struct Divbyzeroerror3638 Divbyzeroerror3638;
typedef struct Tsymseq216792 Tsymseq216792;
typedef struct TY308653 TY308653;
typedef struct Jsonnodeobj308633 Jsonnodeobj308633;
typedef struct TY308648 TY308648;
typedef struct TY309043 TY309043;
typedef struct Indexentry329126 Indexentry329126;
typedef struct TY527219 TY527219;
typedef struct Tlineinfo184337 Tlineinfo184337;
typedef struct Tident191012 Tident191012;
typedef struct Tidobj191006 Tidobj191006;
typedef struct Tloc216804 Tloc216804;
typedef struct Ropeobj172006 Ropeobj172006;
typedef struct Tscope216816 Tscope216816;
typedef struct Tstrtable216794 Tstrtable216794;
typedef struct Tlib216808 Tlib216808;
typedef struct Tlistentry138010 Tlistentry138010;
typedef N_NIMCALL_PTR(NIM_BOOL, TY10009) (Exception* e);
typedef N_NIMCALL_PTR(NIM_BOOL, TY10014) (Exception* e);
typedef N_NIMCALL_PTR(void, TY10019) (void);
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
typedef Avlnode29485* TY29492[2];
struct  Avlnode29485  {
TY29492 link;
NI key;
NI upperbound;
NI level;
};
struct  Cellseq47320  {
NI len;
NI cap;
Cell47304** d;
};
struct  Cellset47316  {
NI counter;
NI max;
Pagedesc47312* head;
Pagedesc47312** data;
};
typedef Smallchunk29439* TY29502[512];
typedef Trunk29410* Trunkbuckets29412[256];
struct  Intset29414  {
Trunkbuckets29412 data;
};
struct  Memregion29487  {
NI minlargeobj;
NI maxlargeobj;
TY29502 freesmallchunks;
Llchunk29481* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk29441* freechunkslist;
Intset29414 chunkstarts;
Avlnode29485* root;
Avlnode29485* deleted;
Avlnode29485* last;
Avlnode29485* freeavlnodes;
};
struct  Gcstat49614  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap49618  {
Gcstack49616* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq47320 zct;
Cellseq47320 decstack;
Cellset47316 cycleroots;
Cellseq47320 tempstack;
NI recgclock;
Memregion29487 region;
Gcstat49614 stat;
};
struct  Basechunk29437  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk29439  {
  Basechunk29437 Sup;
Smallchunk29439* next;
Smallchunk29439* prev;
Freecell29429* freelist;
NI free;
NI acc;
NF data;
};
struct  Bigchunk29441  {
  Basechunk29437 Sup;
Bigchunk29441* next;
Bigchunk29441* prev;
NI align;
NF data;
};
typedef NI TY29418[16];
struct  Trunk29410  {
Trunk29410* next;
NI key;
TY29418 bits;
};
struct  Llchunk29481  {
NI size;
NI acc;
Llchunk29481* next;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Freecell29429  {
Freecell29429* next;
NI zerofield;
};
typedef N_NIMCALL_PTR(void, TY19201) (NimStringDesc* msg);
typedef TFrame* TY19803[128];
struct  Cell47304  {
NI refcount;
TNimType* typ;
};
struct  Pagedesc47312  {
Pagedesc47312* next;
NI key;
TY29418 bits;
};
typedef N_NIMCALL_PTR(void, Finalizer) (void* self);
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Exception  {
  TNimObject Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
NimStringDesc* trace;
};
struct  Arithmeticerror3636  {
  Exception Sup;
};
struct  Overflowerror3640  {
  Arithmeticerror3636 Sup;
};
typedef struct {
N_NIMCALL_PTR(NIM_BOOL, ClPrc) (Exception* e, void* ClEnv);
void* ClEnv;
} TY17811;
struct  TSafePoint  {
TSafePoint* prev;
NI status;
jmp_buf context;
NIM_BOOL hasRaiseAction;
TY17811 raiseAction;
};
typedef N_CLOSURE_PTR(NIM_BOOL, TMP54) (Exception* e);
struct  Systemerror3626  {
  Exception Sup;
};
struct  Outofmemerror3650  {
  Systemerror3626 Sup;
};
typedef NIM_CHAR TY21018[2001];
struct  Valueerror3646  {
  Exception Sup;
};
struct  Ioerror3628  {
  Systemerror3626 Sup;
};
typedef NI16 TY82407[1000001];
typedef NimStringDesc* TY84028[5];
struct  Reraiseerror3660  {
  Exception Sup;
};
struct TY89887 {
NimStringDesc* Field0;
NI Field1;
};
typedef NIM_CHAR TY80422[500];
struct  Oserror3630  {
  Systemerror3626 Sup;
NI32 errorcode;
};
struct  Keyerror3648  {
  Valueerror3646 Sup;
};
struct  Rangeerror3656  {
  Exception Sup;
};
typedef NIM_CHAR TY80365[65];
typedef NI32 TY533234[1];
typedef NU8 Sha1digest194003[20];
struct  Assertionerror3644  {
  Exception Sup;
};
struct TY246443 {
NI Field0;
NI Field1;
};
typedef Ttype216828* TY368877[1];
typedef NIM_CHAR TY86237[60];
struct  Tinstantiation216812  {
Tsym216822* sym;
Ttypeseq216824* concretetypes;
TY216913* usedby;
NI compilesid;
};
typedef Tinstantiation216812* TY430516[1];
typedef Tnode216790* TY232280[1];
struct  Slice89480  {
NI a;
NI b;
};
struct  Divbyzeroerror3638  {
  Arithmeticerror3636 Sup;
};
typedef Tsym216822* TY266332[1];
struct TY309043 {
NimStringDesc* Field0;
Jsonnodeobj308633* Field1;
};
struct  Indexentry329126  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
struct  Gcstack49616  {
Gcstack49616* prev;
Gcstack49616* next;
void* starts;
void* pos;
NI maxstacksize;
};
struct  Tlineinfo184337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode216790  {
Ttype216828* typ;
Tlineinfo184337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym216822* sym;
} S4;
struct {Tident191012* ident;
} S5;
struct {Tnodeseq216784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Tidobj191006  {
  TNimObject Sup;
NI id;
};
struct  Tloc216804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype216828* t;
Ropeobj172006* r;
Ropeobj172006* heaproot;
};
struct  Ttype216828  {
  Tidobj191006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq216824* sons;
Tnode216790* n;
Tsym216822* owner;
Tsym216822* sym;
Tsym216822* destructor;
Tsym216822* deepcopy;
Tsym216822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc216804 loc;
};
struct  Tstrtable216794  {
NI counter;
Tsymseq216792* data;
};
struct  Tsym216822  {
  Tidobj191006 Sup;
NU8 kind;
union{
struct {Ttypeseq216824* typeinstcache;
Tscope216816* typscope;
} S1;
struct {TY216925* procinstcache;
Tsym216822* gcunsafetyreason;
} S2;
struct {TY216925* usedgenerics;
Tstrtable216794 tab;
} S3;
struct {Tsym216822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype216828* typ;
Tident191012* name;
Tlineinfo184337 info;
Tsym216822* owner;
NU32 flags;
Tnode216790* ast;
NU32 options;
NI position;
NI offset;
Tloc216804 loc;
Tlib216808* annex;
Tnode216790* constraint;
};
struct  Jsonnodeobj308633  {
NU8 kind;
union{
struct {NimStringDesc* str;
} S1;
struct {NI64 num;
} S2;
struct {NF fnum;
} S3;
struct {NIM_BOOL bval;
} S4;
struct {TY308648* fields;
} S6;
struct {TY308653* elems;
} S7;
} kindU;
};
struct  Tident191012  {
  Tidobj191006 Sup;
NimStringDesc* s;
Tident191012* next;
NI h;
};
struct  Ropeobj172006  {
  TNimObject Sup;
Ropeobj172006* left;
Ropeobj172006* right;
NI length;
NimStringDesc* data;
};
struct  Tscope216816  {
NI depthlevel;
Tstrtable216794 symbols;
Tnodeseq216784* usingsyms;
Tscope216816* parent;
};
struct  Tlistentry138010  {
  TNimObject Sup;
Tlistentry138010* prev;
Tlistentry138010* next;
};
struct  Tlib216808  {
  Tlistentry138010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj172006* name;
Tnode216790* path;
};
struct Tnodeseq216784 {
  TGenericSeq Sup;
  Tnode216790* data[SEQ_DECL_SIZE];
};
struct TY216913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct Ttypeseq216824 {
  TGenericSeq Sup;
  Ttype216828* data[SEQ_DECL_SIZE];
};
struct TY216925 {
  TGenericSeq Sup;
  Tinstantiation216812* data[SEQ_DECL_SIZE];
};
struct Tsymseq216792 {
  TGenericSeq Sup;
  Tsym216822* data[SEQ_DECL_SIZE];
};
struct TY308653 {
  TGenericSeq Sup;
  Jsonnodeobj308633* data[SEQ_DECL_SIZE];
};
struct TY308648 {
  TGenericSeq Sup;
  TY309043 data[SEQ_DECL_SIZE];
};
struct TY527219 {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
static N_INLINE(void, initallocator_11601)(void);
static N_INLINE(void, initStackBottom)(void);
N_NOINLINE(void, setStackBottom)(void* thestackbottom);
N_NIMCALL(void, initgc_11401)(void);
N_NIMCALL(void, init_47402)(Cellseq47320* s, NI cap);
N_NOCONV(void*, alloc0_7417)(NI size);
N_NIMCALL(void*, alloc0_46016)(Memregion29487* allocator, NI size);
N_NIMCALL(void*, alloc_45840)(Memregion29487* allocator, NI size);
N_NIMCALL(void*, rawalloc_36668)(Memregion29487* a, NI requestedsize);
static N_INLINE(NI, roundup_28201)(NI x, NI v);
N_NIMCALL(Smallchunk29439*, getsmallchunk_36012)(Memregion29487* a);
N_NIMCALL(Bigchunk29441*, getbigchunk_35214)(Memregion29487* a, NI size);
static N_INLINE(void, listremove_33002)(Bigchunk29441** head, Bigchunk29441* c);
N_NIMCALL(void, splitchunk_35009)(Memregion29487* a, Bigchunk29441* c, NI size);
static N_INLINE(void, updateprevsize_32068)(Memregion29487* a, Bigchunk29441* c, NI prevsize);
static N_INLINE(NIM_BOOL, isaccessible_32015)(Memregion29487* a, void* p);
N_NIMCALL(NIM_BOOL, contains_30732)(Intset29414* s, NI key);
N_NIMCALL(Trunk29410*, intsetget_30683)(Intset29414* t, NI key);
static N_INLINE(NI, pageindex_31175)(void* p);
N_NIMCALL(void, incl_30753)(Memregion29487* a, Intset29414* s, NI key);
N_NIMCALL(Trunk29410*, intsetput_30705)(Memregion29487* a, Intset29414* t, NI key);
N_NIMCALL(void*, llalloc_29643)(Memregion29487* a, NI size);
static N_INLINE(void*, osallocpages_29223)(NI size);
N_NOINLINE(void, raiseoutofmem_28033)(void);
static N_INLINE(void, inccurrmem_29602)(Memregion29487* a, NI bytes);
static N_INLINE(NI, pageindex_31170)(Basechunk29437* c);
static N_INLINE(void, listadd_34223)(Bigchunk29441** head, Bigchunk29441* c);
N_NIMCALL(Bigchunk29441*, requestoschunks_31187)(Memregion29487* a, NI size);
static N_INLINE(void, listadd_37616)(Smallchunk29439** head, Smallchunk29439* c);
static N_INLINE(void, listremove_40402)(Smallchunk29439** head, Smallchunk29439* c);
N_NIMCALL(void, add_30553)(Memregion29487* a, Avlnode29485** t, NI key, NI upperbound);
N_NIMCALL(Avlnode29485*, allocavlnode_29827)(Memregion29487* a, NI key, NI upperbound);
N_NIMCALL(void, skew_30534)(Avlnode29485** t);
N_NIMCALL(void, split_30539)(Avlnode29485** t);
N_NIMCALL(void, init_47417)(Cellset47316* s);
N_NOCONV(void, signalHandler)(int sig);
N_NIMCALL(void, showerrormessage_19406)(NCSTRING data);
N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_NIMCALL(NimStringDesc*, toNimStr)(NCSTRING str, NI len);
N_NIMCALL(NimStringDesc*, rawNewStringNoInit)(NI space);
N_NIMCALL(void*, newObjNoInit)(TNimType* typ, NI size);
N_NIMCALL(void*, rawnewobj_57401)(TNimType* typ, NI size, Gcheap49618* gch);
N_NIMCALL(void, collectct_51607)(Gcheap49618* gch);
N_NOINLINE(NI, stacksize_71401)(void);
static N_INLINE(NI, getoccupiedmem_47229)(Memregion29487* a);
N_NIMCALL(void, collectctbody_75209)(Gcheap49618* gch);
static N_INLINE(void, prepareforinteriorpointerchecking_44688)(Memregion29487* a);
N_NIMCALL(NI, lowgauge_30412)(Avlnode29485* n);
N_NIMCALL(NI, highgauge_30429)(Avlnode29485* n);
N_CDECL(void, markstackandregisters_72637)(Gcheap49618* gch);
static N_INLINE(void, gcmark_70416)(Gcheap49618* gch, void* p);
static N_INLINE(Cell47304*, usrtocell_51240)(void* usr);
N_NIMCALL(void*, interiorallocatedptr_44692)(Memregion29487* a, void* p);
static N_INLINE(Basechunk29437*, pageaddr_31180)(void* p);
static N_INLINE(NIM_BOOL, chunkunused_31089)(Basechunk29437* c);
static N_INLINE(NIM_BOOL, issmallchunk_31069)(Basechunk29437* c);
N_NIMCALL(Avlnode29485*, inrange_30481)(Avlnode29485* root, NI key);
static N_INLINE(void, add_47382)(Cellseq47320* s, Cell47304* c);
N_NOCONV(void*, alloc_7401)(NI size);
N_NOCONV(void, dealloc_7448)(void* p);
N_NIMCALL(void, dealloc_46022)(Memregion29487* allocator, void* p);
N_NIMCALL(void, rawdealloc_43017)(Memregion29487* a, void* p);
N_NIMCALL(void, freebigchunk_32203)(Memregion29487* a, Bigchunk29441* c_32207);
N_NIMCALL(void, excl_30764)(Intset29414* s, NI key);
N_NIMCALL(void, freeoschunks_31807)(Memregion29487* a, void* p, NI size);
static N_INLINE(void, osdeallocpages_29228)(void* p, NI size);
static N_INLINE(void, deccurrmem_29616)(Memregion29487* a, NI bytes);
N_NIMCALL(void, del_30601)(Memregion29487* a, Avlnode29485** t, NI x);
static N_INLINE(void, deallocavlnode_30403)(Memregion29487* a, Avlnode29485* n);
N_NIMCALL(void, markthreadstacks_71003)(Gcheap49618* gch);
N_NIMCALL(NIM_BOOL, collectzct_69806)(Gcheap49618* gch);
static N_INLINE(NIM_BOOL, canbecycleroot_51258)(Cell47304* c);
N_NIMCALL(void, excl_48074)(Cellset47316* s, Cell47304* cell);
N_NIMCALL(Pagedesc47312*, cellsetget_47449)(Cellset47316 t, NI key);
static N_INLINE(NI, nexttry_47444)(NI h, NI maxhash);
N_NIMCALL(void, preparedealloc_51808)(Cell47304* cell);
static N_INLINE(void*, celltousr_51222)(Cell47304* cell);
N_NIMCALL(void, forallchildren_51614)(Cell47304* cell, NU8 op);
N_NIMCALL(void, forallchildrenaux_51622)(void* dest, TNimType* mt, NU8 op);
N_NIMCALL(void, dooperation_51618)(void* p, NU8 op);
static N_INLINE(void, decref_53201)(Cell47304* c);
static N_INLINE(void, rtladdzct_52801)(Cell47304* c);
N_NOINLINE(void, addzct_51217)(Cellseq47320* s, Cell47304* c);
static N_INLINE(void, rtladdcycleroot_52020)(Cell47304* c);
N_NOINLINE(void, incl_48047)(Cellset47316* s, Cell47304* cell);
N_NIMCALL(Pagedesc47312*, cellsetput_47841)(Cellset47316* t, NI key);
N_NIMCALL(void, cellsetenlarge_47803)(Cellset47316* t);
N_NIMCALL(void, cellsetrawinsert_47469)(Cellset47316 t, Pagedesc47312** data, Pagedesc47312* desc);
N_NIMCALL(void, markgray_66802)(Cell47304* s);
N_NIMCALL(void, scan_67201)(Cell47304* s);
N_NIMCALL(void, scanblack_67001)(Cell47304* s);
N_NIMCALL(void, collectwhite_67401)(Cell47304* s);
N_NIMCALL(NIM_BOOL, isallocatedptr_36402)(Memregion29487* a, void* p);
N_NIMCALL(void, freecycliccell_66015)(Gcheap49618* gch, Cell47304* c);
N_NIMCALL(void, forallslotsaux_55805)(void* dest, TNimNode* n, NU8 op);
N_NIMCALL(TNimNode*, selectbranch_27607)(void* aa, TNimNode* n);
N_NIMCALL(NI, getdiscriminant_27204)(void* aa, TNimNode* n);
N_NIMCALL(void, collectcycles_70020)(Gcheap49618* gch);
N_NIMCALL(void, markroots_67602)(Gcheap49618* gch);
N_NIMCALL(void, collectroots_70001)(Gcheap49618* gch);
N_NIMCALL(void, cellsetreset_55801)(Cellset47316* s);
N_NIMCALL(void, deinit_47425)(Cellset47316* s);
N_NIMCALL(NI, getoccupiedmem_8055)(void);
N_NIMCALL(NI, gettotalmem_8059)(void);
N_NIMCALL(NI, getfreemem_8057)(void);
N_NIMCALL(void, unmarkstackandregisters_75002)(Gcheap49618* gch);
static N_INLINE(void, addnewobjtozct_56874)(Cell47304* res, Gcheap49618* gch);
N_NIMCALL(void, writetostderr_19401)(NCSTRING msg);
N_NIMCALL(void, write_15501)(FILE* f, NCSTRING c);
N_NIMCALL(void, registersignalhandler_23002)(void);
N_NIMCALL(NI, getRefcount)(void* p);
N_NIMCALL(void*, newObjRC1)(TNimType* typ, NI size);
static N_INLINE(NI, addInt)(NI a, NI b);
N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, sysfatal_23862)(NimStringDesc* message) __attribute__((noreturn));
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP52)(void* p, NI op);
N_NIMCALL(void, TMP53)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void, raiseException)(Exception* e, NCSTRING ename);
N_NIMCALL(void, raiseexceptionaux_20601)(Exception* e);
static N_INLINE(void, pushCurrentException)(Exception* e);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_53619)(Cell47304* c);
static N_INLINE(NIM_BOOL, isObjWithCache)(TNimType* obj, TNimType* subclass, TNimType** cache);
N_NOINLINE(NIM_BOOL, isobjslowpath_23734)(TNimType* obj, TNimType* subclass, TNimType** cache);
static N_INLINE(void, quitordebug_20404)(void);
N_NIMCALL(NI, mulInt)(NI a, NI b);
N_NIMCALL(void, rawwrite_26202)(FILE* f, NimStringDesc* s);
N_NIMCALL(NI, writebuffer_15576)(FILE* f, void* buffer, NI len);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
static N_INLINE(NI, resize_79001)(NI old);
N_NIMCALL(void*, growobj_66009)(void* old, NI newsize);
N_NIMCALL(void*, growobj_63203)(void* old, NI newsize, Gcheap49618* gch);
N_NOINLINE(void, procaddrerror_26209)(NCSTRING name);
N_NOINLINE(NIM_BOOL, isonstack_51611)(void* p);
static N_INLINE(void, sysfatal_23618)(NimStringDesc* message) __attribute__((noreturn));
N_NIMCALL(void, TMP151)(void* p, NI op);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(void, genericresetaux_84601)(void* dest, TNimNode* n);
N_NIMCALL(void, genericReset)(void* dest, TNimType* mt);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_79610, NI last);
N_NIMCALL(void, genericassignaux_84606)(void* dest, void* src, TNimType* mt, NIM_BOOL shallow);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(void, genericassignaux_84612)(void* dest, void* src, TNimNode* n, NIM_BOOL shallow);
N_NOINLINE(void, raiseeio_81005)(NimStringDesc* msg) __attribute__((noreturn));
static N_INLINE(void, sysfatal_81010)(NimStringDesc* message) __attribute__((noreturn));
N_NIMCALL(void, TMP441)(void* p, NI op);
N_NIMCALL(void*, fopen_84010)(NCSTRING filename, NCSTRING mode);
N_NIMCALL(NI16*, newwidecstring_83523)(NCSTRING s);
N_NIMCALL(NI16*, newwidecstring_83412)(NCSTRING source, NI L);
N_NIMCALL(void, TMP503)(void* p, NI op);
N_NIMCALL(void, TMP927)(void* p, NI op);
N_NIMCALL(TNimType*, extGetCellType)(void* c);
N_NIMCALL(NIM_BOOL, open_15403)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
static N_INLINE(void, sysfatal_15426)(NimStringDesc* message, NimStringDesc* arg) __attribute__((noreturn));
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(void, sysfatal_21217)(NimStringDesc* message) __attribute__((noreturn));
N_NIMCALL(void, TMP1065)(void* p, NI op);
N_NIMCALL(NIM_CHAR, getdecimalpoint_80406)(void);
N_NIMCALL(void, TMP1206)(void* p, NI op);
N_NIMCALL(NimStringDesc*, HEX24_83606)(NI16* w, NI estimate, NI replacement);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(void, objectinitaux_85478)(void* dest, TNimNode* n);
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(void, TMP1243)(void* p, NI op);
N_NIMCALL(void*, realloc_47004)(Memregion29487* allocator, void* p, NI newsize);
N_NIMCALL(NI, ptrsize_45613)(void* p);
N_NIMCALL(void, genericAssign)(void* dest, void* src, TNimType* mt);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_533149)(TY216913* x, TY216913* y);
static N_INLINE(void*, seqtoptr_533160)(TY216913* x);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(FILE*, open_15417)(NimStringDesc* filename, NU8 mode, NI bufsize);
static N_INLINE(void, pushSafePoint)(TSafePoint* s);
N_NIMCALL(NimStringDesc*, readall_15463)(FILE* file);
N_NIMCALL(NI, rawfilesize_81666)(FILE* file);
N_NIMCALL(NimStringDesc*, readallfile_81672)(FILE* file, NI len);
N_NIMCALL(NI, readbuffer_15554)(FILE* f, void* buffer, NI len);
N_NIMCALL(NIM_BOOL, endoffile_15454)(FILE* f);
N_NIMCALL(NimStringDesc*, readallbuffer_81658)(FILE* file);
static N_INLINE(void, popSafePoint)(void);
N_NIMCALL(void, reraiseException)(void);
N_NIMCALL(void, write_15489)(FILE* f, NimStringDesc* s);
N_NIMCALL(NIM_BOOL, readline_15513)(FILE* f, NimStringDesc** line);
static N_INLINE(void, sysfatal_89898)(NimStringDesc* message) __attribute__((noreturn));
N_NIMCALL(void, TMP2317)(void* p, NI op);
static N_INLINE(void*, seqtoptr_250938)(Ttypeseq216824* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_250927)(Ttypeseq216824* x, Ttypeseq216824* y);
static N_INLINE(void*, seqtoptr_219875)(TY216925* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_219864)(TY216925* x, TY216925* y);
static N_INLINE(void*, seqtoptr_284355)(Tnodeseq216784* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_284344)(Tnodeseq216784* x, Tnodeseq216784* y);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
static N_INLINE(void*, seqtoptr_430822)(Tsymseq216792* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_430811)(Tsymseq216792* x, Tsymseq216792* y);
static N_INLINE(void*, seqtoptr_309494)(TY308653* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_309431)(Jsonnodeobj308633* a, Jsonnodeobj308633* b);
static N_INLINE(void*, seqtoptr_309582)(TY308648* x);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_309649)(TY309043 x, TY309043 y);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, TMP5289)(void* p, NI op);
static N_INLINE(void, Gcdisable_9801)(void);
N_NIMCALL(NimStringDesc*, nimInt64ToStr)(NI64 x);
static N_INLINE(void, Gcenable_9803)(void);
STRING_LITERAL(TMP2, "out of memory", 13);
STRING_LITERAL(TMP55, "over- or underflow", 18);
STRING_LITERAL(TMP141, "could not load: ", 16);
STRING_LITERAL(TMP142, "\015\012", 2);
STRING_LITERAL(TMP143, "_", 1);
STRING_LITERAL(TMP144, "@", 1);
STRING_LITERAL(TMP145, "could not import: ", 18);
STRING_LITERAL(TMP152, "attempt to write to a nil address", 33);
STRING_LITERAL(TMP442, "cannot write string to file", 27);
STRING_LITERAL(TMP504, "rb", 2);
STRING_LITERAL(TMP505, "wb", 2);
STRING_LITERAL(TMP506, "w+b", 3);
STRING_LITERAL(TMP507, "r+b", 3);
STRING_LITERAL(TMP508, "ab", 2);
NIM_CONST TY84028 Formatopen_84025 = {((NimStringDesc*) &TMP504),
((NimStringDesc*) &TMP505),
((NimStringDesc*) &TMP506),
((NimStringDesc*) &TMP507),
((NimStringDesc*) &TMP508)}
;
STRING_LITERAL(TMP1064, "cannot open: ", 13);
STRING_LITERAL(TMP1066, "no exception to reraise", 23);
STRING_LITERAL(TMP1067, "(", 1);
STRING_LITERAL(TMP1068, ", ", 2);
STRING_LITERAL(TMP1069, "filename", 8);
STRING_LITERAL(TMP1070, ": ", 2);
STRING_LITERAL(TMP1071, "nil", 3);
STRING_LITERAL(TMP1072, "line", 4);
STRING_LITERAL(TMP1073, ")", 1);
STRING_LITERAL(TMP1118, " (invalid data!)", 16);
STRING_LITERAL(TMP1399, "nan", 3);
STRING_LITERAL(TMP1400, "-inf", 4);
STRING_LITERAL(TMP1401, "inf", 3);
STRING_LITERAL(TMP1563, "error while reading from file", 29);
STRING_LITERAL(TMP1564, "", 0);
STRING_LITERAL(TMP1930, "EOF reached", 11);
STRING_LITERAL(TMP2837, "cannot set file position", 24);
STRING_LITERAL(TMP2838, "cannot retrieve file position", 29);
STRING_LITERAL(TMP3075, "0", 1);
STRING_LITERAL(TMP3140, "true", 4);
STRING_LITERAL(TMP3141, "false", 5);
STRING_LITERAL(TMP5301, "[GC] total memory: ", 19);
STRING_LITERAL(TMP5302, "\015\012[GC] occupied memory: ", 24);
STRING_LITERAL(TMP5303, "\015\012[GC] stack scans: ", 20);
STRING_LITERAL(TMP5304, "\015\012[GC] stack cells: ", 20);
STRING_LITERAL(TMP5305, "\015\012[GC] cycle collections: ", 26);
STRING_LITERAL(TMP5306, "\015\012[GC] max threshold: ", 22);
STRING_LITERAL(TMP5307, "\015\012[GC] zct capacity: ", 21);
STRING_LITERAL(TMP5308, "\015\012[GC] max cycle table size: ", 29);
STRING_LITERAL(TMP5309, "\015\012[GC] max pause time [ms]: ", 28);
STRING_LITERAL(TMP5310, "[GC] max stack size: ", 21);
NIM_BOOL nimvm_5751;
NI nim_program_result;
TY10009 globalraisehook_10013;
TY10014 localraisehook_10018;
TY10019 outofmemhook_10021;
TNimType strdesc_12203;
TY19201 errormessagewriter_19204;
TFrame* frameptr_19436;
TSafePoint* exchandler_19437;
Exception* currexception_19439;
TY19803 tempframes_19804;
Avlnode29485 bottomdata_29518;
Avlnode29485* bottom_29519;
Gcheap49618 gch_49659;
NIM_BOOL localgcinitialized_71424;
NIM_CHAR decimalpoint_80405;
TNimType NTI3608; /* RootObj */
TNimType NTI104; /* int */
TNimType NTI138; /* string */
TNimType NTI3624; /* Exception */
TNimType NTI10010; /* ref Exception */
TNimType NTI140; /* cstring */
TNimType NTI3636; /* ArithmeticError */
TNimType NTI3640; /* OverflowError */
TNimType NTI23869; /* ref OverflowError */
TNimType NTI3626; /* SystemError */
TNimType NTI3650; /* OutOfMemError */
static TNimType* Nim_OfCheck_CACHE1[2];
TNimType NTI110; /* int32 */
TNimType NTI3646; /* ValueError */
TNimType NTI23625; /* ref ValueError */
TNimType NTI108; /* int16 */
TNimType NTI3628; /* IOError */
TNimType NTI81017; /* ref IOError */
TNimType NTI82407; /* array[0..1000000, Utf16Char] */
TNimType NTI82404; /* WideCString */
TNimType NTI130; /* bool */
TNimType NTI7088; /* BiggestInt */
TNimType NTI7090; /* BiggestFloat */
TNimType NTI142; /* pointer */
TNimType NTI116; /* uint8 */
TNimType NTI3610; /* RootRef */
TNimType NTI3660; /* ReraiseError */
TNimType NTI21224; /* ref ReraiseError */
TNimType NTI29418; /* array[0..15, int] */
extern TNimType NTI216784; /* TNodeSeq */
TNimType NTI3604; /* Natural */
TNimType NTI3630; /* OSError */
TNimType NTI120028; /* ref OSError */
TNimType NTI124; /* float */
TNimType NTI15002; /* CFile */
TNimType NTI15004; /* File */
TNimType NTI106; /* int8 */
TNimType NTI3648; /* KeyError */
TNimType NTI184804; /* ref KeyError */
TNimType NTI3656; /* RangeError */
extern TNimType NTI216913; /* seq[int32] */
TNimType NTI120; /* uint32 */
TNimType NTI3644; /* AssertionError */
TNimType NTI89905; /* ref AssertionError */
extern TNimType NTI216824; /* TTypeSeq */
TNimType NTI136; /* char */
TNimType NTI15008; /* FileHandle */
TNimType NTI7208; /* cint */
extern TNimType NTI216814; /* PInstantiation */
extern TNimType NTI216925; /* seq[PInstantiation] */
TNimType NTI3638; /* DivByZeroError */
extern TNimType NTI216792; /* TSymSeq */
TNimType NTI527219; /* seq[SocketHandle] */

static N_INLINE(void, initallocator_11601)(void) {
	bottom_29519 = (&bottomdata_29518);
	(*bottom_29519).link[(((NI) 0))- 0] = bottom_29519;
	(*bottom_29519).link[(((NI) 1))- 0] = bottom_29519;
}

N_NOINLINE(void, setStackBottom)(void* thestackbottom) {
	{
		if (!(gch_49659.stackbottom == NIM_NIL)) goto LA3;
		gch_49659.stackbottom = thestackbottom;
	}
	goto LA1;
	LA3: ;
	{
		NI a;
		NI b;
		a = ((NI) (thestackbottom));
		b = ((NI) (gch_49659.stackbottom));
		gch_49659.stackbottom = ((void*) (((a >= b) ? a : b)));
	}
	LA1: ;
}

static N_INLINE(void, initStackBottom)(void) {
	void* volatile locals;
	locals = 0;
	locals = ((void*) ((&locals)));
	setStackBottom(locals);
}

static N_INLINE(NI, roundup_28201)(NI x, NI v) {
	NI result;
	result = 0;
	result = (NI)((NI)(x + (NI)(v - ((NI) 1))) & (NI)((NU32) ~((NI)(v - ((NI) 1)))));
	return result;
}

static N_INLINE(void, listremove_33002)(Bigchunk29441** head, Bigchunk29441* c) {
	{
		if (!(c == (*head))) goto LA3;
		(*head) = (*c).next;
		{
			if (!!(((*head) == NIM_NIL))) goto LA7;
			(*(*head)).prev = NIM_NIL;
		}
		LA7: ;
	}
	goto LA1;
	LA3: ;
	{
		(*(*c).prev).next = (*c).next;
		{
			if (!!(((*c).next == NIM_NIL))) goto LA12;
			(*(*c).next).prev = (*c).prev;
		}
		LA12: ;
	}
	LA1: ;
	(*c).next = NIM_NIL;
	(*c).prev = NIM_NIL;
}

N_NIMCALL(Trunk29410*, intsetget_30683)(Intset29414* t, NI key) {
	Trunk29410* result;
	Trunk29410* it;
{	result = 0;
	it = (*t).data[((NI)(key & ((NI) 255)))- 0];
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA2;
			{
				if (!((*it).key == key)) goto LA5;
				result = it;
				goto BeforeRet;
			}
			LA5: ;
			it = (*it).next;
		} LA2: ;
	}
	result = NIM_NIL;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, contains_30732)(Intset29414* s, NI key) {
	NIM_BOOL result;
	Trunk29410* t;
	result = 0;
	t = intsetget_30683(s, (NI)((NU32)(key) >> (NU32)(((NI) 9))));
	{
		NI u;
		if (!!((t == NIM_NIL))) goto LA3;
		u = (NI)(key & ((NI) 511));
		result = !(((NI)((*t).bits[((NI)((NU32)(((NI) (u))) >> (NU32)(((NI) 5))))- 0] & (NI)((NU32)(((NI) 1)) << (NU32)(((NI) ((NI)(((NI) (u)) & ((NI) 31))))))) == ((NI) 0)));
	}
	goto LA1;
	LA3: ;
	{
		result = NIM_FALSE;
	}
	LA1: ;
	return result;
}

static N_INLINE(NI, pageindex_31175)(void* p) {
	NI result;
	result = 0;
	result = (NI)((NU32)(((NI) (p))) >> (NU32)(((NI) 12)));
	return result;
}

static N_INLINE(NIM_BOOL, isaccessible_32015)(Memregion29487* a, void* p) {
	NIM_BOOL result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = pageindex_31175(p);
	result = contains_30732((&(*a).chunkstarts), LOC1);
	return result;
}

static N_INLINE(void, updateprevsize_32068)(Memregion29487* a, Bigchunk29441* c, NI prevsize) {
	Basechunk29437* ri;
	ri = ((Basechunk29437*) ((NI)((NU32)(((NI) (c))) + (NU32)((*c).Sup.size))));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isaccessible_32015((&(*a)), ((void*) (ri)));
		if (!LOC3) goto LA4;
		(*ri).prevsize = prevsize;
	}
	LA4: ;
}

N_NOINLINE(void, raiseoutofmem_28033)(void) {
	{
		if (!!((outofmemhook_10021 == NIM_NIL))) goto LA3;
		outofmemhook_10021();
	}
	LA3: ;
	printf("%s\015\012", ((NimStringDesc*) &TMP2)? (((NimStringDesc*) &TMP2))->data:"nil");
	fflush(stdout);
	exit(((NI) 1));
}

static N_INLINE(void*, osallocpages_29223)(NI size) {
	void* result;
	result = 0;
	result = VirtualAlloc(NIM_NIL, size, ((NI32) 12288), ((NI32) 4));
	{
		if (!(result == NIM_NIL)) goto LA3;
		raiseoutofmem_28033();
	}
	LA3: ;
	return result;
}

static N_INLINE(void, inccurrmem_29602)(Memregion29487* a, NI bytes) {
	(*a).currmem += bytes;
}

N_NIMCALL(void*, llalloc_29643)(Memregion29487* a, NI size) {
	void* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Llchunk29481* old;
		void* LOC7;
		LOC3 = 0;
		LOC3 = ((*a).llmem == NIM_NIL);
		if (LOC3) goto LA4;
		LOC3 = ((*(*a).llmem).size < size);
		LA4: ;
		if (!LOC3) goto LA5;
		old = (*a).llmem;
		LOC7 = 0;
		LOC7 = osallocpages_29223(((NI) 4096));
		(*a).llmem = ((Llchunk29481*) (LOC7));
		inccurrmem_29602(a, ((NI) 4096));
		(*(*a).llmem).size = (NI)(((NI) 4096) - ((NI)sizeof(Llchunk29481)));
		(*(*a).llmem).acc = ((NI)sizeof(Llchunk29481));
		(*(*a).llmem).next = old;
	}
	LA5: ;
	result = ((void*) ((NI)(((NI) ((*a).llmem)) + (*(*a).llmem).acc)));
	(*(*a).llmem).size -= size;
	(*(*a).llmem).acc += size;
	zeroMem(result, ((NI) (size)));
	return result;
}

N_NIMCALL(Trunk29410*, intsetput_30705)(Memregion29487* a, Intset29414* t, NI key) {
	Trunk29410* result;
	result = 0;
	result = intsetget_30683((&(*t)), key);
	{
		void* LOC5;
		if (!(result == NIM_NIL)) goto LA3;
		LOC5 = 0;
		LOC5 = llalloc_29643(a, ((NI)sizeof(Trunk29410)));
		result = ((Trunk29410*) (LOC5));
		(*result).next = (*t).data[((NI)(key & ((NI) 255)))- 0];
		(*t).data[((NI)(key & ((NI) 255)))- 0] = result;
		(*result).key = key;
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, incl_30753)(Memregion29487* a, Intset29414* s, NI key) {
	Trunk29410* t;
	NI u;
	t = intsetput_30705(a, s, (NI)((NU32)(key) >> (NU32)(((NI) 9))));
	u = (NI)(key & ((NI) 511));
	(*t).bits[((NI)((NU32)(((NI) (u))) >> (NU32)(((NI) 5))))- 0] = (NI)((*t).bits[((NI)((NU32)(((NI) (u))) >> (NU32)(((NI) 5))))- 0] | (NI)((NU32)(((NI) 1)) << (NU32)(((NI) ((NI)(((NI) (u)) & ((NI) 31)))))));
}

static N_INLINE(NI, pageindex_31170)(Basechunk29437* c) {
	NI result;
	result = 0;
	result = (NI)((NU32)(((NI) (c))) >> (NU32)(((NI) 12)));
	return result;
}

static N_INLINE(void, listadd_34223)(Bigchunk29441** head, Bigchunk29441* c) {
	(*c).next = (*head);
	{
		if (!!(((*head) == NIM_NIL))) goto LA3;
		(*(*head)).prev = c;
	}
	LA3: ;
	(*head) = c;
}

N_NIMCALL(void, splitchunk_35009)(Memregion29487* a, Bigchunk29441* c, NI size) {
	Bigchunk29441* rest;
	Basechunk29437* LOC1;
	NI LOC2;
	rest = ((Bigchunk29441*) ((NI)((NU32)(((NI) (c))) + (NU32)(size))));
	(*rest).Sup.size = (NI)((*c).Sup.size - size);
	(*rest).Sup.used = NIM_FALSE;
	(*rest).next = NIM_NIL;
	(*rest).prev = NIM_NIL;
	(*rest).Sup.prevsize = size;
	updateprevsize_32068(a, c, (*rest).Sup.size);
	(*c).Sup.size = size;
	LOC1 = 0;
	LOC1 = &rest->Sup;
	LOC2 = 0;
	LOC2 = pageindex_31170(LOC1);
	incl_30753(a, (&(*a).chunkstarts), LOC2);
	listadd_34223(&(*a).freechunkslist, rest);
}

N_NIMCALL(Bigchunk29441*, requestoschunks_31187)(Memregion29487* a, NI size) {
	Bigchunk29441* result;
	void* LOC1;
	NI nxt;
	Basechunk29437* next;
	NI lastsize;
	NI prv;
	Basechunk29437* prev;
	result = 0;
	inccurrmem_29602(a, size);
	(*a).freemem += size;
	LOC1 = 0;
	LOC1 = osallocpages_29223(size);
	result = ((Bigchunk29441*) (LOC1));
	(*result).next = NIM_NIL;
	(*result).prev = NIM_NIL;
	(*result).Sup.used = NIM_FALSE;
	(*result).Sup.size = size;
	nxt = (NI)((NU32)(((NI) (result))) + (NU32)(size));
	next = ((Basechunk29437*) (nxt));
	{
		NI LOC4;
		NIM_BOOL LOC5;
		LOC4 = 0;
		LOC4 = pageindex_31170(next);
		LOC5 = 0;
		LOC5 = contains_30732((&(*a).chunkstarts), LOC4);
		if (!LOC5) goto LA6;
		(*next).prevsize = size;
	}
	LA6: ;
	{
		if (!!(((*a).lastsize == ((NI) 0)))) goto LA10;
		lastsize = (*a).lastsize;
	}
	goto LA8;
	LA10: ;
	{
		lastsize = ((NI) 4096);
	}
	LA8: ;
	prv = (NI)((NU32)(((NI) (result))) - (NU32)(lastsize));
	prev = ((Basechunk29437*) (prv));
	{
		NIM_BOOL LOC15;
		NI LOC16;
		LOC15 = 0;
		LOC16 = 0;
		LOC16 = pageindex_31170(prev);
		LOC15 = contains_30732((&(*a).chunkstarts), LOC16);
		if (!(LOC15)) goto LA17;
		LOC15 = ((*prev).size == lastsize);
		LA17: ;
		if (!LOC15) goto LA18;
		(*result).Sup.prevsize = lastsize;
	}
	goto LA13;
	LA18: ;
	{
		(*result).Sup.prevsize = ((NI) 0);
	}
	LA13: ;
	(*a).lastsize = size;
	return result;
}

N_NIMCALL(Bigchunk29441*, getbigchunk_35214)(Memregion29487* a, NI size) {
	Bigchunk29441* result;
	Basechunk29437* LOC16;
	NI LOC17;
	result = 0;
	result = (*a).freechunkslist;
	{
		{
			while (1) {
				if (!!((result == NIM_NIL))) goto LA3;
				{
					if (!((*result).Sup.size == size)) goto LA6;
					listremove_33002(&(*a).freechunkslist, result);
					goto LA1;
				}
				goto LA4;
				LA6: ;
				{
					if (!(size < (*result).Sup.size)) goto LA9;
					listremove_33002(&(*a).freechunkslist, result);
					splitchunk_35009(a, result, size);
					goto LA1;
				}
				goto LA4;
				LA9: ;
				LA4: ;
				result = (*result).next;
			} LA3: ;
		}
		{
			if (!(size < ((NI) 524288))) goto LA13;
			result = requestoschunks_31187(a, ((NI) 524288));
			splitchunk_35009(a, result, size);
		}
		goto LA11;
		LA13: ;
		{
			result = requestoschunks_31187(a, size);
		}
		LA11: ;
	} LA1: ;
	(*result).Sup.prevsize = ((NI) 0);
	(*result).Sup.used = NIM_TRUE;
	LOC16 = 0;
	LOC16 = &result->Sup;
	LOC17 = 0;
	LOC17 = pageindex_31170(LOC16);
	incl_30753(a, (&(*a).chunkstarts), LOC17);
	(*a).freemem -= size;
	return result;
}

N_NIMCALL(Smallchunk29439*, getsmallchunk_36012)(Memregion29487* a) {
	Smallchunk29439* result;
	Bigchunk29441* res;
	result = 0;
	res = getbigchunk_35214(a, ((NI) 4096));
	result = ((Smallchunk29439*) (res));
	return result;
}

static N_INLINE(void, listadd_37616)(Smallchunk29439** head, Smallchunk29439* c) {
	(*c).next = (*head);
	{
		if (!!(((*head) == NIM_NIL))) goto LA3;
		(*(*head)).prev = c;
	}
	LA3: ;
	(*head) = c;
}

static N_INLINE(void, listremove_40402)(Smallchunk29439** head, Smallchunk29439* c) {
	{
		if (!(c == (*head))) goto LA3;
		(*head) = (*c).next;
		{
			if (!!(((*head) == NIM_NIL))) goto LA7;
			(*(*head)).prev = NIM_NIL;
		}
		LA7: ;
	}
	goto LA1;
	LA3: ;
	{
		(*(*c).prev).next = (*c).next;
		{
			if (!!(((*c).next == NIM_NIL))) goto LA12;
			(*(*c).next).prev = (*c).prev;
		}
		LA12: ;
	}
	LA1: ;
	(*c).next = NIM_NIL;
	(*c).prev = NIM_NIL;
}

N_NIMCALL(Avlnode29485*, allocavlnode_29827)(Memregion29487* a, NI key, NI upperbound) {
	Avlnode29485* result;
	result = 0;
	{
		if (!!(((*a).freeavlnodes == NIM_NIL))) goto LA3;
		result = (*a).freeavlnodes;
		(*a).freeavlnodes = (*(*a).freeavlnodes).link[(((NI) 0))- 0];
	}
	goto LA1;
	LA3: ;
	{
		void* LOC6;
		LOC6 = 0;
		LOC6 = llalloc_29643(a, ((NI)sizeof(Avlnode29485)));
		result = ((Avlnode29485*) (LOC6));
	}
	LA1: ;
	(*result).key = key;
	(*result).upperbound = upperbound;
	(*result).link[(((NI) 0))- 0] = bottom_29519;
	(*result).link[(((NI) 1))- 0] = bottom_29519;
	(*result).level = ((NI) 1);
	return result;
}

N_NIMCALL(void, skew_30534)(Avlnode29485** t) {
	{
		Avlnode29485* temp;
		if (!((*(*(*t)).link[(((NI) 0))- 0]).level == (*(*t)).level)) goto LA3;
		temp = (*t);
		(*t) = (*(*t)).link[(((NI) 0))- 0];
		(*temp).link[(((NI) 0))- 0] = (*(*t)).link[(((NI) 1))- 0];
		(*(*t)).link[(((NI) 1))- 0] = temp;
	}
	LA3: ;
}

N_NIMCALL(void, split_30539)(Avlnode29485** t) {
	{
		Avlnode29485* temp;
		if (!((*(*(*(*t)).link[(((NI) 1))- 0]).link[(((NI) 1))- 0]).level == (*(*t)).level)) goto LA3;
		temp = (*t);
		(*t) = (*(*t)).link[(((NI) 1))- 0];
		(*temp).link[(((NI) 1))- 0] = (*(*t)).link[(((NI) 0))- 0];
		(*(*t)).link[(((NI) 0))- 0] = temp;
		(*(*t)).level += ((NI) 1);
	}
	LA3: ;
}

N_NIMCALL(void, add_30553)(Memregion29487* a, Avlnode29485** t, NI key, NI upperbound) {
	{
		if (!((*t) == bottom_29519)) goto LA3;
		(*t) = allocavlnode_29827(a, key, upperbound);
	}
	goto LA1;
	LA3: ;
	{
		{
			if (!((NU32)(key) < (NU32)((*(*t)).key))) goto LA8;
			add_30553(a, &(*(*t)).link[(((NI) 0))- 0], key, upperbound);
		}
		goto LA6;
		LA8: ;
		{
			if (!((NU32)((*(*t)).key) < (NU32)(key))) goto LA11;
			add_30553(a, &(*(*t)).link[(((NI) 1))- 0], key, upperbound);
		}
		goto LA6;
		LA11: ;
		{
		}
		LA6: ;
		skew_30534(t);
		split_30539(t);
	}
	LA1: ;
}

N_NIMCALL(void*, rawalloc_36668)(Memregion29487* a, NI requestedsize) {
	void* result;
	NI size;
	result = 0;
	size = roundup_28201(requestedsize, ((NI) 8));
	{
		NI s;
		Smallchunk29439* c;
		if (!(size <= (NI)(((NI) 4096) - (NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))))) goto LA3;
		s = (NI)(size / ((NI) 8));
		c = (*a).freesmallchunks[(s)- 0];
		{
			if (!(c == NIM_NIL)) goto LA7;
			c = getsmallchunk_36012(a);
			(*c).freelist = NIM_NIL;
			(*c).Sup.size = size;
			(*c).acc = size;
			(*c).free = (NI)((NI)(((NI) 4096) - (NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))) - size);
			(*c).next = NIM_NIL;
			(*c).prev = NIM_NIL;
			listadd_37616(&(*a).freesmallchunks[(s)- 0], c);
			result = ((void*) ((&(*c).data)));
		}
		goto LA5;
		LA7: ;
		{
			{
				if (!((*c).freelist == NIM_NIL)) goto LA12;
				result = ((void*) ((NI)((NU32)(((NI) ((&(*c).data)))) + (NU32)((*c).acc))));
				(*c).acc += size;
			}
			goto LA10;
			LA12: ;
			{
				result = ((void*) ((*c).freelist));
				(*c).freelist = (*(*c).freelist).next;
			}
			LA10: ;
			(*c).free -= size;
		}
		LA5: ;
		{
			if (!((*c).free < size)) goto LA17;
			listremove_40402(&(*a).freesmallchunks[(s)- 0], c);
		}
		LA17: ;
	}
	goto LA1;
	LA3: ;
	{
		Bigchunk29441* c;
		size = roundup_28201((NI)(requestedsize + (NI)(((NI)sizeof(Bigchunk29441)) - ((NI) 8))), ((NI) 4096));
		c = getbigchunk_35214(a, size);
		result = ((void*) ((&(*c).data)));
		{
			if (!((*a).root == NIM_NIL)) goto LA22;
			(*a).root = bottom_29519;
		}
		LA22: ;
		add_30553(a, &(*a).root, ((NI) (result)), (NI)((NU32)(((NI) (result))) + (NU32)(size)));
	}
	LA1: ;
	return result;
}

N_NIMCALL(void*, alloc_45840)(Memregion29487* allocator, NI size) {
	void* result;
	result = 0;
	result = rawalloc_36668(allocator, (NI)(((NI) (size)) + ((NI)sizeof(Freecell29429))));
	(*((Freecell29429*) (result))).zerofield = ((NI) 1);
	result = ((void*) ((NI)((NU32)(((NI) (result))) + (NU32)(((NI)sizeof(Freecell29429))))));
	return result;
}

N_NIMCALL(void*, alloc0_46016)(Memregion29487* allocator, NI size) {
	void* result;
	result = 0;
	result = alloc_45840(allocator, size);
	zeroMem(result, size);
	return result;
}

N_NOCONV(void*, alloc0_7417)(NI size) {
	void* result;
	result = 0;
	result = alloc0_46016((&gch_49659.region), size);
	return result;
}

N_NIMCALL(void, init_47402)(Cellseq47320* s, NI cap) {
	void* LOC1;
	(*s).len = ((NI) 0);
	(*s).cap = cap;
	LOC1 = 0;
	LOC1 = alloc0_7417(((NI) ((NI)(cap * ((NI) 4)))));
	(*s).d = ((Cell47304**) (LOC1));
}

N_NIMCALL(void, init_47417)(Cellset47316* s) {
	void* LOC1;
	LOC1 = 0;
	LOC1 = alloc0_7417(((NI) 4096));
	(*s).data = ((Pagedesc47312**) (LOC1));
	(*s).max = ((NI) 1023);
	(*s).counter = ((NI) 0);
	(*s).head = NIM_NIL;
}

N_NIMCALL(void, initgc_11401)(void) {
	gch_49659.cyclethreshold = ((NI) 4194304);
	gch_49659.stat.stackscans = ((NI) 0);
	gch_49659.stat.cyclecollections = ((NI) 0);
	gch_49659.stat.maxthreshold = ((NI) 0);
	gch_49659.stat.maxstacksize = ((NI) 0);
	gch_49659.stat.maxstackcells = ((NI) 0);
	gch_49659.stat.cycletablesize = ((NI) 0);
	init_47402((&gch_49659.zct), ((NI) 1024));
	init_47402((&gch_49659.tempstack), ((NI) 1024));
	init_47417((&gch_49659.cycleroots));
	init_47402((&gch_49659.decstack), ((NI) 1024));
}

N_NOINLINE(NI, stacksize_71401)(void) {
	NI result;
	void* volatile stacktop;
	result = 0;
	stacktop = 0;
	result = ((NI)(((NI) ((&stacktop))) - ((NI) (gch_49659.stackbottom))) > 0? ((NI)(((NI) ((&stacktop))) - ((NI) (gch_49659.stackbottom)))) : -((NI)(((NI) ((&stacktop))) - ((NI) (gch_49659.stackbottom)))));
	return result;
}

static N_INLINE(NI, getoccupiedmem_47229)(Memregion29487* a) {
	NI result;
	result = 0;
	result = (NI)((*a).currmem - (*a).freemem);
	return result;
}

N_NIMCALL(NI, lowgauge_30412)(Avlnode29485* n) {
	NI result;
	Avlnode29485* it;
	result = 0;
	it = n;
	{
		while (1) {
			if (!!((it == bottom_29519))) goto LA2;
			result = (*it).key;
			it = (*it).link[(((NI) 0))- 0];
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NI, highgauge_30429)(Avlnode29485* n) {
	NI result;
	Avlnode29485* it;
	result = 0;
	result = ((NI) -1);
	it = n;
	{
		while (1) {
			if (!!((it == bottom_29519))) goto LA2;
			result = (*it).upperbound;
			it = (*it).link[(((NI) 1))- 0];
		} LA2: ;
	}
	return result;
}

static N_INLINE(void, prepareforinteriorpointerchecking_44688)(Memregion29487* a) {
	(*a).minlargeobj = lowgauge_30412((*a).root);
	(*a).maxlargeobj = highgauge_30429((*a).root);
}

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

static N_INLINE(Basechunk29437*, pageaddr_31180)(void* p) {
	Basechunk29437* result;
	result = 0;
	result = ((Basechunk29437*) ((NI)(((NI) (p)) & ((NI) -4096))));
	return result;
}

static N_INLINE(NIM_BOOL, chunkunused_31089)(Basechunk29437* c) {
	NIM_BOOL result;
	result = 0;
	result = !((*c).used);
	return result;
}

static N_INLINE(NIM_BOOL, issmallchunk_31069)(Basechunk29437* c) {
	NIM_BOOL result;
{	result = 0;
	result = ((*c).size <= (NI)(((NI) 4096) - (NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))));
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Avlnode29485*, inrange_30481)(Avlnode29485* root, NI key) {
	Avlnode29485* result;
	Avlnode29485* it;
{	result = 0;
	it = root;
	{
		while (1) {
			if (!!((it == bottom_29519))) goto LA2;
			{
				NIM_BOOL LOC5;
				LOC5 = 0;
				LOC5 = ((NU32)((*it).key) <= (NU32)(key));
				if (!(LOC5)) goto LA6;
				LOC5 = ((NU32)(key) < (NU32)((*it).upperbound));
				LA6: ;
				if (!LOC5) goto LA7;
				result = it;
				goto BeforeRet;
			}
			LA7: ;
			it = (*it).link[(((NU32)((*it).key) < (NU32)(key)))- 0];
		} LA2: ;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void*, interiorallocatedptr_44692)(Memregion29487* a, void* p) {
	void* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Basechunk29437* c_44697;
		LOC3 = 0;
		LOC3 = isaccessible_32015(a, p);
		if (!LOC3) goto LA4;
		c_44697 = pageaddr_31180(p);
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = chunkunused_31089(c_44697);
			if (!!(LOC8)) goto LA9;
			{
				NIM_BOOL LOC13;
				Smallchunk29439* c;
				NI offset;
				LOC13 = 0;
				LOC13 = issmallchunk_31069(c_44697);
				if (!LOC13) goto LA14;
				c = ((Smallchunk29439*) (c_44697));
				offset = (NI)((NU32)(((NI) ((NI)(((NI) (p)) & ((NI) 4095))))) - (NU32)((NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))));
				{
					Freecell29429* d;
					if (!((NU32)(offset) < (NU32)((*c).acc))) goto LA18;
					d = ((Freecell29429*) ((NI)((NU32)((NI)((NU32)(((NI) ((&(*c).data)))) + (NU32)(offset))) - (NU32)((NI)((NU32)(offset) % (NU32)((*c).Sup.size))))));
					{
						if (!((NU32)(((NI) 1)) < (NU32)((*d).zerofield))) goto LA22;
						result = ((void*) (d));
					}
					LA22: ;
				}
				LA18: ;
			}
			goto LA11;
			LA14: ;
			{
				Bigchunk29441* c;
				NF* d;
				c = ((Bigchunk29441*) (c_44697));
				d = (&(*c).data);
				{
					NIM_BOOL LOC27;
					LOC27 = 0;
					LOC27 = (((void*) (d)) <= p);
					if (!(LOC27)) goto LA28;
					LOC27 = ((NU32)(((NI) 1)) < (NU32)((*((Freecell29429*) (d))).zerofield));
					LA28: ;
					if (!LOC27) goto LA29;
					result = ((void*) (d));
				}
				LA29: ;
			}
			LA11: ;
		}
		LA9: ;
	}
	goto LA1;
	LA4: ;
	{
		NI q;
		q = ((NI) (p));
		{
			NIM_BOOL LOC34;
			Avlnode29485* avlnode;
			LOC34 = 0;
			LOC34 = ((NU32)((*a).minlargeobj) <= (NU32)(q));
			if (!(LOC34)) goto LA35;
			LOC34 = ((NU32)(q) <= (NU32)((*a).maxlargeobj));
			LA35: ;
			if (!LOC34) goto LA36;
			avlnode = inrange_30481((*a).root, q);
			{
				void* k;
				Bigchunk29441* c;
				Basechunk29437* LOC42;
				if (!!((avlnode == NIM_NIL))) goto LA40;
				k = ((void*) ((*avlnode).key));
				LOC42 = 0;
				LOC42 = pageaddr_31180(k);
				c = ((Bigchunk29441*) (LOC42));
				{
					if (!((NU32)(((NI) 1)) < (NU32)((*((Freecell29429*) (k))).zerofield))) goto LA45;
					result = k;
				}
				LA45: ;
			}
			LA40: ;
		}
		LA36: ;
	}
	LA1: ;
	return result;
}

N_NOCONV(void*, alloc_7401)(NI size) {
	void* result;
	result = 0;
	result = alloc_45840((&gch_49659.region), size);
	return result;
}

N_NIMCALL(void, excl_30764)(Intset29414* s, NI key) {
	Trunk29410* t;
	t = intsetget_30683((&(*s)), (NI)((NU32)(key) >> (NU32)(((NI) 9))));
	{
		NI u;
		if (!!((t == NIM_NIL))) goto LA3;
		u = (NI)(key & ((NI) 511));
		(*t).bits[((NI)((NU32)(((NI) (u))) >> (NU32)(((NI) 5))))- 0] = (NI)((*t).bits[((NI)((NU32)(((NI) (u))) >> (NU32)(((NI) 5))))- 0] & (NI)((NU32) ~((NI)((NU32)(((NI) 1)) << (NU32)(((NI) ((NI)(((NI) (u)) & ((NI) 31)))))))));
	}
	LA3: ;
}

static N_INLINE(void, osdeallocpages_29228)(void* p, NI size) {
	VirtualFree(p, ((NI) 0), ((NI32) 32768));
}

static N_INLINE(void, deccurrmem_29616)(Memregion29487* a, NI bytes) {
	(*a).maxmem = (((*a).maxmem >= (*a).currmem) ? (*a).maxmem : (*a).currmem);
	(*a).currmem -= bytes;
}

N_NIMCALL(void, freeoschunks_31807)(Memregion29487* a, void* p, NI size) {
	Basechunk29437* c;
	NI nxt;
	Basechunk29437* next;
	NI LOC7;
	c = ((Basechunk29437*) (p));
	nxt = (NI)((NU32)(((NI) (p))) + (NU32)((*c).size));
	next = ((Basechunk29437*) (nxt));
	{
		NI LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC3 = pageindex_31170(next);
		LOC4 = 0;
		LOC4 = contains_30732((&(*a).chunkstarts), LOC3);
		if (!LOC4) goto LA5;
		(*next).prevsize = ((NI) 0);
	}
	LA5: ;
	LOC7 = 0;
	LOC7 = pageindex_31175(p);
	excl_30764((&(*a).chunkstarts), LOC7);
	osdeallocpages_29228(p, size);
	deccurrmem_29616(a, size);
	(*a).freemem -= size;
}

N_NIMCALL(void, freebigchunk_32203)(Memregion29487* a, Bigchunk29441* c_32207) {
	Bigchunk29441* c;
	Basechunk29437* ri;
	c = c_32207;
	(*a).freemem += (*c).Sup.size;
	ri = ((Basechunk29437*) ((NI)((NU32)(((NI) (c))) + (NU32)((*c).Sup.size))));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isaccessible_32015((&(*a)), ((void*) (ri)));
		if (!(LOC3)) goto LA4;
		LOC3 = chunkunused_31089(ri);
		LA4: ;
		if (!LOC3) goto LA5;
		{
			NIM_BOOL LOC9;
			NI LOC12;
			LOC9 = 0;
			LOC9 = issmallchunk_31069(ri);
			if (!!(LOC9)) goto LA10;
			listremove_33002(&(*a).freechunkslist, ((Bigchunk29441*) (ri)));
			(*c).Sup.size += (*ri).size;
			LOC12 = 0;
			LOC12 = pageindex_31170(ri);
			excl_30764((&(*a).chunkstarts), LOC12);
		}
		LA10: ;
	}
	LA5: ;
	{
		Basechunk29437* le;
		if (!!(((*c).Sup.prevsize == ((NI) 0)))) goto LA15;
		le = ((Basechunk29437*) ((NI)((NU32)(((NI) (c))) - (NU32)((*c).Sup.prevsize))));
		{
			NIM_BOOL LOC19;
			LOC19 = 0;
			LOC19 = isaccessible_32015((&(*a)), ((void*) (le)));
			if (!(LOC19)) goto LA20;
			LOC19 = chunkunused_31089(le);
			LA20: ;
			if (!LOC19) goto LA21;
			{
				NIM_BOOL LOC25;
				Basechunk29437* LOC28;
				NI LOC29;
				LOC25 = 0;
				LOC25 = issmallchunk_31069(le);
				if (!!(LOC25)) goto LA26;
				listremove_33002(&(*a).freechunkslist, ((Bigchunk29441*) (le)));
				(*le).size += (*c).Sup.size;
				LOC28 = 0;
				LOC28 = &c->Sup;
				LOC29 = 0;
				LOC29 = pageindex_31170(LOC28);
				excl_30764((&(*a).chunkstarts), LOC29);
				c = ((Bigchunk29441*) (le));
			}
			LA26: ;
		}
		LA21: ;
	}
	LA15: ;
	{
		NIM_BOOL LOC32;
		Basechunk29437* LOC36;
		NI LOC37;
		LOC32 = 0;
		LOC32 = ((*c).Sup.size < ((NI) 1048576));
		if (LOC32) goto LA33;
		LOC32 = NIM_TRUE;
		LA33: ;
		if (!LOC32) goto LA34;
		LOC36 = 0;
		LOC36 = &c->Sup;
		LOC37 = 0;
		LOC37 = pageindex_31170(LOC36);
		incl_30753(a, (&(*a).chunkstarts), LOC37);
		updateprevsize_32068(a, c, (*c).Sup.size);
		listadd_34223(&(*a).freechunkslist, c);
		(*c).Sup.used = NIM_FALSE;
	}
	goto LA30;
	LA34: ;
	{
		freeoschunks_31807(a, ((void*) (c)), (*c).Sup.size);
	}
	LA30: ;
}

static N_INLINE(void, deallocavlnode_30403)(Memregion29487* a, Avlnode29485* n) {
	(*n).link[(((NI) 0))- 0] = (*a).freeavlnodes;
	(*a).freeavlnodes = n;
}

N_NIMCALL(void, del_30601)(Memregion29487* a, Avlnode29485** t, NI x) {
{	{
		if (!((*t) == bottom_29519)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	(*a).last = (*t);
	{
		if (!((NU32)(x) < (NU32)((*(*t)).key))) goto LA7;
		del_30601(a, &(*(*t)).link[(((NI) 0))- 0], x);
	}
	goto LA5;
	LA7: ;
	{
		(*a).deleted = (*t);
		del_30601(a, &(*(*t)).link[(((NI) 1))- 0], x);
	}
	LA5: ;
	{
		NIM_BOOL LOC12;
		NIM_BOOL LOC13;
		LOC12 = 0;
		LOC13 = 0;
		LOC13 = ((*t) == (*a).last);
		if (!(LOC13)) goto LA14;
		LOC13 = !(((*a).deleted == bottom_29519));
		LA14: ;
		LOC12 = LOC13;
		if (!(LOC12)) goto LA15;
		LOC12 = (x == (*(*a).deleted).key);
		LA15: ;
		if (!LOC12) goto LA16;
		(*(*a).deleted).key = (*(*t)).key;
		(*(*a).deleted).upperbound = (*(*t)).upperbound;
		(*a).deleted = bottom_29519;
		(*t) = (*(*t)).link[(((NI) 1))- 0];
		deallocavlnode_30403(a, (*a).last);
	}
	goto LA10;
	LA16: ;
	{
		NIM_BOOL LOC19;
		LOC19 = 0;
		LOC19 = ((*(*(*t)).link[(((NI) 0))- 0]).level < (NI)((*(*t)).level - ((NI) 1)));
		if (LOC19) goto LA20;
		LOC19 = ((*(*(*t)).link[(((NI) 1))- 0]).level < (NI)((*(*t)).level - ((NI) 1)));
		LA20: ;
		if (!LOC19) goto LA21;
		(*(*t)).level -= ((NI) 1);
		{
			if (!((*(*t)).level < (*(*(*t)).link[(((NI) 1))- 0]).level)) goto LA25;
			(*(*(*t)).link[(((NI) 1))- 0]).level = (*(*t)).level;
		}
		LA25: ;
		skew_30534(t);
		skew_30534(&(*(*t)).link[(((NI) 1))- 0]);
		skew_30534(&(*(*(*t)).link[(((NI) 1))- 0]).link[(((NI) 1))- 0]);
		split_30539(t);
		split_30539(&(*(*t)).link[(((NI) 1))- 0]);
	}
	goto LA10;
	LA21: ;
	LA10: ;
	}BeforeRet: ;
}

N_NIMCALL(void, rawdealloc_43017)(Memregion29487* a, void* p) {
	Basechunk29437* c_43201;
	c_43201 = pageaddr_31180(p);
	{
		NIM_BOOL LOC3;
		Smallchunk29439* c;
		NI s;
		Freecell29429* f;
		LOC3 = 0;
		LOC3 = issmallchunk_31069(c_43201);
		if (!LOC3) goto LA4;
		c = ((Smallchunk29439*) (c_43201));
		s = (*c).Sup.size;
		f = ((Freecell29429*) (p));
		(*f).zerofield = ((NI) 0);
		(*f).next = (*c).freelist;
		(*c).freelist = f;
		{
			if (!((*c).free < s)) goto LA8;
			listadd_37616(&(*a).freesmallchunks[((NI)(s / ((NI) 8)))- 0], c);
			(*c).free += s;
		}
		goto LA6;
		LA8: ;
		{
			(*c).free += s;
			{
				if (!((*c).free == (NI)(((NI) 4096) - (NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))))) goto LA13;
				listremove_40402(&(*a).freesmallchunks[((NI)(s / ((NI) 8)))- 0], c);
				(*c).Sup.size = ((NI) 4096);
				freebigchunk_32203(a, ((Bigchunk29441*) (c)));
			}
			LA13: ;
		}
		LA6: ;
	}
	goto LA1;
	LA4: ;
	{
		Bigchunk29441* c;
		c = ((Bigchunk29441*) (c_43201));
		(*a).deleted = bottom_29519;
		del_30601(a, &(*a).root, ((NI) ((&(*c).data))));
		freebigchunk_32203(a, c);
	}
	LA1: ;
}

N_NIMCALL(void, dealloc_46022)(Memregion29487* allocator, void* p) {
	void* x;
	x = ((void*) ((NI)((NU32)(((NI) (p))) - (NU32)(((NI)sizeof(Freecell29429))))));
	rawdealloc_43017(allocator, x);
}

N_NOCONV(void, dealloc_7448)(void* p) {
	dealloc_46022((&gch_49659.region), p);
}

static N_INLINE(void, add_47382)(Cellseq47320* s, Cell47304* c) {
	{
		Cell47304** d;
		void* LOC5;
		if (!((*s).cap <= (*s).len)) goto LA3;
		(*s).cap = (NI)((NI)((*s).cap * ((NI) 3)) / ((NI) 2));
		LOC5 = 0;
		LOC5 = alloc_7401(((NI) ((NI)((*s).cap * ((NI) 4)))));
		d = ((Cell47304**) (LOC5));
		memcpy(((void*) (d)), ((void*) ((*s).d)), ((NI) ((NI)((*s).len * ((NI) 4)))));
		dealloc_7448(((void*) ((*s).d)));
		(*s).d = d;
	}
	LA3: ;
	(*s).d[((*s).len)- 0] = c;
	(*s).len += ((NI) 1);
}

static N_INLINE(void, gcmark_70416)(Gcheap49618* gch, void* p) {
	Cell47304* cell;
	NI c;
	cell = usrtocell_51240(p);
	c = ((NI) (cell));
	{
		Cell47304* objstart;
		void* LOC5;
		if (!((NU32)(((NI) 4096)) < (NU32)(c))) goto LA3;
		LOC5 = 0;
		LOC5 = interiorallocatedptr_44692((&(*gch).region), ((void*) (cell)));
		objstart = ((Cell47304*) (LOC5));
		{
			if (!!((objstart == NIM_NIL))) goto LA8;
			(*objstart).refcount = (NI)((NU32)((*objstart).refcount) + (NU32)(((NI) 8)));
			add_47382((&(*gch).decstack), objstart);
		}
		LA8: ;
	}
	LA3: ;
}

N_CDECL(void, markstackandregisters_72637)(Gcheap49618* gch) {
	jmp_buf registers;
	{
		int LOC3;
		NI max;
		NI sp;
		LOC3 = 0;
		LOC3 = setjmp(registers);
		if (!(LOC3 == ((NI32) 0))) goto LA4;
		max = ((NI) ((*gch).stackbottom));
		sp = ((NI) ((&registers)));
		sp = (NI)(sp & ((NI) -4));
		{
			while (1) {
				if (!((NU32)(sp) < (NU32)((NI)(max - ((NI) 32))))) goto LA7;
				gcmark_70416(gch, ((void**) (sp))[(((NI) 0))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 1))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 2))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 3))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 4))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 5))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 6))- 0]);
				gcmark_70416(gch, ((void**) (sp))[(((NI) 7))- 0]);
				sp = (NI)((NU32)(sp) + (NU32)(((NI) 32)));
			} LA7: ;
		}
		{
			while (1) {
				if (!((NU32)(sp) <= (NU32)(max))) goto LA9;
				gcmark_70416(gch, (*((void**) (sp))));
				sp = (NI)((NU32)(sp) + (NU32)(((NI) 4)));
			} LA9: ;
		}
	}
	LA4: ;
}

N_NIMCALL(void, markthreadstacks_71003)(Gcheap49618* gch) {
}

static N_INLINE(NIM_BOOL, canbecycleroot_51258)(Cell47304* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).typ).flags &(1U<<((NU)(((NU8) 1))&7U)))!=0));
	return result;
}

static N_INLINE(NI, nexttry_47444)(NI h, NI maxhash) {
	NI result;
	result = 0;
	result = (NI)((NI)((NI)(((NI) 5) * h) + ((NI) 1)) & maxhash);
	return result;
}

N_NIMCALL(Pagedesc47312*, cellsetget_47449)(Cellset47316 t, NI key) {
	Pagedesc47312* result;
	NI h;
{	result = 0;
	h = (NI)(((NI) (key)) & t.max);
	{
		while (1) {
			if (!!((t.data[(h)- 0] == NIM_NIL))) goto LA2;
			{
				if (!((*t.data[(h)- 0]).key == key)) goto LA5;
				result = t.data[(h)- 0];
				goto BeforeRet;
			}
			LA5: ;
			h = nexttry_47444(h, t.max);
		} LA2: ;
	}
	result = NIM_NIL;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, excl_48074)(Cellset47316* s, Cell47304* cell) {
	NI u;
	Pagedesc47312* t;
	u = ((NI) (cell));
	t = cellsetget_47449((*s), (NI)((NU32)(u) >> (NU32)(((NI) 12))));
	{
		if (!!((t == NIM_NIL))) goto LA3;
		u = (NI)((NU32)((NI)((NU32)(u) % (NU32)(((NI) 4096)))) / (NU32)(((NI) 8)));
		(*t).bits[((NI)((NU32)(u) >> (NU32)(((NI) 5))))- 0] = (NI)((*t).bits[((NI)((NU32)(u) >> (NU32)(((NI) 5))))- 0] & (NI)((NU32) ~((NI)((NU32)(((NI) 1)) << (NU32)(((NI) ((NI)(u & ((NI) 31)))))))));
	}
	LA3: ;
}

static N_INLINE(void*, celltousr_51222)(Cell47304* cell) {
	void* result;
	result = 0;
	result = ((void*) ((NI)((NU32)(((NI) (cell))) + (NU32)(((NI)sizeof(Cell47304))))));
	return result;
}

N_NIMCALL(void, preparedealloc_51808)(Cell47304* cell) {
	{
		void* LOC5;
		if (!!(((*(*cell).typ).finalizer == NIM_NIL))) goto LA3;
		gch_49659.recgclock += ((NI) 1);
		LOC5 = 0;
		LOC5 = celltousr_51222(cell);
		((Finalizer) ((*(*cell).typ).finalizer))(LOC5);
		gch_49659.recgclock -= ((NI) 1);
	}
	LA3: ;
}

N_NOINLINE(void, addzct_51217)(Cellseq47320* s, Cell47304* c) {
	{
		if (!((NI)((*c).refcount & ((NI) 4)) == ((NI) 0))) goto LA3;
		(*c).refcount = (NI)((*c).refcount | ((NI) 4));
		add_47382(s, c);
	}
	LA3: ;
}

static N_INLINE(void, rtladdzct_52801)(Cell47304* c) {
	addzct_51217((&gch_49659.zct), c);
}

N_NIMCALL(void, cellsetrawinsert_47469)(Cellset47316 t, Pagedesc47312** data, Pagedesc47312* desc) {
	NI h;
	h = (NI)(((NI) ((*desc).key)) & t.max);
	{
		while (1) {
			if (!!((data[(h)- 0] == NIM_NIL))) goto LA2;
			h = nexttry_47444(h, t.max);
		} LA2: ;
	}
	data[(h)- 0] = desc;
}

N_NIMCALL(void, cellsetenlarge_47803)(Cellset47316* t) {
	NI oldmax;
	Pagedesc47312** n;
	void* LOC1;
	oldmax = (*t).max;
	(*t).max = (NI)((NI)((NI)((*t).max + ((NI) 1)) * ((NI) 2)) - ((NI) 1));
	LOC1 = 0;
	LOC1 = alloc0_7417(((NI) ((NI)((NI)((*t).max + ((NI) 1)) * ((NI) 4)))));
	n = ((Pagedesc47312**) (LOC1));
	{
		NI i_47819;
		NI res_47837;
		i_47819 = 0;
		res_47837 = ((NI) 0);
		{
			while (1) {
				if (!(res_47837 <= oldmax)) goto LA4;
				i_47819 = res_47837;
				{
					if (!!(((*t).data[(i_47819)- 0] == NIM_NIL))) goto LA7;
					cellsetrawinsert_47469((*t), n, (*t).data[(i_47819)- 0]);
				}
				LA7: ;
				res_47837 += ((NI) 1);
			} LA4: ;
		}
	}
	dealloc_7448(((void*) ((*t).data)));
	(*t).data = n;
}

N_NIMCALL(Pagedesc47312*, cellsetput_47841)(Cellset47316* t, NI key) {
	Pagedesc47312* result;
	NI h;
	void* LOC19;
{	result = 0;
	h = (NI)(((NI) (key)) & (*t).max);
	{
		while (1) {
			Pagedesc47312* x;
			x = (*t).data[(h)- 0];
			{
				if (!(x == NIM_NIL)) goto LA5;
				goto LA1;
			}
			LA5: ;
			{
				if (!((*x).key == key)) goto LA9;
				result = x;
				goto BeforeRet;
			}
			LA9: ;
			h = nexttry_47444(h, (*t).max);
		}
	} LA1: ;
	{
		NIM_BOOL LOC13;
		LOC13 = 0;
		LOC13 = ((NI)((NI)((*t).max + ((NI) 1)) * ((NI) 2)) < (NI)((*t).counter * ((NI) 3)));
		if (LOC13) goto LA14;
		LOC13 = ((NI)((NI)((*t).max + ((NI) 1)) - (*t).counter) < ((NI) 4));
		LA14: ;
		if (!LOC13) goto LA15;
		cellsetenlarge_47803(t);
	}
	LA15: ;
	(*t).counter += ((NI) 1);
	h = (NI)(((NI) (key)) & (*t).max);
	{
		while (1) {
			if (!!(((*t).data[(h)- 0] == NIM_NIL))) goto LA18;
			h = nexttry_47444(h, (*t).max);
		} LA18: ;
	}
	LOC19 = 0;
	LOC19 = alloc0_7417(((NI) (((NI)sizeof(Pagedesc47312)))));
	result = ((Pagedesc47312*) (LOC19));
	(*result).next = (*t).head;
	(*result).key = key;
	(*t).head = result;
	(*t).data[(h)- 0] = result;
	}BeforeRet: ;
	return result;
}

N_NOINLINE(void, incl_48047)(Cellset47316* s, Cell47304* cell) {
	NI u;
	Pagedesc47312* t;
	u = ((NI) (cell));
	t = cellsetput_47841(s, (NI)((NU32)(u) >> (NU32)(((NI) 12))));
	u = (NI)((NU32)((NI)((NU32)(u) % (NU32)(((NI) 4096)))) / (NU32)(((NI) 8)));
	(*t).bits[((NI)((NU32)(u) >> (NU32)(((NI) 5))))- 0] = (NI)((*t).bits[((NI)((NU32)(u) >> (NU32)(((NI) 5))))- 0] | (NI)((NU32)(((NI) 1)) << (NU32)(((NI) ((NI)(u & ((NI) 31)))))));
}

static N_INLINE(void, rtladdcycleroot_52020)(Cell47304* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_48047((&gch_49659.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, decref_53201)(Cell47304* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_52801(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_51258(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_52020(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

N_NIMCALL(void, markgray_66802)(Cell47304* s) {
	{
		if (!!((((NI) ((NI)((*s).refcount & ((NI) 3)))) == ((NI) 1)))) goto LA3;
		(*s).refcount = (NI)((NI)((*s).refcount & ((NI) -4)) | ((NI) 1));
		forallchildren_51614(s, ((NU8) 5));
	}
	LA3: ;
}

N_NIMCALL(void, scanblack_67001)(Cell47304* s) {
	(*s).refcount = (NI)((*s).refcount & ((NI) -4));
	forallchildren_51614(s, ((NU8) 7));
}

N_NIMCALL(void, scan_67201)(Cell47304* s) {
	{
		if (!(((NI) ((NI)((*s).refcount & ((NI) 3)))) == ((NI) 1))) goto LA3;
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*s).refcount))) goto LA7;
			scanblack_67001(s);
		}
		goto LA5;
		LA7: ;
		{
			(*s).refcount = (NI)((NI)((*s).refcount & ((NI) -4)) | ((NI) 2));
			forallchildren_51614(s, ((NU8) 6));
		}
		LA5: ;
	}
	LA3: ;
}

N_NIMCALL(NIM_BOOL, isallocatedptr_36402)(Memregion29487* a, void* p) {
	NIM_BOOL result;
	result = 0;
	{
		NIM_BOOL LOC3;
		Basechunk29437* c_44613;
		LOC3 = 0;
		LOC3 = isaccessible_32015(a, p);
		if (!LOC3) goto LA4;
		c_44613 = pageaddr_31180(p);
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = chunkunused_31089(c_44613);
			if (!!(LOC8)) goto LA9;
			{
				NIM_BOOL LOC13;
				Smallchunk29439* c;
				NI offset;
				NIM_BOOL LOC16;
				NIM_BOOL LOC17;
				LOC13 = 0;
				LOC13 = issmallchunk_31069(c_44613);
				if (!LOC13) goto LA14;
				c = ((Smallchunk29439*) (c_44613));
				offset = (NI)((NU32)(((NI) ((NI)(((NI) (p)) & ((NI) 4095))))) - (NU32)((NI)(((NI)sizeof(Smallchunk29439)) - ((NI) 8))));
				LOC16 = 0;
				LOC17 = 0;
				LOC17 = ((NU32)(offset) < (NU32)((*c).acc));
				if (!(LOC17)) goto LA18;
				LOC17 = ((NI)((NU32)(offset) % (NU32)((*c).Sup.size)) == ((NI) 0));
				LA18: ;
				LOC16 = LOC17;
				if (!(LOC16)) goto LA19;
				LOC16 = ((NU32)(((NI) 1)) < (NU32)((*((Freecell29429*) (p))).zerofield));
				LA19: ;
				result = LOC16;
			}
			goto LA11;
			LA14: ;
			{
				Bigchunk29441* c;
				NIM_BOOL LOC21;
				c = ((Bigchunk29441*) (c_44613));
				LOC21 = 0;
				LOC21 = (p == ((void*) ((&(*c).data))));
				if (!(LOC21)) goto LA22;
				LOC21 = ((NU32)(((NI) 1)) < (NU32)((*((Freecell29429*) (p))).zerofield));
				LA22: ;
				result = LOC21;
			}
			LA11: ;
		}
		LA9: ;
	}
	LA4: ;
	return result;
}

N_NIMCALL(void, freecycliccell_66015)(Gcheap49618* gch, Cell47304* c) {
	preparedealloc_51808(c);
	rawdealloc_43017((&(*gch).region), ((void*) (c)));
}

N_NIMCALL(void, collectwhite_67401)(Cell47304* s) {
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isallocatedptr_36402((&gch_49659.region), ((void*) (s)));
		if (!(LOC3)) goto LA4;
		LOC3 = (((NI) ((NI)((*s).refcount & ((NI) 3)))) == ((NI) 2));
		LA4: ;
		if (!LOC3) goto LA5;
		(*s).refcount = (NI)((*s).refcount & ((NI) -4));
		forallchildren_51614(s, ((NU8) 8));
		freecycliccell_66015((&gch_49659), s);
	}
	LA5: ;
}

N_NIMCALL(void, dooperation_51618)(void* p, NU8 op) {
	Cell47304* c;
{	{
		if (!(p == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	c = usrtocell_51240(p);
	switch (op) {
	case ((NU8) 2):
	{
		decref_53201(c);
	}
	break;
	case ((NU8) 3):
	{
		add_47382((&gch_49659.tempstack), c);
	}
	break;
	case ((NU8) 4):
	{
		(*c).refcount = (NI)((NU32)((*c).refcount) - (NU32)(((NI) 8)));
	}
	break;
	case ((NU8) 5):
	{
		(*c).refcount = (NI)((NU32)((*c).refcount) - (NU32)(((NI) 8)));
		markgray_66802(c);
	}
	break;
	case ((NU8) 6):
	{
		scan_67201(c);
	}
	break;
	case ((NU8) 7):
	{
		(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
		{
			if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 0)))) goto LA13;
			scanblack_67001(c);
		}
		LA13: ;
	}
	break;
	case ((NU8) 8):
	{
		collectwhite_67401(c);
	}
	break;
	case ((NU8) 0):
	{
	}
	break;
	case ((NU8) 1):
	{
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(NI, getdiscriminant_27204)(void* aa, TNimNode* n) {
	NI result;
	NI d;
	NI a;
{	result = 0;
	d = 0;
	a = ((NI) (aa));
	switch ((*(*n).typ).size) {
	case ((NI) 1):
	{
		d = ((NI)(NU)(NU8)((*((NI8*) ((NI)((NU32)(a) + (NU32)((*n).offset)))))));
	}
	break;
	case ((NI) 2):
	{
		d = ((NI)(NU)(NU16)((*((NI16*) ((NI)((NU32)(a) + (NU32)((*n).offset)))))));
	}
	break;
	case ((NI) 4):
	{
		d = ((NI) ((*((NI32*) ((NI)((NU32)(a) + (NU32)((*n).offset)))))));
	}
	break;
	default:
	{
	}
	break;
	}
	result = d;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(TNimNode*, selectbranch_27607)(void* aa, TNimNode* n) {
	TNimNode* result;
	NI discr;
	result = 0;
	discr = getdiscriminant_27204(aa, n);
	{
		if (!((NU32)(discr) < (NU32)((*n).len))) goto LA3;
		result = (*n).sons[(discr)- 0];
		{
			if (!(result == NIM_NIL)) goto LA7;
			result = (*n).sons[((*n).len)- 0];
		}
		LA7: ;
	}
	goto LA1;
	LA3: ;
	{
		result = (*n).sons[((*n).len)- 0];
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, forallslotsaux_55805)(void* dest, TNimNode* n, NU8 op) {
	NI d;
	d = ((NI) (dest));
	switch ((*n).kind) {
	case ((NU8) 1):
	{
		forallchildrenaux_51622(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), (*n).typ, op);
	}
	break;
	case ((NU8) 2):
	{
		{
			NI i_55830;
			NI HEX3Atmp_56006;
			NI res_56009;
			i_55830 = 0;
			HEX3Atmp_56006 = 0;
			HEX3Atmp_56006 = (NI)((*n).len - ((NI) 1));
			res_56009 = ((NI) 0);
			{
				while (1) {
					if (!(res_56009 <= HEX3Atmp_56006)) goto LA5;
					i_55830 = res_56009;
					{
						if (!((*(*n).sons[(i_55830)- 0]).kind == ((NU8) 1))) goto LA8;
						{
							if (!((*(*(*n).sons[(i_55830)- 0]).typ).kind == ((NU8) 22) || (*(*(*n).sons[(i_55830)- 0]).typ).kind == ((NU8) 28) || (*(*(*n).sons[(i_55830)- 0]).typ).kind == ((NU8) 24))) goto LA12;
							dooperation_51618((*((void**) ((NI)((NU32)(d) + (NU32)((*(*n).sons[(i_55830)- 0]).offset))))), op);
						}
						goto LA10;
						LA12: ;
						{
							forallchildrenaux_51622(((void*) ((NI)((NU32)(d) + (NU32)((*(*n).sons[(i_55830)- 0]).offset)))), (*(*n).sons[(i_55830)- 0]).typ, op);
						}
						LA10: ;
					}
					goto LA6;
					LA8: ;
					{
						forallslotsaux_55805(dest, (*n).sons[(i_55830)- 0], op);
					}
					LA6: ;
					res_56009 += ((NI) 1);
				} LA5: ;
			}
		}
	}
	break;
	case ((NU8) 3):
	{
		TNimNode* m;
		m = selectbranch_27607(dest, n);
		{
			if (!!((m == NIM_NIL))) goto LA19;
			forallslotsaux_55805(dest, m, op);
		}
		LA19: ;
	}
	break;
	case ((NU8) 0):
	{
	}
	break;
	}
}

N_NIMCALL(void, forallchildrenaux_51622)(void* dest, TNimType* mt, NU8 op) {
	NI d;
{	d = ((NI) (dest));
	{
		if (!(dest == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((((*mt).flags &(1U<<((NU)(((NU8) 0))&7U)))!=0))) goto LA7;
		switch ((*mt).kind) {
		case ((NU8) 22):
		case ((NU8) 28):
		case ((NU8) 24):
		{
			dooperation_51618((*((void**) (d))), op);
		}
		break;
		case ((NU8) 17):
		case ((NU8) 18):
		{
			forallslotsaux_55805(dest, (*mt).node, op);
		}
		break;
		case ((NU8) 16):
		case ((NU8) 4):
		case ((NU8) 27):
		{
			{
				NI i_56038;
				NI HEX3Atmp_56061;
				NI res_56064;
				i_56038 = 0;
				HEX3Atmp_56061 = 0;
				HEX3Atmp_56061 = (NI)((NI)((*mt).size / (*(*mt).base).size) - ((NI) 1));
				res_56064 = ((NI) 0);
				{
					while (1) {
						if (!(res_56064 <= HEX3Atmp_56061)) goto LA14;
						i_56038 = res_56064;
						forallchildrenaux_51622(((void*) ((NI)((NU32)(d) + (NU32)((NI)((NU32)(i_56038) * (NU32)((*(*mt).base).size)))))), (*mt).base, op);
						res_56064 += ((NI) 1);
					} LA14: ;
				}
			}
		}
		break;
		default:
		{
		}
		break;
		}
	}
	LA7: ;
	}BeforeRet: ;
}

N_NIMCALL(void, forallchildren_51614)(Cell47304* cell, NU8 op) {
	TY3489 marker;
	marker = (*(*cell).typ).marker;
	{
		void* LOC5;
		if (!!((marker == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = celltousr_51222(cell);
		marker(LOC5, ((NI) (op)));
	}
	goto LA1;
	LA3: ;
	{
		switch ((*(*cell).typ).kind) {
		case ((NU8) 22):
		{
			void* LOC8;
			LOC8 = 0;
			LOC8 = celltousr_51222(cell);
			forallchildrenaux_51622(LOC8, (*(*cell).typ).base, op);
		}
		break;
		case ((NU8) 24):
		{
			NI d;
			void* LOC10;
			TGenericSeq* s;
			LOC10 = 0;
			LOC10 = celltousr_51222(cell);
			d = ((NI) (LOC10));
			s = ((TGenericSeq*) (d));
			{
				if (!!((s == NIM_NIL))) goto LA13;
				{
					NI i_56834;
					NI HEX3Atmp_56867;
					NI res_56870;
					i_56834 = 0;
					HEX3Atmp_56867 = 0;
					HEX3Atmp_56867 = (NI)((*s).len - ((NI) 1));
					res_56870 = ((NI) 0);
					{
						while (1) {
							if (!(res_56870 <= HEX3Atmp_56867)) goto LA17;
							i_56834 = res_56870;
							forallchildrenaux_51622(((void*) ((NI)((NU32)((NI)((NU32)(d) + (NU32)((NI)((NU32)(i_56834) * (NU32)((*(*(*cell).typ).base).size))))) + (NU32)(((NI) 8))))), (*(*cell).typ).base, op);
							res_56870 += ((NI) 1);
						} LA17: ;
					}
				}
			}
			LA13: ;
		}
		break;
		default:
		{
		}
		break;
		}
	}
	LA1: ;
}

N_NIMCALL(NIM_BOOL, collectzct_69806)(Gcheap49618* gch) {
	NIM_BOOL result;
	NI* L;
	result = 0;
	L = (&(*gch).zct.len);
	{
		while (1) {
			Cell47304* c;
			if (!(((NI) 0) < (*L))) goto LA2;
			c = (*gch).zct.d[(((NI) 0))- 0];
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			(*gch).zct.d[(((NI) 0))- 0] = (*gch).zct.d[((NI)((*L) - ((NI) 1)))- 0];
			(*L) -= ((NI) 1);
			{
				if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA5;
				{
					NIM_BOOL LOC9;
					LOC9 = 0;
					LOC9 = canbecycleroot_51258(c);
					if (!LOC9) goto LA10;
					excl_48074((&(*gch).cycleroots), c);
				}
				LA10: ;
				preparedealloc_51808(c);
				forallchildren_51614(c, ((NU8) 2));
				rawdealloc_43017((&(*gch).region), ((void*) (c)));
			}
			LA5: ;
		} LA2: ;
	}
	result = NIM_TRUE;
	return result;
}

N_NIMCALL(void, markroots_67602)(Gcheap49618* gch) {
	NI tabsize;
	tabsize = ((NI) 0);
	{
		Cell47304* s_67607;
		Cellset47316 HEX3Atmp_67634;
		Pagedesc47312* r_67639;
		s_67607 = 0;
		memset((void*)(&HEX3Atmp_67634), 0, sizeof(HEX3Atmp_67634));
		HEX3Atmp_67634 = (*gch).cycleroots;
		r_67639 = HEX3Atmp_67634.head;
		{
			while (1) {
				NI i_67641;
				if (!!((r_67639 == NIM_NIL))) goto LA3;
				i_67641 = ((NI) 0);
				{
					while (1) {
						NI w_67643;
						NI j_67645;
						if (!(i_67641 <= ((NI) 15))) goto LA5;
						w_67643 = (*r_67639).bits[(i_67641)- 0];
						j_67645 = ((NI) 0);
						{
							while (1) {
								if (!!((w_67643 == ((NI) 0)))) goto LA7;
								{
									if (!!((((NI) ((NI)(w_67643 & ((NI) 1)))) == ((NI) 0)))) goto LA10;
									s_67607 = ((Cell47304*) ((NI)((NI)((NU32)((*r_67639).key) << (NU32)(((NI) 12))) | (NI)((NU32)((NI)((NU32)((NI)((NU32)(i_67641) << (NU32)(((NI) 5)))) + (NU32)(j_67645))) * (NU32)(((NI) 8))))));
									tabsize += ((NI) 1);
									{
										NIM_BOOL LOC14;
										LOC14 = 0;
										LOC14 = (((NI) ((NI)((*s_67607).refcount & ((NI) 3)))) == ((NI) 3));
										if (!(LOC14)) goto LA15;
										LOC14 = ((NU32)(((NI) 8)) <= (NU32)((*s_67607).refcount));
										LA15: ;
										if (!LOC14) goto LA16;
										markgray_66802(s_67607);
									}
									goto LA12;
									LA16: ;
									{
										excl_48074((&(*gch).cycleroots), s_67607);
										{
											if (!((*s_67607).refcount == ((NI) 0))) goto LA21;
											freecycliccell_66015(gch, s_67607);
										}
										LA21: ;
									}
									LA12: ;
								}
								LA10: ;
								j_67645 += ((NI) 1);
								w_67643 = (NI)((NU32)(w_67643) >> (NU32)(((NI) 1)));
							} LA7: ;
						}
						i_67641 += ((NI) 1);
					} LA5: ;
				}
				r_67639 = (*r_67639).next;
			} LA3: ;
		}
	}
	(*gch).stat.cycletablesize = (((*gch).stat.cycletablesize >= tabsize) ? (*gch).stat.cycletablesize : tabsize);
}

N_NIMCALL(void, collectroots_70001)(Gcheap49618* gch) {
	{
		Cell47304* s_70005;
		Cellset47316 HEX3Atmp_70007;
		Pagedesc47312* r_70012;
		s_70005 = 0;
		memset((void*)(&HEX3Atmp_70007), 0, sizeof(HEX3Atmp_70007));
		HEX3Atmp_70007 = (*gch).cycleroots;
		r_70012 = HEX3Atmp_70007.head;
		{
			while (1) {
				NI i_70014;
				if (!!((r_70012 == NIM_NIL))) goto LA3;
				i_70014 = ((NI) 0);
				{
					while (1) {
						NI w_70016;
						NI j_70018;
						if (!(i_70014 <= ((NI) 15))) goto LA5;
						w_70016 = (*r_70012).bits[(i_70014)- 0];
						j_70018 = ((NI) 0);
						{
							while (1) {
								if (!!((w_70016 == ((NI) 0)))) goto LA7;
								{
									if (!!((((NI) ((NI)(w_70016 & ((NI) 1)))) == ((NI) 0)))) goto LA10;
									s_70005 = ((Cell47304*) ((NI)((NI)((NU32)((*r_70012).key) << (NU32)(((NI) 12))) | (NI)((NU32)((NI)((NU32)((NI)((NU32)(i_70014) << (NU32)(((NI) 5)))) + (NU32)(j_70018))) * (NU32)(((NI) 8))))));
									collectwhite_67401(s_70005);
								}
								LA10: ;
								j_70018 += ((NI) 1);
								w_70016 = (NI)((NU32)(w_70016) >> (NU32)(((NI) 1)));
							} LA7: ;
						}
						i_70014 += ((NI) 1);
					} LA5: ;
				}
				r_70012 = (*r_70012).next;
			} LA3: ;
		}
	}
}

N_NIMCALL(void, deinit_47425)(Cellset47316* s) {
	Pagedesc47312* it;
	it = (*s).head;
	{
		while (1) {
			Pagedesc47312* n;
			if (!!((it == NIM_NIL))) goto LA2;
			n = (*it).next;
			dealloc_7448(((void*) (it)));
			it = n;
		} LA2: ;
	}
	(*s).head = NIM_NIL;
	dealloc_7448(((void*) ((*s).data)));
	(*s).data = NIM_NIL;
	(*s).counter = ((NI) 0);
}

N_NIMCALL(void, cellsetreset_55801)(Cellset47316* s) {
	deinit_47425(s);
	init_47417(s);
}

N_NIMCALL(void, collectcycles_70020)(Gcheap49618* gch) {
	{
		while (1) {
			NIM_BOOL LOC3;
			if (!(((NI) 0) < (*gch).zct.len)) goto LA2;
			LOC3 = 0;
			LOC3 = collectzct_69806(gch);
		} LA2: ;
	}
	markroots_67602(gch);
	{
		Cell47304* s_70201;
		Cellset47316 HEX3Atmp_70403;
		Pagedesc47312* r_70408;
		s_70201 = 0;
		memset((void*)(&HEX3Atmp_70403), 0, sizeof(HEX3Atmp_70403));
		HEX3Atmp_70403 = (*gch).cycleroots;
		r_70408 = HEX3Atmp_70403.head;
		{
			while (1) {
				NI i_70410;
				if (!!((r_70408 == NIM_NIL))) goto LA6;
				i_70410 = ((NI) 0);
				{
					while (1) {
						NI w_70412;
						NI j_70414;
						if (!(i_70410 <= ((NI) 15))) goto LA8;
						w_70412 = (*r_70408).bits[(i_70410)- 0];
						j_70414 = ((NI) 0);
						{
							while (1) {
								if (!!((w_70412 == ((NI) 0)))) goto LA10;
								{
									if (!!((((NI) ((NI)(w_70412 & ((NI) 1)))) == ((NI) 0)))) goto LA13;
									s_70201 = ((Cell47304*) ((NI)((NI)((NU32)((*r_70408).key) << (NU32)(((NI) 12))) | (NI)((NU32)((NI)((NU32)((NI)((NU32)(i_70410) << (NU32)(((NI) 5)))) + (NU32)(j_70414))) * (NU32)(((NI) 8))))));
									scan_67201(s_70201);
								}
								LA13: ;
								j_70414 += ((NI) 1);
								w_70412 = (NI)((NU32)(w_70412) >> (NU32)(((NI) 1)));
							} LA10: ;
						}
						i_70410 += ((NI) 1);
					} LA8: ;
				}
				r_70408 = (*r_70408).next;
			} LA6: ;
		}
	}
	collectroots_70001(gch);
	cellsetreset_55801((&(*gch).cycleroots));
}

N_NIMCALL(NI, gettotalmem_8059)(void) {
	NI result;
{	result = 0;
	result = gch_49659.region.currmem;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, getfreemem_8057)(void) {
	NI result;
	result = 0;
	result = gch_49659.region.freemem;
	return result;
}

N_NIMCALL(NI, getoccupiedmem_8055)(void) {
	NI result;
	NI LOC1;
	NI LOC2;
{	result = 0;
	LOC1 = 0;
	LOC1 = gettotalmem_8059();
	LOC2 = 0;
	LOC2 = getfreemem_8057();
	result = (NI)(LOC1 - LOC2);
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, unmarkstackandregisters_75002)(Gcheap49618* gch) {
	Cell47304** d;
	d = (*gch).decstack.d;
	{
		NI i_75016;
		NI HEX3Atmp_75202;
		NI res_75205;
		i_75016 = 0;
		HEX3Atmp_75202 = 0;
		HEX3Atmp_75202 = (NI)((*gch).decstack.len - ((NI) 1));
		res_75205 = ((NI) 0);
		{
			while (1) {
				if (!(res_75205 <= HEX3Atmp_75202)) goto LA3;
				i_75016 = res_75205;
				decref_53201(d[(i_75016)- 0]);
				res_75205 += ((NI) 1);
			} LA3: ;
		}
	}
	(*gch).decstack.len = ((NI) 0);
}

N_NIMCALL(void, collectctbody_75209)(Gcheap49618* gch) {
	NI LOC1;
	LOC1 = 0;
	LOC1 = stacksize_71401();
	(*gch).stat.maxstacksize = (((*gch).stat.maxstacksize >= LOC1) ? (*gch).stat.maxstacksize : LOC1);
	prepareforinteriorpointerchecking_44688((&(*gch).region));
	markstackandregisters_72637(gch);
	markthreadstacks_71003(gch);
	(*gch).stat.maxstackcells = (((*gch).stat.maxstackcells >= (*gch).decstack.len) ? (*gch).stat.maxstackcells : (*gch).decstack.len);
	(*gch).stat.stackscans += ((NI) 1);
	{
		NIM_BOOL LOC4;
		LOC4 = 0;
		LOC4 = collectzct_69806(gch);
		if (!LOC4) goto LA5;
		{
			NIM_BOOL LOC9;
			NI LOC10;
			NI LOC14;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = getoccupiedmem_47229((&(*gch).region));
			LOC9 = ((*gch).cyclethreshold <= LOC10);
			if (LOC9) goto LA11;
			LOC9 = NIM_FALSE;
			LA11: ;
			if (!LOC9) goto LA12;
			collectcycles_70020(gch);
			(*gch).stat.cyclecollections += ((NI) 1);
			LOC14 = 0;
			LOC14 = getoccupiedmem_8055();
			(*gch).cyclethreshold = ((((NI) 4194304) >= (NI)(LOC14 * ((NI) 2))) ? ((NI) 4194304) : (NI)(LOC14 * ((NI) 2)));
			(*gch).stat.maxthreshold = (((*gch).stat.maxthreshold >= (*gch).cyclethreshold) ? (*gch).stat.maxthreshold : (*gch).cyclethreshold);
		}
		LA12: ;
	}
	LA5: ;
	unmarkstackandregisters_75002(gch);
}

N_NIMCALL(void, collectct_51607)(Gcheap49618* gch) {
	NI stackmarkcosts;
	NI LOC1;
	LOC1 = 0;
	LOC1 = stacksize_71401();
	stackmarkcosts = (((NI)(LOC1 / ((NI) 64)) >= ((NI) 500)) ? (NI)(LOC1 / ((NI) 64)) : ((NI) 500));
	{
		NIM_BOOL LOC4;
		NIM_BOOL LOC5;
		NIM_BOOL LOC6;
		NIM_BOOL LOC8;
		NI LOC10;
		LOC4 = 0;
		LOC5 = 0;
		LOC6 = 0;
		LOC6 = (stackmarkcosts <= (*gch).zct.len);
		if (LOC6) goto LA7;
		LOC8 = 0;
		LOC8 = NIM_TRUE;
		if (!(LOC8)) goto LA9;
		LOC10 = 0;
		LOC10 = getoccupiedmem_47229((&(*gch).region));
		LOC8 = ((*gch).cyclethreshold <= LOC10);
		LA9: ;
		LOC6 = LOC8;
		LA7: ;
		LOC5 = LOC6;
		if (LOC5) goto LA11;
		LOC5 = NIM_FALSE;
		LA11: ;
		LOC4 = LOC5;
		if (!(LOC4)) goto LA12;
		LOC4 = ((*gch).recgclock == ((NI) 0));
		LA12: ;
		if (!LOC4) goto LA13;
		collectctbody_75209(gch);
	}
	LA13: ;
}

static N_INLINE(void, addnewobjtozct_56874)(Cell47304* res, Gcheap49618* gch) {
	NI L;
	Cell47304** d;
{	L = (*gch).zct.len;
	d = (*gch).zct.d;
	{
		Cell47304* c;
		if (!(((NI) 8) < L)) goto LA3;
		c = 0;
		c = d[((NI)(L - ((NI) 1)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA7;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 1)))- 0] = res;
			goto BeforeRet;
		}
		LA7: ;
		c = d[((NI)(L - ((NI) 2)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA11;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 2)))- 0] = res;
			goto BeforeRet;
		}
		LA11: ;
		c = d[((NI)(L - ((NI) 3)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA15;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 3)))- 0] = res;
			goto BeforeRet;
		}
		LA15: ;
		c = d[((NI)(L - ((NI) 4)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA19;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 4)))- 0] = res;
			goto BeforeRet;
		}
		LA19: ;
		c = d[((NI)(L - ((NI) 5)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA23;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 5)))- 0] = res;
			goto BeforeRet;
		}
		LA23: ;
		c = d[((NI)(L - ((NI) 6)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA27;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 6)))- 0] = res;
			goto BeforeRet;
		}
		LA27: ;
		c = d[((NI)(L - ((NI) 7)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA31;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 7)))- 0] = res;
			goto BeforeRet;
		}
		LA31: ;
		c = d[((NI)(L - ((NI) 8)))- 0];
		{
			if (!((NU32)(((NI) 8)) <= (NU32)((*c).refcount))) goto LA35;
			(*c).refcount = (NI)((*c).refcount & ((NI) -5));
			d[((NI)(L - ((NI) 8)))- 0] = res;
			goto BeforeRet;
		}
		LA35: ;
		add_47382((&(*gch).zct), res);
	}
	goto LA1;
	LA3: ;
	{
		d[(L)- 0] = res;
		(*gch).zct.len += ((NI) 1);
	}
	LA1: ;
	}BeforeRet: ;
}

N_NIMCALL(void*, rawnewobj_57401)(TNimType* typ, NI size, Gcheap49618* gch) {
	void* result;
	Cell47304* res;
	void* LOC1;
	result = 0;
	collectct_51607(gch);
	LOC1 = 0;
	LOC1 = rawalloc_36668((&(*gch).region), (NI)(size + ((NI)sizeof(Cell47304))));
	res = ((Cell47304*) (LOC1));
	(*res).typ = typ;
	(*res).refcount = ((NI) 4);
	addnewobjtozct_56874(res, gch);
	result = celltousr_51222(res);
	return result;
}

N_NIMCALL(void*, newObjNoInit)(TNimType* typ, NI size) {
	void* result;
	result = 0;
	result = rawnewobj_57401(typ, size, (&gch_49659));
	return result;
}

N_NIMCALL(NimStringDesc*, rawNewStringNoInit)(NI space) {
	NimStringDesc* result;
	NI s;
	void* LOC5;
	result = 0;
	s = space;
	{
		if (!(s < ((NI) 7))) goto LA3;
		s = ((NI) 7);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = newObjNoInit((&strdesc_12203), (NI)((NI)(((NI)sizeof(TGenericSeq)) + s) + ((NI) 1)));
	result = ((NimStringDesc*) (LOC5));
	(*result).Sup.reserved = s;
	return result;
}

N_NIMCALL(NimStringDesc*, toNimStr)(NCSTRING str, NI len) {
	NimStringDesc* result;
	result = 0;
	result = rawNewStringNoInit(len);
	(*result).Sup.len = len;
	memcpy(((NCSTRING) ((*result).data)), str, (NI)(len + ((NI) 1)));
	return result;
}

N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str) {
	NimStringDesc* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = strlen(str);
	result = toNimStr(str, LOC1);
	return result;
}

N_NIMCALL(void, write_15501)(FILE* f, NCSTRING c) {
	fputs(c, f);
}

N_NIMCALL(void, writetostderr_19401)(NCSTRING msg) {
	write_15501(stdout, msg);
}

N_NIMCALL(void, showerrormessage_19406)(NCSTRING data) {
	{
		NimStringDesc* LOC5;
		if (!!((errormessagewriter_19204 == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = cstrToNimstr(data);
		errormessagewriter_19204(LOC5);
	}
	goto LA1;
	LA3: ;
	{
		writetostderr_19401(data);
	}
	LA1: ;
}

N_NOCONV(void, signalHandler)(int sig) {
	NCSTRING msg;
	msg = 0;
	{
		if (!(sig == SIGINT)) goto LA3;
		msg = "SIGINT: Interrupted by Ctrl-C.\015\012";
	}
	goto LA1;
	LA3: ;
	{
		if (!(sig == SIGSEGV)) goto LA6;
		msg = "SIGSEGV: Illegal storage access. (Attempt to read from nil?)\015\012";
	}
	goto LA1;
	LA6: ;
	{
		if (!(sig == SIGABRT)) goto LA9;
		msg = "SIGABRT: Abnormal termination.\015\012";
	}
	goto LA1;
	LA9: ;
	{
		if (!(sig == SIGFPE)) goto LA12;
		msg = "SIGFPE: Arithmetic error.\015\012";
	}
	goto LA1;
	LA12: ;
	{
		if (!(sig == SIGILL)) goto LA15;
		msg = "SIGILL: Illegal operation.\015\012";
	}
	goto LA1;
	LA15: ;
	{
		if (!(sig == SIGSEGV)) goto LA18;
		msg = "SIGBUS: Illegal storage access. (Attempt to read from nil?)\015\012";
	}
	goto LA1;
	LA18: ;
	{
		{
			msg = "unknown signal\015\012";
		}
	}
	LA1: ;
	showerrormessage_19406(msg);
	exit(((NI) 1));
}

N_NIMCALL(void, registersignalhandler_23002)(void) {
	signal(SIGINT, signalHandler);
	signal(SIGSEGV, signalHandler);
	signal(SIGABRT, signalHandler);
	signal(SIGFPE, signalHandler);
	signal(SIGILL, signalHandler);
	signal(SIGSEGV, signalHandler);
}

N_NIMCALL(NI, getRefcount)(void* p) {
	NI result;
	Cell47304* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = usrtocell_51240(p);
	result = (NI)((NU32)((*LOC1).refcount) >> (NU32)(((NI) 3)));
	return result;
}

N_NIMCALL(void*, newObjRC1)(TNimType* typ, NI size) {
	void* result;
	Cell47304* res;
	void* LOC1;
	result = 0;
	collectct_51607((&gch_49659));
	LOC1 = 0;
	LOC1 = rawalloc_36668((&gch_49659.region), (NI)(size + ((NI)sizeof(Cell47304))));
	res = ((Cell47304*) (LOC1));
	(*res).typ = typ;
	(*res).refcount = ((NI) 8);
	result = celltousr_51222(res);
	zeroMem(result, ((NI) (size)));
	return result;
}

N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src) {
	NimStringDesc* result;
	result = 0;
	{
		NI s;
		void* LOC9;
		if (!!((src == NIM_NIL))) goto LA3;
		s = (*src).Sup.len;
		{
			if (!(s < ((NI) 7))) goto LA7;
			s = ((NI) 7);
		}
		LA7: ;
		LOC9 = 0;
		LOC9 = newObjRC1((&strdesc_12203), (NI)((NI)(((NI)sizeof(TGenericSeq)) + s) + ((NI) 1)));
		result = ((NimStringDesc*) (LOC9));
		(*result).Sup.reserved = s;
		(*result).Sup.len = (*src).Sup.len;
		memcpy(((NCSTRING) ((*result).data)), ((NCSTRING) ((*src).data)), (NI)((*src).Sup.len + ((NI) 1)));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, nimGCvisit)(void* d, NI op) {
	dooperation_51618(d, ((NU8) (op)));
}

N_NIMCALL(void*, newObj)(TNimType* typ, NI size) {
	void* result;
	result = 0;
	result = rawnewobj_57401(typ, size, (&gch_49659));
	zeroMem(result, ((NI) (size)));
	return result;
}
N_NIMCALL(void, TMP52)(void* p, NI op) {
	Exception* a;
	a = (Exception*)p;
	nimGCvisit((void*)(*a).parent, op);
	nimGCvisit((void*)(*a).message, op);
	nimGCvisit((void*)(*a).trace, op);
}
N_NIMCALL(void, TMP53)(void* p, NI op) {
	Overflowerror3640* a;
	a = (Overflowerror3640*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	Cell47304* c;
	c = usrtocell_51240(p);
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_52801(c);
	}
	LA3: ;
}

static N_INLINE(void, incref_53619)(Cell47304* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_51258(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_52020(c);
	}
	LA4: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Cell47304* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_51240(src);
		incref_53619(LOC5);
	}
	LA3: ;
	{
		Cell47304* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_51240((*dest));
		decref_53201(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

static N_INLINE(void, pushCurrentException)(Exception* e) {
	asgnRef((void**) (&(*e).parent), currexception_19439);
	asgnRef((void**) (&currexception_19439), e);
}

N_NOINLINE(NIM_BOOL, isobjslowpath_23734)(TNimType* obj, TNimType* subclass, TNimType** cache) {
	NIM_BOOL result;
	TNimType* x;
{	result = 0;
	x = (*obj).base;
	{
		while (1) {
			if (!!((x == subclass))) goto LA2;
			{
				if (!(x == NIM_NIL)) goto LA5;
				cache[(((NI) 0))- 0] = obj;
				result = NIM_FALSE;
				goto BeforeRet;
			}
			LA5: ;
			x = (*x).base;
		} LA2: ;
	}
	cache[(((NI) 1))- 0] = obj;
	result = NIM_TRUE;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

static N_INLINE(NIM_BOOL, isObjWithCache)(TNimType* obj, TNimType* subclass, TNimType** cache) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!(obj == subclass)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!((*obj).base == subclass)) goto LA7;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA7: ;
	{
		if (!(cache[(((NI) 0))- 0] == obj)) goto LA11;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA11: ;
	{
		if (!(cache[(((NI) 1))- 0] == obj)) goto LA15;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA15: ;
	result = isobjslowpath_23734(obj, subclass, cache);
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

static N_INLINE(void, quitordebug_20404)(void) {
	exit(((NI) 1));
}

N_NIMCALL(void, raiseexceptionaux_20601)(Exception* e) {
{	{
		if (!!((localraisehook_10018 == NIM_NIL))) goto LA3;
		{
			NIM_BOOL LOC7;
			LOC7 = 0;
			LOC7 = localraisehook_10018(e);
			if (!!(LOC7)) goto LA8;
			goto BeforeRet;
		}
		LA8: ;
	}
	LA3: ;
	{
		if (!!((globalraisehook_10013 == NIM_NIL))) goto LA12;
		{
			NIM_BOOL LOC16;
			LOC16 = 0;
			LOC16 = globalraisehook_10013(e);
			if (!!(LOC16)) goto LA17;
			goto BeforeRet;
		}
		LA17: ;
	}
	LA12: ;
	{
		if (!!((exchandler_19437 == NIM_NIL))) goto LA21;
		{
			NIM_BOOL LOC25;
			LOC25 = 0;
			LOC25 = !((*exchandler_19437).hasRaiseAction);
			if (LOC25) goto LA26;
			LOC25 = (*exchandler_19437).raiseAction.ClEnv? (*exchandler_19437).raiseAction.ClPrc(e, (*exchandler_19437).raiseAction.ClEnv):((TMP54)((*exchandler_19437).raiseAction.ClPrc))(e);
			LA26: ;
			if (!LOC25) goto LA27;
			pushCurrentException(e);
			longjmp((*exchandler_19437).context, ((int) 1));
		}
		LA27: ;
	}
	goto LA19;
	LA21: ;
	{
		if (!(isObjWithCache((*e).Sup.m_type, (&NTI3650), Nim_OfCheck_CACHE1))) goto LA30;
		showerrormessage_19406((*e).name);
		quitordebug_20404();
	}
	goto LA19;
	LA30: ;
	{
		TY21018 buf;
		NI L;
		memset((void*)buf, 0, sizeof(buf));
		L = ((NI) 0);
		{
			if (!((NI)(L + ((NI) 28)) < ((NI) 2000))) goto LA35;
			memcpy(((void*) ((&buf[(L)- 0]))), "Error: unhandled exception: ", ((NI) 28));
			L += ((NI) 28);
		}
		LA35: ;
		{
			if (!!((*e).message == 0)) goto LA39;
			{
				if (!((NI)(L + ((*e).message ? (*e).message->Sup.len : 0)) < ((NI) 2000))) goto LA43;
				memcpy(((void*) ((&buf[(L)- 0]))), ((void*) ((*e).message->data)), ((NI) (((*e).message ? (*e).message->Sup.len : 0))));
				L += ((*e).message ? (*e).message->Sup.len : 0);
			}
			LA43: ;
		}
		LA39: ;
		{
			if (!((NI)(L + ((NI) 2)) < ((NI) 2000))) goto LA47;
			memcpy(((void*) ((&buf[(L)- 0]))), " [", ((NI) 2));
			L += ((NI) 2);
		}
		LA47: ;
		{
			NI LOC51;
			NI LOC54;
			NI LOC55;
			LOC51 = 0;
			LOC51 = strlen((*e).name);
			if (!((NI)(L + LOC51) < ((NI) 2000))) goto LA52;
			LOC54 = 0;
			LOC54 = strlen((*e).name);
			memcpy(((void*) ((&buf[(L)- 0]))), ((void*) ((*e).name)), ((NI) (LOC54)));
			LOC55 = 0;
			LOC55 = strlen((*e).name);
			L += LOC55;
		}
		LA52: ;
		{
			if (!((NI)(L + ((NI) 3)) < ((NI) 2000))) goto LA58;
			memcpy(((void*) ((&buf[(L)- 0]))), "]\015\012", ((NI) 3));
			L += ((NI) 3);
		}
		LA58: ;
		showerrormessage_19406(((NCSTRING) (buf)));
		quitordebug_20404();
	}
	LA19: ;
	}BeforeRet: ;
}

N_NIMCALL(void, raiseException)(Exception* e, NCSTRING ename) {
	(*e).name = ename;
	raiseexceptionaux_20601(e);
}

static N_INLINE(void, sysfatal_23862)(NimStringDesc* message) {
	Overflowerror3640* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Overflowerror3640*) newObj((&NTI23869), sizeof(Overflowerror3640));
	(*e).Sup.Sup.Sup.m_type = (&NTI3640);
	LOC1 = 0;
	LOC1 = (*e).Sup.Sup.message; (*e).Sup.Sup.message = copyStringRC1(message);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	raiseException((Exception*)e, "OverflowError");
}

N_NOINLINE(void, raiseOverflow)(void) {
	sysfatal_23862(((NimStringDesc*) &TMP55));
}

static N_INLINE(NI, addInt)(NI a, NI b) {
	NI result;
{	result = 0;
	result = (NI)((NU32)(a) + (NU32)(b));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = (((NI) 0) <= (NI)(result ^ a));
		if (LOC3) goto LA4;
		LOC3 = (((NI) 0) <= (NI)(result ^ b));
		LA4: ;
		if (!LOC3) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	raiseOverflow();
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, mulInt)(NI a, NI b) {
	NI result;
	NF resasfloat;
	NF floatprod;
{	result = 0;
	resasfloat = 0;
	floatprod = 0;
	result = (NI)((NU32)(a) * (NU32)(b));
	floatprod = ((NF)(((double) (a))) * (NF)(((double) (b))));
	resasfloat = ((double) (result));
	{
		if (!(resasfloat == floatprod)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!(((NF)(3.2000000000000000e+01) * (NF)((((NF)(resasfloat) - (NF)(floatprod)) > 0? (((NF)(resasfloat) - (NF)(floatprod))) : -(((NF)(resasfloat) - (NF)(floatprod)))))) <= (floatprod > 0? (floatprod) : -(floatprod)))) goto LA7;
		goto BeforeRet;
	}
	LA7: ;
	raiseOverflow();
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len) {
	void* result;
	NI size;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = mulInt(len, (*(*typ).base).size);
	size = addInt(LOC1, ((NI) 8));
	result = newObjRC1(typ, size);
	(*((TGenericSeq*) (result))).len = len;
	(*((TGenericSeq*) (result))).reserved = len;
	return result;
}

N_NIMCALL(void*, nimLoadLibrary)(NimStringDesc* path) {
	void* result;
	void* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = LoadLibraryA(path->data);
	result = ((void*) (LOC1));
	return result;
}

N_NIMCALL(NI, writebuffer_15576)(FILE* f, void* buffer, NI len) {
	NI result;
	result = 0;
	result = fwrite(buffer, ((NI) 1), ((NI) (len)), f);
	return result;
}

N_NIMCALL(void, rawwrite_26202)(FILE* f, NimStringDesc* s) {
	NI LOC1;
	LOC1 = 0;
	LOC1 = writebuffer_15576(f, ((void*) (s->data)), ((NI) ((s ? s->Sup.len : 0))));
}

N_NOINLINE(void, nimLoadLibraryError)(NimStringDesc* path) {
	rawwrite_26202(stdout, ((NimStringDesc*) &TMP141));
	rawwrite_26202(stdout, path);
	rawwrite_26202(stdout, ((NimStringDesc*) &TMP142));
	exit(((NI) 1));
}

static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	memcpy(((NCSTRING) ((&(*dest).data[((*dest).Sup.len)- 0]))), ((NCSTRING) ((*src).data)), (NI)((*src).Sup.len + ((NI) 1)));
	(*dest).Sup.len += (*src).Sup.len;
}

N_NIMCALL(NimStringDesc*, rawNewString)(NI space) {
	NimStringDesc* result;
	NI s;
	void* LOC5;
	result = 0;
	s = space;
	{
		if (!(s < ((NI) 7))) goto LA3;
		s = ((NI) 7);
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = newObj((&strdesc_12203), (NI)((NI)(((NI)sizeof(TGenericSeq)) + s) + ((NI) 1)));
	result = ((NimStringDesc*) (LOC5));
	(*result).Sup.reserved = s;
	return result;
}

N_NIMCALL(NimStringDesc*, mnewString)(NI len) {
	NimStringDesc* result;
	result = 0;
	result = rawNewString(len);
	(*result).Sup.len = len;
	return result;
}

static N_INLINE(NI, resize_79001)(NI old) {
	NI result;
	result = 0;
	{
		if (!(old <= ((NI) 0))) goto LA3;
		result = ((NI) 4);
	}
	goto LA1;
	LA3: ;
	{
		if (!(old < ((NI) 65536))) goto LA6;
		result = (NI)(old * ((NI) 2));
	}
	goto LA1;
	LA6: ;
	{
		result = (NI)((NI)(old * ((NI) 3)) / ((NI) 2));
	}
	LA1: ;
	return result;
}

N_NIMCALL(void*, growobj_63203)(void* old, NI newsize, Gcheap49618* gch) {
	void* result;
	Cell47304* ol;
	Cell47304* res;
	void* LOC1;
	NI elemsize;
	NI oldsize;
	result = 0;
	collectct_51607(gch);
	ol = usrtocell_51240(old);
	LOC1 = 0;
	LOC1 = rawalloc_36668((&(*gch).region), (NI)(newsize + ((NI)sizeof(Cell47304))));
	res = ((Cell47304*) (LOC1));
	elemsize = ((NI) 1);
	{
		if (!!(((*(*ol).typ).kind == ((NU8) 28)))) goto LA4;
		elemsize = (*(*(*ol).typ).base).size;
	}
	LA4: ;
	oldsize = (NI)((NI)((*((TGenericSeq*) (old))).len * elemsize) + ((NI) 8));
	memcpy(((void*) (res)), ((void*) (ol)), ((NI) ((NI)(oldsize + ((NI)sizeof(Cell47304))))));
	zeroMem(((void*) ((NI)((NU32)((NI)((NU32)(((NI) (res))) + (NU32)(oldsize))) + (NU32)(((NI)sizeof(Cell47304)))))), ((NI) ((NI)(newsize - oldsize))));
	{
		if (!((NU32)((NI)((NU32)((*ol).refcount) >> (NU32)(((NI) 3)))) <= (NU32)(((NI) 1)))) goto LA8;
		{
			NI j;
			Cell47304** d;
			if (!!(((NI)((*ol).refcount & ((NI) 4)) == ((NI) 0)))) goto LA12;
			j = (NI)((*gch).zct.len - ((NI) 1));
			d = (*gch).zct.d;
			{
				while (1) {
					if (!(((NI) 0) <= j)) goto LA15;
					{
						if (!(d[(j)- 0] == ol)) goto LA18;
						d[(j)- 0] = res;
						goto LA14;
					}
					LA18: ;
					j -= ((NI) 1);
				} LA15: ;
			} LA14: ;
		}
		LA12: ;
		{
			NIM_BOOL LOC22;
			LOC22 = 0;
			LOC22 = canbecycleroot_51258(ol);
			if (!LOC22) goto LA23;
			excl_48074((&(*gch).cycleroots), ol);
		}
		LA23: ;
		rawdealloc_43017((&(*gch).region), ((void*) (ol)));
	}
	goto LA6;
	LA8: ;
	{
		(*res).refcount = ((NI) 8);
		decref_53201(ol);
	}
	LA6: ;
	result = celltousr_51222(res);
	return result;
}

N_NIMCALL(void*, growobj_66009)(void* old, NI newsize) {
	void* result;
	result = 0;
	result = growobj_63203(old, newsize, (&gch_49659));
	return result;
}

N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen) {
	NimStringDesc* result;
	result = 0;
	{
		if (!((NI)((*dest).Sup.len + addlen) <= ((NI) ((NI)((*dest).Sup.reserved & ((NI) 2147483647)))))) goto LA3;
		result = dest;
	}
	goto LA1;
	LA3: ;
	{
		NI sp;
		NI LOC6;
		void* LOC7;
		LOC6 = 0;
		LOC6 = resize_79001(((NI) ((NI)((*dest).Sup.reserved & ((NI) 2147483647)))));
		sp = ((LOC6 >= (NI)((*dest).Sup.len + addlen)) ? LOC6 : (NI)((*dest).Sup.len + addlen));
		LOC7 = 0;
		LOC7 = growobj_66009(((void*) (dest)), (NI)((NI)(((NI)sizeof(TGenericSeq)) + sp) + ((NI) 1)));
		result = ((NimStringDesc*) (LOC7));
		(*result).Sup.reserved = sp;
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newlen) {
	NimStringDesc* result;
	NI n;
	result = 0;
	n = ((newlen >= ((NI) 0)) ? newlen : ((NI) 0));
	{
		if (!(n <= ((NI) ((NI)((*s).Sup.reserved & ((NI) 2147483647)))))) goto LA3;
		result = s;
	}
	goto LA1;
	LA3: ;
	{
		result = resizeString(s, n);
	}
	LA1: ;
	(*result).Sup.len = n;
	(*result).data[(n)- 0] = 0;
	return result;
}

N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x) {
	NimStringDesc* result;
	NI i;
	NI y;
	result = 0;
	result = mnewString(((NI) 16));
	i = ((NI) 0);
	y = x;
	{
		while (1) {
			NI d;
			d = (NI)(y / ((NI) 10));
			result->data[i] = ((NIM_CHAR) (((NI) ((NI)(((NI)(y - (NI)(d * ((NI) 10))) > 0? ((NI)(y - (NI)(d * ((NI) 10)))) : -((NI)(y - (NI)(d * ((NI) 10))))) + ((NI) 48))))));
			i += ((NI) 1);
			y = d;
			{
				if (!(y == ((NI) 0))) goto LA5;
				goto LA1;
			}
			LA5: ;
		}
	} LA1: ;
	{
		if (!(x < ((NI) 0))) goto LA9;
		result->data[i] = 45;
		i += ((NI) 1);
	}
	LA9: ;
	result = setLengthStr(result, ((NI) (i)));
	{
		NI j_80339;
		NI HEX3Atmp_80353;
		NI res_80356;
		j_80339 = 0;
		HEX3Atmp_80353 = 0;
		HEX3Atmp_80353 = (NI)((NI)(i / ((NI) 2)) - ((NI) 1));
		res_80356 = ((NI) 0);
		{
			while (1) {
				NIM_CHAR LOC14;
				if (!(res_80356 <= HEX3Atmp_80353)) goto LA13;
				j_80339 = res_80356;
				LOC14 = 0;
				LOC14 = result->data[j_80339];
				result->data[j_80339] = result->data[(NI)((NI)(i - j_80339) - ((NI) 1))];
				result->data[(NI)((NI)(i - j_80339) - ((NI) 1))] = LOC14;
				res_80356 += ((NI) 1);
			} LA13: ;
		}
	}
	return result;
}

N_NOINLINE(void, procaddrerror_26209)(NCSTRING name) {
	rawwrite_26202(stdout, ((NimStringDesc*) &TMP145));
	write_15501(stdout, name);
	rawwrite_26202(stdout, ((NimStringDesc*) &TMP142));
	exit(((NI) 1));
}

N_NIMCALL(void*, nimGetProcAddr)(void* lib, NCSTRING name) {
	void* result;
{	result = 0;
	result = GetProcAddress(((void*) (lib)), name);
	{
		if (!!((result == NIM_NIL))) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NI i_26815;
		NI res_26822;
		i_26815 = 0;
		res_26822 = ((NI) 0);
		{
			while (1) {
				NimStringDesc* decorated;
				NimStringDesc* LOC8;
				NimStringDesc* LOC9;
				NimStringDesc* LOC10;
				if (!(res_26822 <= ((NI) 50))) goto LA7;
				i_26815 = res_26822;
				LOC8 = 0;
				LOC9 = 0;
				LOC9 = cstrToNimstr(name);
				LOC10 = 0;
				LOC10 = nimIntToStr((NI)(i_26815 * ((NI) 4)));
				LOC8 = rawNewString(LOC9->Sup.len + LOC10->Sup.len + 2);
appendString(LOC8, ((NimStringDesc*) &TMP143));
appendString(LOC8, LOC9);
appendString(LOC8, ((NimStringDesc*) &TMP144));
appendString(LOC8, LOC10);
				decorated = LOC8;
				result = GetProcAddress(((void*) (lib)), decorated->data);
				{
					if (!!((result == NIM_NIL))) goto LA13;
					goto BeforeRet;
				}
				LA13: ;
				res_26822 += ((NI) 1);
			} LA7: ;
		}
	}
	procaddrerror_26209(name);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void*, newSeq)(TNimType* typ, NI len) {
	void* result;
	NI size;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = mulInt(len, (*(*typ).base).size);
	size = addInt(LOC1, ((NI) 8));
	result = newObj(typ, size);
	(*((TGenericSeq*) (result))).len = len;
	(*((TGenericSeq*) (result))).reserved = len;
	return result;
}

N_NOINLINE(NIM_BOOL, isonstack_51611)(void* p) {
	NIM_BOOL result;
	void* volatile stacktop;
	NI b;
	NI a;
	NI x;
	NIM_BOOL LOC1;
	result = 0;
	stacktop = 0;
	stacktop = ((void*) ((&stacktop)));
	b = ((NI) (gch_49659.stackbottom));
	a = ((NI) (stacktop));
	x = ((NI) (p));
	LOC1 = 0;
	LOC1 = ((NU32)(a) <= (NU32)(x));
	if (!(LOC1)) goto LA2;
	LOC1 = ((NU32)(x) <= (NU32)(b));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src) {
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isonstack_51611(((void*) (dest)));
		if (!!(LOC3)) goto LA4;
		{
			Cell47304* LOC10;
			if (!!((src == NIM_NIL))) goto LA8;
			LOC10 = 0;
			LOC10 = usrtocell_51240(src);
			incref_53619(LOC10);
		}
		LA8: ;
		{
			Cell47304* LOC15;
			if (!((NU32)(((NI) 4096)) <= (NU32)(((NI) ((*dest)))))) goto LA13;
			LOC15 = 0;
			LOC15 = usrtocell_51240((*dest));
			decref_53201(LOC15);
		}
		LA13: ;
	}
	goto LA1;
	LA4: ;
	{
	}
	LA1: ;
	(*dest) = src;
}
N_NIMCALL(void, TMP151)(void* p, NI op) {
	Valueerror3646* a;
	a = (Valueerror3646*)p;
	nimGCvisit((void*)(*a).Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.message, op);
	nimGCvisit((void*)(*a).Sup.trace, op);
}

static N_INLINE(void, sysfatal_23618)(NimStringDesc* message) {
	Valueerror3646* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Valueerror3646*) newObj((&NTI23625), sizeof(Valueerror3646));
	(*e).Sup.Sup.m_type = (&NTI3646);
	LOC1 = 0;
	LOC1 = (*e).Sup.message; (*e).Sup.message = copyStringRC1(message);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	raiseException((Exception*)e, "ValueError");
}

N_NOINLINE(void, chckNil)(void* p) {
	{
		if (!(p == NIM_NIL)) goto LA3;
		sysfatal_23618(((NimStringDesc*) &TMP152));
	}
	LA3: ;
}

N_NIMCALL(void, genericresetaux_84601)(void* dest, TNimNode* n) {
	NI d;
	d = ((NI) (dest));
	switch ((*n).kind) {
	case ((NU8) 0):
	{
	}
	break;
	case ((NU8) 1):
	{
		genericReset(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), (*n).typ);
	}
	break;
	case ((NU8) 2):
	{
		{
			NI i_85819;
			NI HEX3Atmp_85845;
			NI res_85848;
			i_85819 = 0;
			HEX3Atmp_85845 = 0;
			HEX3Atmp_85845 = (NI)((*n).len - ((NI) 1));
			res_85848 = ((NI) 0);
			{
				while (1) {
					if (!(res_85848 <= HEX3Atmp_85845)) goto LA6;
					i_85819 = res_85848;
					genericresetaux_84601(dest, (*n).sons[(i_85819)- 0]);
					res_85848 += ((NI) 1);
				} LA6: ;
			}
		}
	}
	break;
	case ((NU8) 3):
	{
		TNimNode* m;
		m = selectbranch_27607(dest, n);
		{
			if (!!((m == NIM_NIL))) goto LA10;
			genericresetaux_84601(dest, m);
		}
		LA10: ;
		zeroMem(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), ((NI) ((*(*n).typ).size)));
	}
	break;
	}
}

N_NIMCALL(void, genericReset)(void* dest, TNimType* mt) {
	NI d;
	d = ((NI) (dest));
	switch ((*mt).kind) {
	case ((NU8) 28):
	case ((NU8) 22):
	case ((NU8) 24):
	{
		unsureAsgnRef(((void**) (dest)), NIM_NIL);
	}
	break;
	case ((NU8) 18):
	{
		genericresetaux_84601(dest, (*mt).node);
	}
	break;
	case ((NU8) 17):
	{
		TNimType** pint;
		genericresetaux_84601(dest, (*mt).node);
		pint = ((TNimType**) (dest));
		(*pint) = NIM_NIL;
	}
	break;
	case ((NU8) 16):
	case ((NU8) 4):
	{
		{
			NI i_86012;
			NI HEX3Atmp_86036;
			NI res_86039;
			i_86012 = 0;
			HEX3Atmp_86036 = 0;
			HEX3Atmp_86036 = (NI)((NI)((*mt).size / (*(*mt).base).size) - ((NI) 1));
			res_86039 = ((NI) 0);
			{
				while (1) {
					if (!(res_86039 <= HEX3Atmp_86036)) goto LA7;
					i_86012 = res_86039;
					genericReset(((void*) ((NI)((NU32)(d) + (NU32)((NI)((NU32)(i_86012) * (NU32)((*(*mt).base).size)))))), (*mt).base);
					res_86039 += ((NI) 1);
				} LA7: ;
			}
		}
	}
	break;
	default:
	{
		zeroMem(dest, ((NI) ((*mt).size)));
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src) {
	NimStringDesc* result;
	result = 0;
	{
		if (!!((src == NIM_NIL))) goto LA3;
		{
			if (!!(((NI)((*src).Sup.reserved & ((NI) (-2147483647 -1))) == ((NI) 0)))) goto LA7;
			result = src;
		}
		goto LA5;
		LA7: ;
		{
			result = rawNewStringNoInit((*src).Sup.len);
			(*result).Sup.len = (*src).Sup.len;
			memcpy(((NCSTRING) ((*result).data)), ((NCSTRING) ((*src).data)), (NI)((*src).Sup.len + ((NI) 1)));
		}
		LA5: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_79610, NI last) {
	NimStringDesc* result;
	NI start;
	NI len;
	result = 0;
	start = ((start_79610 >= ((NI) 0)) ? start_79610 : ((NI) 0));
	len = (NI)((NI)(((last <= (NI)((*s).Sup.len - ((NI) 1))) ? last : (NI)((*s).Sup.len - ((NI) 1))) - start) + ((NI) 1));
	{
		if (!(((NI) 0) < len)) goto LA3;
		result = rawNewStringNoInit(len);
		(*result).Sup.len = len;
		memcpy(((NCSTRING) ((*result).data)), ((NCSTRING) ((&(*s).data[(start)- 0]))), len);
		(*result).data[(len)- 0] = 0;
	}
	goto LA1;
	LA3: ;
	{
		result = rawNewString(len);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start) {
	NimStringDesc* result;
	result = 0;
	result = copyStrLast(s, start, (NI)((*s).Sup.len - ((NI) 1)));
	return result;
}

N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c) {
	NimStringDesc* result;
	result = 0;
	result = s;
	{
		void* LOC5;
		if (!(((NI) ((NI)((*result).Sup.reserved & ((NI) 2147483647)))) <= (*result).Sup.len)) goto LA3;
		(*result).Sup.reserved = resize_79001(((NI) ((NI)((*result).Sup.reserved & ((NI) 2147483647)))));
		LOC5 = 0;
		LOC5 = growobj_66009(((void*) (result)), (NI)((NI)(((NI)sizeof(TGenericSeq)) + (*result).Sup.reserved) + ((NI) 1)));
		result = ((NimStringDesc*) (LOC5));
	}
	LA3: ;
	(*result).data[((*result).Sup.len)- 0] = c;
	(*result).data[((NI)((*result).Sup.len + ((NI) 1)))- 0] = 0;
	(*result).Sup.len += ((NI) 1);
	return result;
}

N_NIMCALL(NimStringDesc*, nimCharToStr)(NIM_CHAR x) {
	NimStringDesc* result;
	result = 0;
	result = mnewString(((NI) 1));
	result->data[((NI) 0)] = x;
	return result;
}

N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize) {
	TGenericSeq* result;
	result = 0;
	result = seq;
	{
		void* LOC5;
		if (!(((NI) ((NI)((*result).reserved & ((NI) 2147483647)))) <= (*result).len)) goto LA3;
		(*result).reserved = resize_79001(((NI) ((NI)((*result).reserved & ((NI) 2147483647)))));
		LOC5 = 0;
		LOC5 = growobj_66009(((void*) (result)), (NI)((NI)(elemsize * (*result).reserved) + ((NI) 8)));
		result = ((TGenericSeq*) (LOC5));
	}
	LA3: ;
	return result;
}

N_NIMCALL(void, genericassignaux_84612)(void* dest, void* src, TNimNode* n, NIM_BOOL shallow) {
	NI d;
	NI s;
	d = ((NI) (dest));
	s = ((NI) (src));
	switch ((*n).kind) {
	case ((NU8) 1):
	{
		genericassignaux_84606(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), ((void*) ((NI)((NU32)(s) + (NU32)((*n).offset)))), (*n).typ, shallow);
	}
	break;
	case ((NU8) 2):
	{
		{
			NI i_84648;
			NI HEX3Atmp_84806;
			NI res_84809;
			i_84648 = 0;
			HEX3Atmp_84806 = 0;
			HEX3Atmp_84806 = (NI)((*n).len - ((NI) 1));
			res_84809 = ((NI) 0);
			{
				while (1) {
					if (!(res_84809 <= HEX3Atmp_84806)) goto LA5;
					i_84648 = res_84809;
					genericassignaux_84612(dest, src, (*n).sons[(i_84648)- 0], shallow);
					res_84809 += ((NI) 1);
				} LA5: ;
			}
		}
	}
	break;
	case ((NU8) 3):
	{
		TNimNode* dd;
		TNimNode* m;
		dd = selectbranch_27607(dest, n);
		m = selectbranch_27607(src, n);
		{
			NIM_BOOL LOC9;
			LOC9 = 0;
			LOC9 = !((m == dd));
			if (!(LOC9)) goto LA10;
			LOC9 = !((dd == NIM_NIL));
			LA10: ;
			if (!LOC9) goto LA11;
			genericresetaux_84601(dest, dd);
		}
		LA11: ;
		memcpy(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), ((void*) ((NI)((NU32)(s) + (NU32)((*n).offset)))), ((NI) ((*(*n).typ).size)));
		{
			if (!!((m == NIM_NIL))) goto LA15;
			genericassignaux_84612(dest, src, m, shallow);
		}
		LA15: ;
	}
	break;
	case ((NU8) 0):
	{
	}
	break;
	}
}

N_NIMCALL(void, genericassignaux_84606)(void* dest, void* src, TNimType* mt, NIM_BOOL shallow) {
	NI d;
	NI s;
{	d = ((NI) (dest));
	s = ((NI) (src));
	switch ((*mt).kind) {
	case ((NU8) 28):
	{
		void** x;
		void* s2;
		x = ((void**) (dest));
		s2 = (*((void**) (s)));
		{
			NIM_BOOL LOC4;
			NIM_BOOL LOC5;
			LOC4 = 0;
			LOC5 = 0;
			LOC5 = (s2 == NIM_NIL);
			if (LOC5) goto LA6;
			LOC5 = shallow;
			LA6: ;
			LOC4 = LOC5;
			if (LOC4) goto LA7;
			LOC4 = !(((NI)((*((TGenericSeq*) (s2))).reserved & ((NI) (-2147483647 -1))) == ((NI) 0)));
			LA7: ;
			if (!LOC4) goto LA8;
			unsureAsgnRef(x, s2);
		}
		goto LA2;
		LA8: ;
		{
			NimStringDesc* LOC11;
			LOC11 = 0;
			LOC11 = copyString(((NimStringDesc*) (s2)));
			unsureAsgnRef(x, ((void*) (LOC11)));
		}
		LA2: ;
	}
	break;
	case ((NU8) 24):
	{
		void* s2;
		TGenericSeq* seq;
		void** x;
		void* LOC21;
		NI dst;
		s2 = (*((void**) (src)));
		seq = ((TGenericSeq*) (s2));
		x = ((void**) (dest));
		{
			NIM_BOOL LOC15;
			NIM_BOOL LOC16;
			LOC15 = 0;
			LOC16 = 0;
			LOC16 = (s2 == NIM_NIL);
			if (LOC16) goto LA17;
			LOC16 = shallow;
			LA17: ;
			LOC15 = LOC16;
			if (LOC15) goto LA18;
			LOC15 = !(((NI)((*seq).reserved & ((NI) (-2147483647 -1))) == ((NI) 0)));
			LA18: ;
			if (!LOC15) goto LA19;
			unsureAsgnRef(x, s2);
			goto BeforeRet;
		}
		LA19: ;
		LOC21 = 0;
		LOC21 = newSeq(mt, (*seq).len);
		unsureAsgnRef(x, LOC21);
		dst = ((NI) ((*((void**) (dest)))));
		{
			NI i_85211;
			NI HEX3Atmp_85341;
			NI res_85344;
			i_85211 = 0;
			HEX3Atmp_85341 = 0;
			HEX3Atmp_85341 = (NI)((*seq).len - ((NI) 1));
			res_85344 = ((NI) 0);
			{
				while (1) {
					if (!(res_85344 <= HEX3Atmp_85341)) goto LA24;
					i_85211 = res_85344;
					genericassignaux_84606(((void*) ((NI)((NU32)((NI)((NU32)(dst) + (NU32)((NI)((NU32)(i_85211) * (NU32)((*(*mt).base).size))))) + (NU32)(((NI) 8))))), ((void*) ((NI)((NU32)((NI)((NU32)(((NI) (s2))) + (NU32)((NI)((NU32)(i_85211) * (NU32)((*(*mt).base).size))))) + (NU32)(((NI) 8))))), (*mt).base, shallow);
					res_85344 += ((NI) 1);
				} LA24: ;
			}
		}
	}
	break;
	case ((NU8) 17):
	{
		TNimType** pint;
		{
			if (!!(((*mt).base == NIM_NIL))) goto LA28;
			genericassignaux_84606(dest, src, (*mt).base, shallow);
		}
		LA28: ;
		genericassignaux_84612(dest, src, (*mt).node, shallow);
		pint = ((TNimType**) (dest));
		(*pint) = mt;
	}
	break;
	case ((NU8) 18):
	{
		genericassignaux_84612(dest, src, (*mt).node, shallow);
	}
	break;
	case ((NU8) 16):
	case ((NU8) 4):
	{
		{
			NI i_85289;
			NI HEX3Atmp_85352;
			NI res_85355;
			i_85289 = 0;
			HEX3Atmp_85352 = 0;
			HEX3Atmp_85352 = (NI)((NI)((*mt).size / (*(*mt).base).size) - ((NI) 1));
			res_85355 = ((NI) 0);
			{
				while (1) {
					if (!(res_85355 <= HEX3Atmp_85352)) goto LA34;
					i_85289 = res_85355;
					genericassignaux_84606(((void*) ((NI)((NU32)(d) + (NU32)((NI)((NU32)(i_85289) * (NU32)((*(*mt).base).size)))))), ((void*) ((NI)((NU32)(s) + (NU32)((NI)((NU32)(i_85289) * (NU32)((*(*mt).base).size)))))), (*mt).base, shallow);
					res_85355 += ((NI) 1);
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 22):
	{
		unsureAsgnRef(((void**) (dest)), (*((void**) (s))));
	}
	break;
	default:
	{
		memcpy(dest, src, ((NI) ((*mt).size)));
	}
	break;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, genericAssign)(void* dest, void* src, TNimType* mt) {
	genericassignaux_84606(dest, src, mt, NIM_FALSE);
}
N_NIMCALL(void, TMP441)(void* p, NI op) {
	Ioerror3628* a;
	a = (Ioerror3628*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
}

static N_INLINE(void, sysfatal_81010)(NimStringDesc* message) {
	Ioerror3628* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Ioerror3628*) newObj((&NTI81017), sizeof(Ioerror3628));
	(*e).Sup.Sup.Sup.m_type = (&NTI3628);
	LOC1 = 0;
	LOC1 = (*e).Sup.Sup.message; (*e).Sup.Sup.message = copyStringRC1(message);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	raiseException((Exception*)e, "IOError");
}

N_NOINLINE(void, raiseeio_81005)(NimStringDesc* msg) {
	sysfatal_81010(msg);
}

N_NIMCALL(void, write_15489)(FILE* f, NimStringDesc* s) {
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = writebuffer_15576(f, ((void*) (s->data)), ((NI) ((s ? s->Sup.len : 0))));
		if (!!((LOC3 == (s ? s->Sup.len : 0)))) goto LA4;
		raiseeio_81005(((NimStringDesc*) &TMP442));
	}
	LA4: ;
}
N_NIMCALL(void, TMP503)(void* p, NI op) {
	NI16* a;
	NI LOC1;
	a = (NI16*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < 1000001; LOC1++) {
	}
}

N_NIMCALL(NI16*, newwidecstring_83412)(NCSTRING source, NI L) {
	NI16* result;
	NI d;
	result = 0;
	result = (NI16*) newObj((&NTI82404), ((NI) ((NI)((NI)(L * ((NI) 4)) + ((NI) 2)))));
	d = ((NI) 0);
	{
		NI ch_83428;
		NI i_83519;
		NI result_83521;
		ch_83428 = 0;
		i_83519 = ((NI) 0);
		result_83521 = 0;
		{
			while (1) {
				if (!!(((NU8)(source[i_83519]) == (NU8)(0)))) goto LA3;
				{
					if (!((NU32)(((NI) (((NU8)(source[i_83519]))))) <= (NU32)(((NI) 127)))) goto LA6;
					result_83521 = ((NI) (((NU8)(source[i_83519]))));
					i_83519 += ((NI) 1);
				}
				goto LA4;
				LA6: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(source[i_83519]))))) >> (NU32)(((NI) 5))) == ((NI) 6))) goto LA9;
					result_83521 = (NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[i_83519])))) & ((NI) 31))))) << (NU32)(((NI) 6))) | ((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 1))])))) & ((NI) 63)))));
					i_83519 += ((NI) 2);
				}
				goto LA4;
				LA9: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(source[i_83519]))))) >> (NU32)(((NI) 4))) == ((NI) 14))) goto LA12;
					result_83521 = (NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[i_83519])))) & ((NI) 15))))) << (NU32)(((NI) 12))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 2))])))) & ((NI) 63)))));
					i_83519 += ((NI) 3);
				}
				goto LA4;
				LA12: ;
				{
					if (!((NI)((NU32)(((NI) (((NU8)(source[i_83519]))))) >> (NU32)(((NI) 3))) == ((NI) 30))) goto LA15;
					result_83521 = (NI)((NI)((NI)((NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[i_83519])))) & ((NI) 7))))) << (NU32)(((NI) 18))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 1))])))) & ((NI) 63))))) << (NU32)(((NI) 12)))) | (NI)((NU32)(((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 2))])))) & ((NI) 63))))) << (NU32)(((NI) 6)))) | ((NI) ((NI)(((NI) (((NU8)(source[(NI)(i_83519 + ((NI) 3))])))) & ((NI) 63)))));
					i_83519 += ((NI) 4);
				}
				goto LA4;
				LA15: ;
				{
					result_83521 = ((NI) 65533);
					i_83519 += ((NI) 1);
				}
				LA4: ;
				ch_83428 = result_83521;
				{
					if (!((NU32)(ch_83428) <= (NU32)(((NI) 65535)))) goto LA20;
					{
						NIM_BOOL LOC24;
						LOC24 = 0;
						LOC24 = ((NU32)(((NI) 55296)) <= (NU32)(ch_83428));
						if (!(LOC24)) goto LA25;
						LOC24 = ((NU32)(ch_83428) <= (NU32)(((NI) 57343)));
						LA25: ;
						if (!LOC24) goto LA26;
						result[(d)- 0] = ((NI16) -3);
					}
					goto LA22;
					LA26: ;
					{
						result[(d)- 0] = ((NI16)(NU16)(NU)(ch_83428));
					}
					LA22: ;
				}
				goto LA18;
				LA20: ;
				{
					if (!((NU32)(((NI) 1114111)) < (NU32)(ch_83428))) goto LA30;
					result[(d)- 0] = ((NI16) -3);
				}
				goto LA18;
				LA30: ;
				{
					NI ch;
					ch = (NI)((NU32)(ch_83428) - (NU32)(((NI) 65536)));
					result[(d)- 0] = ((NI16)(NU16)(NU)((NI)((NU32)((NI)((NU32)(ch) >> (NU32)(((NI) 10)))) + (NU32)(((NI) 55296)))));
					d += ((NI) 1);
					result[(d)- 0] = ((NI16)(NU16)(NU)(((NI) ((NI)((NU32)(((NI) ((NI)(ch & ((NI) 1023))))) + (NU32)(((NI) 56320)))))));
				}
				LA18: ;
				d += ((NI) 1);
			} LA3: ;
		}
	}
	result[(d)- 0] = ((NI16) 0);
	return result;
}

N_NIMCALL(NI16*, newwidecstring_83523)(NCSTRING s) {
	NI16* result;
	NI L;
{	result = 0;
	{
		if (!s == 0) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	L = strlen(s);
	result = newwidecstring_83412(s, L);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void*, fopen_84010)(NCSTRING filename, NCSTRING mode) {
	void* result;
	NI16* f;
	NI16* m;
	result = 0;
	f = newwidecstring_83523(filename);
	m = newwidecstring_83523(mode);
	result = _wfopen(f, m);
	return result;
}

N_NIMCALL(NIM_BOOL, open_15403)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize) {
	NIM_BOOL result;
	void* p;
	result = 0;
	p = fopen_84010(filename->data, Formatopen_84025[(mode)- 0]->data);
	{
		if (!!((p == NIM_NIL))) goto LA3;
		result = NIM_TRUE;
		(*f) = ((FILE*) (p));
		{
			NIM_BOOL LOC7;
			int LOC11;
			LOC7 = 0;
			LOC7 = (((NI) 0) < bufsize);
			if (!(LOC7)) goto LA8;
			LOC7 = (bufsize <= ((NI) 2147483647));
			LA8: ;
			if (!LOC7) goto LA9;
			LOC11 = 0;
			LOC11 = setvbuf((*f), NIM_NIL, _IOFBF, ((int) (bufsize)));
		}
		goto LA5;
		LA9: ;
		{
			int LOC15;
			if (!(bufsize == ((NI) 0))) goto LA13;
			LOC15 = 0;
			LOC15 = setvbuf((*f), NIM_NIL, _IONBF, ((int) 0));
		}
		goto LA5;
		LA13: ;
		LA5: ;
	}
	LA3: ;
	return result;
}

N_NIMCALL(NIM_BOOL, stacktraceavailable_20272)(void) {
	NIM_BOOL result;
	result = 0;
	result = NIM_FALSE;
	return result;
}

N_NIMCALL(void, writestacktrace_18807)(void) {
	showerrormessage_19406("No stack traceback available\015\012");
}
N_NIMCALL(void, TMP927)(void* p, NI op) {
	TNimObject* a;
	a = (TNimObject*)p;
}

N_NIMCALL(TNimType*, extGetCellType)(void* c) {
	TNimType* result;
	Cell47304* LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = usrtocell_51240(c);
	result = (*LOC1).typ;
	return result;
}

N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen) {
	TGenericSeq* result;
	result = 0;
	result = seq;
	{
		NI LOC5;
		void* LOC6;
		if (!(((NI) ((NI)((*result).reserved & ((NI) 2147483647)))) < newlen)) goto LA3;
		LOC5 = 0;
		LOC5 = resize_79001(((NI) ((NI)((*result).reserved & ((NI) 2147483647)))));
		(*result).reserved = ((LOC5 >= newlen) ? LOC5 : newlen);
		LOC6 = 0;
		LOC6 = growobj_66009(((void*) (result)), (NI)((NI)(elemsize * (*result).reserved) + ((NI) 8)));
		result = ((TGenericSeq*) (LOC6));
	}
	goto LA1;
	LA3: ;
	{
		if (!(newlen < (*result).len)) goto LA8;
		{
			NI i_80210;
			NI HEX3Atmp_80287;
			NI res_80290;
			i_80210 = 0;
			HEX3Atmp_80287 = 0;
			HEX3Atmp_80287 = (NI)((*result).len - ((NI) 1));
			res_80290 = newlen;
			{
				while (1) {
					TNimType* LOC13;
					if (!(res_80290 <= HEX3Atmp_80287)) goto LA12;
					i_80210 = res_80290;
					LOC13 = 0;
					LOC13 = extGetCellType(((void*) (result)));
					forallchildrenaux_51622(((void*) ((NI)((NU32)((NI)((NU32)(((NI) (result))) + (NU32)(((NI) 8)))) + (NU32)((NI)((NU32)(i_80210) * (NU32)(elemsize)))))), (*LOC13).base, ((NU8) 2));
					res_80290 += ((NI) 1);
				} LA12: ;
			}
		}
		zeroMem(((void*) ((NI)((NU32)((NI)((NU32)(((NI) (result))) + (NU32)(((NI) 8)))) + (NU32)((NI)((NU32)(newlen) * (NU32)(elemsize)))))), ((NI) ((NI)((NU32)((NI)((NU32)((*result).len) - (NU32)(newlen))) * (NU32)(elemsize)))));
	}
	goto LA1;
	LA8: ;
	LA1: ;
	(*result).len = newlen;
	return result;
}

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

static N_INLINE(void, sysfatal_15426)(NimStringDesc* message, NimStringDesc* arg) {
	Ioerror3628* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Ioerror3628*) newObj((&NTI81017), sizeof(Ioerror3628));
	(*e).Sup.Sup.Sup.m_type = (&NTI3628);
	LOC1 = 0;
	LOC1 = rawNewString(message->Sup.len + arg->Sup.len + 0);
appendString(LOC1, message);
appendString(LOC1, arg);
	asgnRefNoCycle((void**) (&(*e).Sup.Sup.message), LOC1);
	raiseException((Exception*)e, "IOError");
}

N_NIMCALL(FILE*, open_15417)(NimStringDesc* filename, NU8 mode, NI bufsize) {
	FILE* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = open_15403(&result, filename, mode, bufsize);
		if (!!(LOC3)) goto LA4;
		sysfatal_15426(((NimStringDesc*) &TMP1064), filename);
	}
	LA4: ;
	return result;
}

N_NIMCALL(NIM_BOOL, readline_15513)(FILE* f, NimStringDesc** line) {
	NIM_BOOL result;
	NI pos;
	NI space;
{	result = 0;
	pos = ((NI) 0);
	space = ((NI) ((NI)((*((TGenericSeq*) ((*line)))).reserved & ((NI) 2147483647))));
	(*line) = setLengthStr((*line), ((NI) (space)));
	{
		while (1) {
			void* m;
			memset(((void*) ((&(*line)->data[pos]))), ((int) 10), space);
			{
				NCSTRING LOC5;
				LOC5 = 0;
				LOC5 = fgets(((NCSTRING) ((&(*line)->data[pos]))), space, f);
				if (!(LOC5 == NIM_NIL)) goto LA6;
				(*line) = setLengthStr((*line), ((NI) 0));
				result = NIM_FALSE;
				goto BeforeRet;
			}
			LA6: ;
			m = memchr(((void*) ((&(*line)->data[pos]))), ((int) 10), space);
			{
				NI last;
				if (!!((m == NIM_NIL))) goto LA10;
				last = (NI)(((NI) (m)) - ((NI) ((&(*line)->data[((NI) 0)]))));
				{
					NIM_BOOL LOC14;
					LOC14 = 0;
					LOC14 = (((NI) 0) < last);
					if (!(LOC14)) goto LA15;
					LOC14 = ((NU8)((*line)->data[(NI)(last - ((NI) 1))]) == (NU8)(13));
					LA15: ;
					if (!LOC14) goto LA16;
					(*line) = setLengthStr((*line), ((NI) ((NI)(last - ((NI) 1)))));
					result = NIM_TRUE;
					goto BeforeRet;
				}
				goto LA12;
				LA16: ;
				{
					NIM_BOOL LOC19;
					LOC19 = 0;
					LOC19 = (((NI) 0) < last);
					if (!(LOC19)) goto LA20;
					LOC19 = ((NU8)((*line)->data[(NI)(last - ((NI) 1))]) == (NU8)(0));
					LA20: ;
					if (!LOC19) goto LA21;
					{
						NIM_BOOL LOC25;
						LOC25 = 0;
						LOC25 = (last < (NI)((NI)(pos + space) - ((NI) 1)));
						if (!(LOC25)) goto LA26;
						LOC25 = !(((NU8)((*line)->data[(NI)(last + ((NI) 1))]) == (NU8)(0)));
						LA26: ;
						if (!LOC25) goto LA27;
						last -= ((NI) 1);
					}
					LA27: ;
				}
				goto LA12;
				LA21: ;
				LA12: ;
				(*line) = setLengthStr((*line), ((NI) (last)));
				result = NIM_TRUE;
				goto BeforeRet;
			}
			goto LA8;
			LA10: ;
			{
				space -= ((NI) 1);
			}
			LA8: ;
			pos += space;
			space = ((NI) 128);
			(*line) = setLengthStr((*line), ((NI) ((NI)(pos + space))));
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, isObj)(TNimType* obj, TNimType* subclass) {
	NIM_BOOL result;
	TNimType* x;
{	result = 0;
	x = obj;
	{
		if (!(x == subclass)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		while (1) {
			if (!!((x == subclass))) goto LA6;
			{
				if (!(x == NIM_NIL)) goto LA9;
				result = NIM_FALSE;
				goto BeforeRet;
			}
			LA9: ;
			x = (*x).base;
		} LA6: ;
	}
	result = NIM_TRUE;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP1065)(void* p, NI op) {
	Reraiseerror3660* a;
	a = (Reraiseerror3660*)p;
	nimGCvisit((void*)(*a).Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.message, op);
	nimGCvisit((void*)(*a).Sup.trace, op);
}

static N_INLINE(void, sysfatal_21217)(NimStringDesc* message) {
	Reraiseerror3660* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Reraiseerror3660*) newObj((&NTI21224), sizeof(Reraiseerror3660));
	(*e).Sup.Sup.m_type = (&NTI3660);
	LOC1 = 0;
	LOC1 = (*e).Sup.message; (*e).Sup.message = copyStringRC1(message);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	raiseException((Exception*)e, "ReraiseError");
}

N_NIMCALL(void, reraiseException)(void) {
	{
		if (!(currexception_19439 == NIM_NIL)) goto LA3;
		sysfatal_21217(((NimStringDesc*) &TMP1066));
	}
	goto LA1;
	LA3: ;
	{
		raiseexceptionaux_20601(currexception_19439);
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, HEX24_189183)(TY89887 x) {
	NimStringDesc* result;
	NIM_BOOL firstelement;
	NimStringDesc* LOC14;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP1067));
	firstelement = NIM_TRUE;
	{
		if (!!(firstelement)) goto LA3;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP1068));
	}
	LA3: ;
	result = resizeString(result, 8);
appendString(result, ((NimStringDesc*) &TMP1069));
	result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP1070));
	{
		if (!x.Field0 == 0) goto LA7;
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP1071));
	}
	goto LA5;
	LA7: ;
	{
		result = resizeString(result, x.Field0->Sup.len + 0);
appendString(result, x.Field0);
	}
	LA5: ;
	firstelement = NIM_FALSE;
	{
		if (!!(firstelement)) goto LA12;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP1068));
	}
	LA12: ;
	result = resizeString(result, 4);
appendString(result, ((NimStringDesc*) &TMP1072));
	result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP1070));
	LOC14 = 0;
	LOC14 = nimIntToStr(x.Field1);
	result = resizeString(result, LOC14->Sup.len + 0);
appendString(result, LOC14);
	firstelement = NIM_FALSE;
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP1073));
	return result;
}

N_NIMCALL(NIM_CHAR, getdecimalpoint_80406)(void) {
	NIM_CHAR result;
	result = 0;
	result = decimalpoint_80405;
	{
		if (!((NU8)(result) == (NU8)(0))) goto LA3;
		{
			NF LOC7;
			LOC7 = 0;
			LOC7 = strtod("0,5", NIM_NIL);
			if (!(LOC7 == 5.0000000000000000e-01)) goto LA8;
			result = 44;
		}
		goto LA5;
		LA8: ;
		{
			result = 46;
		}
		LA5: ;
		decimalpoint_80405 = result;
	}
	LA3: ;
	return result;
}

N_NIMCALL(NI, nimParseBiggestFloat)(NimStringDesc* s, NF* number, NI start) {
	NI result;
	NI i;
	NF sign;
	TY80422 t;
	NI ti;
	NIM_BOOL hasdigits;
{	result = 0;
	i = start;
	sign = 1.0000000000000000e+00;
	memset((void*)t, 0, sizeof(t));
	ti = ((NI) 0);
	hasdigits = NIM_FALSE;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((NU8)(s->data[i]) == (NU8)(43));
		if (LOC3) goto LA4;
		LOC3 = ((NU8)(s->data[i]) == (NU8)(45));
		LA4: ;
		if (!LOC3) goto LA5;
		{
			if (!((NU8)(s->data[i]) == (NU8)(45))) goto LA9;
			sign = -1.0000000000000000e+00;
		}
		LA9: ;
		t[(ti)- 0] = s->data[i];
		i += ((NI) 1);
		ti += ((NI) 1);
	}
	LA5: ;
	{
		NIM_BOOL LOC13;
		LOC13 = 0;
		LOC13 = ((NU8)(s->data[i]) == (NU8)(78));
		if (LOC13) goto LA14;
		LOC13 = ((NU8)(s->data[i]) == (NU8)(110));
		LA14: ;
		if (!LOC13) goto LA15;
		{
			NIM_BOOL LOC19;
			LOC19 = 0;
			LOC19 = ((NU8)(s->data[(NI)(i + ((NI) 1))]) == (NU8)(65));
			if (LOC19) goto LA20;
			LOC19 = ((NU8)(s->data[(NI)(i + ((NI) 1))]) == (NU8)(97));
			LA20: ;
			if (!LOC19) goto LA21;
			{
				NIM_BOOL LOC25;
				LOC25 = 0;
				LOC25 = ((NU8)(s->data[(NI)(i + ((NI) 2))]) == (NU8)(78));
				if (LOC25) goto LA26;
				LOC25 = ((NU8)(s->data[(NI)(i + ((NI) 2))]) == (NU8)(110));
				LA26: ;
				if (!LOC25) goto LA27;
				{
					if (!!((((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(97)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(122)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(65)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(90)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(48)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(57)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) == ((NU8)(95))))) goto LA31;
					(*number) = NAN;
					result = (NI)((NI)(i + ((NI) 3)) - start);
					goto BeforeRet;
				}
				LA31: ;
			}
			LA27: ;
		}
		LA21: ;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA15: ;
	{
		NIM_BOOL LOC35;
		LOC35 = 0;
		LOC35 = ((NU8)(s->data[i]) == (NU8)(73));
		if (LOC35) goto LA36;
		LOC35 = ((NU8)(s->data[i]) == (NU8)(105));
		LA36: ;
		if (!LOC35) goto LA37;
		{
			NIM_BOOL LOC41;
			LOC41 = 0;
			LOC41 = ((NU8)(s->data[(NI)(i + ((NI) 1))]) == (NU8)(78));
			if (LOC41) goto LA42;
			LOC41 = ((NU8)(s->data[(NI)(i + ((NI) 1))]) == (NU8)(110));
			LA42: ;
			if (!LOC41) goto LA43;
			{
				NIM_BOOL LOC47;
				LOC47 = 0;
				LOC47 = ((NU8)(s->data[(NI)(i + ((NI) 2))]) == (NU8)(70));
				if (LOC47) goto LA48;
				LOC47 = ((NU8)(s->data[(NI)(i + ((NI) 2))]) == (NU8)(102));
				LA48: ;
				if (!LOC47) goto LA49;
				{
					if (!!((((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(97)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(122)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(65)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(90)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) >= ((NU8)(48)) && ((NU8)(s->data[(NI)(i + ((NI) 3))])) <= ((NU8)(57)) || ((NU8)(s->data[(NI)(i + ((NI) 3))])) == ((NU8)(95))))) goto LA53;
					(*number) = ((NF)(INF) * (NF)(sign));
					result = (NI)((NI)(i + ((NI) 3)) - start);
					goto BeforeRet;
				}
				LA53: ;
			}
			LA49: ;
		}
		LA43: ;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA37: ;
	{
		while (1) {
			if (!(((NU8)(s->data[i])) >= ((NU8)(48)) && ((NU8)(s->data[i])) <= ((NU8)(57)))) goto LA56;
			hasdigits = NIM_TRUE;
			{
				if (!(ti < ((NI) 499))) goto LA59;
				t[(ti)- 0] = s->data[i];
				ti += ((NI) 1);
			}
			LA59: ;
			i += ((NI) 1);
			{
				while (1) {
					if (!((NU8)(s->data[i]) == (NU8)(95))) goto LA62;
					i += ((NI) 1);
				} LA62: ;
			}
		} LA56: ;
	}
	{
		if (!((NU8)(s->data[i]) == (NU8)(46))) goto LA65;
		{
			if (!(ti < ((NI) 499))) goto LA69;
			t[(ti)- 0] = getdecimalpoint_80406();
			ti += ((NI) 1);
		}
		LA69: ;
		i += ((NI) 1);
		{
			while (1) {
				if (!(((NU8)(s->data[i])) >= ((NU8)(48)) && ((NU8)(s->data[i])) <= ((NU8)(57)))) goto LA72;
				hasdigits = NIM_TRUE;
				{
					if (!(ti < ((NI) 499))) goto LA75;
					t[(ti)- 0] = s->data[i];
					ti += ((NI) 1);
				}
				LA75: ;
				i += ((NI) 1);
				{
					while (1) {
						if (!((NU8)(s->data[i]) == (NU8)(95))) goto LA78;
						i += ((NI) 1);
					} LA78: ;
				}
			} LA72: ;
		}
	}
	LA65: ;
	{
		if (!!(hasdigits)) goto LA81;
		result = ((NI) 0);
		goto BeforeRet;
	}
	LA81: ;
	{
		if (!(((NU8)(s->data[i])) == ((NU8)(101)) || ((NU8)(s->data[i])) == ((NU8)(69)))) goto LA85;
		{
			if (!(ti < ((NI) 499))) goto LA89;
			t[(ti)- 0] = s->data[i];
			ti += ((NI) 1);
		}
		LA89: ;
		i += ((NI) 1);
		{
			if (!(((NU8)(s->data[i])) == ((NU8)(43)) || ((NU8)(s->data[i])) == ((NU8)(45)))) goto LA93;
			{
				if (!(ti < ((NI) 499))) goto LA97;
				t[(ti)- 0] = s->data[i];
				ti += ((NI) 1);
			}
			LA97: ;
			i += ((NI) 1);
		}
		LA93: ;
		{
			if (!!((((NU8)(s->data[i])) >= ((NU8)(48)) && ((NU8)(s->data[i])) <= ((NU8)(57))))) goto LA101;
			result = ((NI) 0);
			goto BeforeRet;
		}
		LA101: ;
		{
			while (1) {
				if (!(((NU8)(s->data[i])) >= ((NU8)(48)) && ((NU8)(s->data[i])) <= ((NU8)(57)))) goto LA104;
				{
					if (!(ti < ((NI) 499))) goto LA107;
					t[(ti)- 0] = s->data[i];
					ti += ((NI) 1);
				}
				LA107: ;
				i += ((NI) 1);
				{
					while (1) {
						if (!((NU8)(s->data[i]) == (NU8)(95))) goto LA110;
						i += ((NI) 1);
					} LA110: ;
				}
			} LA104: ;
		}
	}
	LA85: ;
	(*number) = strtod(((NCSTRING) (t)), NIM_NIL);
	result = (NI)(i - start);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, reprEnum)(NI e_86409, TNimType* typ) {
	NimStringDesc* result;
	NI e;
	NimStringDesc* LOC25;
	NimStringDesc* LOC26;
{	result = 0;
	{
		if (!((*typ).size == ((NI) 1))) goto LA3;
		e = ((NI) ((NI)(e_86409 & ((NI) 255))));
	}
	goto LA1;
	LA3: ;
	{
		if (!((*typ).size == ((NI) 2))) goto LA6;
		e = ((NI) ((NI)(e_86409 & ((NI) 65535))));
	}
	goto LA1;
	LA6: ;
	{
		e = e_86409;
	}
	LA1: ;
	{
		if (!!((((*typ).flags &(1U<<((NU)(((NU8) 2))&7U)))!=0))) goto LA11;
		{
			if (!((NU32)(e) < (NU32)((*(*typ).node).len))) goto LA15;
			result = cstrToNimstr((*(*(*typ).node).sons[(e)- 0]).name);
			goto BeforeRet;
		}
		LA15: ;
	}
	goto LA9;
	LA11: ;
	{
		TNimNode* n;
		TNimNode** s;
		n = (*typ).node;
		s = (*n).sons;
		{
			NI i_86447;
			NI HEX3Atmp_86449;
			NI res_86452;
			i_86447 = 0;
			HEX3Atmp_86449 = 0;
			HEX3Atmp_86449 = (NI)((*n).len - ((NI) 1));
			res_86452 = ((NI) 0);
			{
				while (1) {
					if (!(res_86452 <= HEX3Atmp_86449)) goto LA20;
					i_86447 = res_86452;
					{
						if (!((*s[(i_86447)- 0]).offset == e)) goto LA23;
						result = cstrToNimstr((*s[(i_86447)- 0]).name);
						goto BeforeRet;
					}
					LA23: ;
					res_86452 += ((NI) 1);
				} LA20: ;
			}
		}
	}
	LA9: ;
	LOC25 = 0;
	LOC26 = 0;
	LOC26 = nimIntToStr(e);
	LOC25 = rawNewString(LOC26->Sup.len + 16);
appendString(LOC25, LOC26);
appendString(LOC25, ((NimStringDesc*) &TMP1118));
	result = LOC25;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnodeseq216784*, HEX40_217610)(Tnode216790** a, NI aLen0) {
	Tnodeseq216784* result;
	result = 0;
	result = (Tnodeseq216784*) newSeq((&NTI216784), ((NI) (aLen0)));
	{
		NI i_217651;
		NI HEX3Atmp_217653;
		NI res_217656;
		i_217651 = 0;
		HEX3Atmp_217653 = 0;
		HEX3Atmp_217653 = (NI)(aLen0 - ((NI) 1));
		res_217656 = ((NI) 0);
		{
			while (1) {
				if (!(res_217656 <= HEX3Atmp_217653)) goto LA3;
				i_217651 = res_217656;
				asgnRefNoCycle((void**) (&result->data[i_217651]), a[i_217651]);
				res_217656 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}
N_NIMCALL(void, TMP1206)(void* p, NI op) {
	Oserror3630* a;
	a = (Oserror3630*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
}

N_NIMCALL(NimStringDesc*, HEX24_83606)(NI16* w, NI estimate, NI replacement) {
	NimStringDesc* result;
	NI i;
	result = 0;
	result = rawNewString(((NI) ((NI)(estimate + (NI)((NU32)(estimate) >> (NU32)(((NI) 2)))))));
	i = ((NI) 0);
	{
		while (1) {
			NI ch;
			if (!!((w[(i)- 0] == ((NI16) 0)))) goto LA2;
			ch = ((NI) (((NU16) (w[(i)- 0]))));
			i += ((NI) 1);
			{
				NIM_BOOL LOC5;
				NI ch2;
				LOC5 = 0;
				LOC5 = (((NI) 55296) <= ch);
				if (!(LOC5)) goto LA6;
				LOC5 = (ch <= ((NI) 56319));
				LA6: ;
				if (!LOC5) goto LA7;
				ch2 = ((NI) (((NU16) (w[(i)- 0]))));
				{
					NIM_BOOL LOC11;
					LOC11 = 0;
					LOC11 = (((NI) 56320) <= ch2);
					if (!(LOC11)) goto LA12;
					LOC11 = (ch2 <= ((NI) 57343));
					LA12: ;
					if (!LOC11) goto LA13;
					ch = (NI)((NI)((NI)((NU32)(((NI) ((NI)(ch & ((NI) 1023))))) << (NU32)(((NI) 10))) + ((NI) ((NI)(ch2 & ((NI) 1023))))) + ((NI) 65536));
					i += ((NI) 1);
				}
				goto LA9;
				LA13: ;
				{
					ch = replacement;
				}
				LA9: ;
			}
			goto LA3;
			LA7: ;
			{
				NIM_BOOL LOC17;
				LOC17 = 0;
				LOC17 = (((NI) 56320) <= ch);
				if (!(LOC17)) goto LA18;
				LOC17 = (ch <= ((NI) 57343));
				LA18: ;
				if (!LOC17) goto LA19;
				ch = replacement;
			}
			goto LA3;
			LA19: ;
			LA3: ;
			{
				if (!(ch < ((NI) 128))) goto LA23;
				result = addChar(result, ((NIM_CHAR) (((NI) (ch)))));
			}
			goto LA21;
			LA23: ;
			{
				if (!(ch < ((NI) 2048))) goto LA26;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 6))) | ((NI) 192)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)(ch & ((NI) 63)))) | ((NI) 128)))))));
			}
			goto LA21;
			LA26: ;
			{
				if (!(ch < ((NI) 65536))) goto LA29;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 12))) | ((NI) 224)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 6))) & ((NI) 63)))) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)(ch & ((NI) 63)))) | ((NI) 128)))))));
			}
			goto LA21;
			LA29: ;
			{
				if (!(ch <= ((NI) 1114111))) goto LA32;
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 18))) | ((NI) 240)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 12))) & ((NI) 63)))) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)((NI)((NU32)(ch) >> (NU32)(((NI) 6))) & ((NI) 63)))) | ((NI) 128)))))));
				result = addChar(result, ((NIM_CHAR) (((NI) ((NI)(((NI) ((NI)(ch & ((NI) 63)))) | ((NI) 128)))))));
			}
			goto LA21;
			LA32: ;
			{
				result = addChar(result, 239);
				result = addChar(result, 191);
				result = addChar(result, 189);
			}
			LA21: ;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, HEX24_83672)(NI16* s) {
	NimStringDesc* result;
	result = 0;
	result = HEX24_83606(s, ((NI) 80), ((NI) 65533));
	return result;
}

N_NIMCALL(void, objectinitaux_85478)(void* dest, TNimNode* n) {
	NI d;
	d = ((NI) (dest));
	switch ((*n).kind) {
	case ((NU8) 0):
	{
	}
	break;
	case ((NU8) 1):
	{
		objectInit(((void*) ((NI)((NU32)(d) + (NU32)((*n).offset)))), (*n).typ);
	}
	break;
	case ((NU8) 2):
	{
		{
			NI i_85619;
			NI HEX3Atmp_85636;
			NI res_85639;
			i_85619 = 0;
			HEX3Atmp_85636 = 0;
			HEX3Atmp_85636 = (NI)((*n).len - ((NI) 1));
			res_85639 = ((NI) 0);
			{
				while (1) {
					if (!(res_85639 <= HEX3Atmp_85636)) goto LA6;
					i_85619 = res_85639;
					objectinitaux_85478(dest, (*n).sons[(i_85619)- 0]);
					res_85639 += ((NI) 1);
				} LA6: ;
			}
		}
	}
	break;
	case ((NU8) 3):
	{
		TNimNode* m;
		m = selectbranch_27607(dest, n);
		{
			if (!!((m == NIM_NIL))) goto LA10;
			objectinitaux_85478(dest, m);
		}
		LA10: ;
	}
	break;
	}
}

N_NIMCALL(void, objectInit)(void* dest, TNimType* typ) {
	NI d;
	d = ((NI) (dest));
	switch ((*typ).kind) {
	case ((NU8) 17):
	{
		TNimType** pint;
		pint = ((TNimType**) (dest));
		(*pint) = typ;
		objectinitaux_85478(dest, (*typ).node);
	}
	break;
	case ((NU8) 18):
	{
		objectinitaux_85478(dest, (*typ).node);
	}
	break;
	case ((NU8) 16):
	case ((NU8) 4):
	{
		{
			NI i_85659;
			NI HEX3Atmp_85673;
			NI res_85676;
			i_85659 = 0;
			HEX3Atmp_85673 = 0;
			HEX3Atmp_85673 = (NI)((NI)((*typ).size / (*(*typ).base).size) - ((NI) 1));
			res_85676 = ((NI) 0);
			{
				while (1) {
					if (!(res_85676 <= HEX3Atmp_85673)) goto LA6;
					i_85659 = res_85676;
					objectInit(((void*) ((NI)((NU32)(d) + (NU32)((NI)(i_85659 * (*(*typ).base).size))))), (*typ).base);
					res_85676 += ((NI) 1);
				} LA6: ;
			}
		}
	}
	break;
	default:
	{
	}
	break;
	}
}

N_NIMCALL(NI16*, newwidecstring_83602)(NimStringDesc* s) {
	NI16* result;
	result = 0;
	result = newwidecstring_83412(s->data, (s ? s->Sup.len : 0));
	return result;
}
N_NIMCALL(void, TMP1243)(void* p, NI op) {
	Keyerror3648* a;
	a = (Keyerror3648*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
}

N_NIMCALL(NI, readbuffer_15554)(FILE* f, void* buffer, NI len) {
	NI result;
	result = 0;
	result = fread(buffer, ((NI) 1), ((NI) (len)), f);
	return result;
}

N_NIMCALL(NI, ptrsize_45613)(void* p) {
	NI result;
	void* x;
	Basechunk29437* c;
	result = 0;
	x = ((void*) ((NI)((NU32)(((NI) (p))) - (NU32)(((NI)sizeof(Freecell29429))))));
	c = pageaddr_31180(p);
	result = (NI)((NU32)((*c).size) - (NU32)(((NI)sizeof(Freecell29429))));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = issmallchunk_31069(c);
		if (!!(LOC3)) goto LA4;
		result -= (NI)(((NI)sizeof(Bigchunk29441)) - ((NI) 8));
	}
	LA4: ;
	return result;
}

N_NIMCALL(void*, realloc_47004)(Memregion29487* allocator, void* p, NI newsize) {
	void* result;
	result = 0;
	{
		if (!(((NI) 0) < ((NI) (newsize)))) goto LA3;
		result = alloc0_46016(allocator, newsize);
		{
			NI LOC9;
			if (!!((p == NIM_NIL))) goto LA7;
			LOC9 = 0;
			LOC9 = ptrsize_45613(p);
			memcpy(result, p, ((NI) (LOC9)));
			dealloc_46022(allocator, p);
		}
		LA7: ;
	}
	goto LA1;
	LA3: ;
	{
		if (!!((p == NIM_NIL))) goto LA11;
		dealloc_46022(allocator, p);
	}
	goto LA1;
	LA11: ;
	LA1: ;
	return result;
}

N_NOCONV(void*, realloc_7433)(void* p, NI newsize) {
	void* result;
	result = 0;
	result = realloc_47004((&gch_49659.region), p, newsize);
	return result;
}

N_NIMCALL(NimStringDesc*, nimInt64ToStr)(NI64 x) {
	NimStringDesc* result;
	NI i;
	NI64 y;
	result = 0;
	result = mnewString(((NI) 32));
	i = ((NI) 0);
	y = x;
	{
		while (1) {
			NI64 d;
			d = (NI64)(y / IL64(10));
			result->data[i] = ((NIM_CHAR) (((NI) ((NI)((((NI) ((NI64)(y - (NI64)(d * IL64(10))))) > 0? (((NI) ((NI64)(y - (NI64)(d * IL64(10)))))) : -(((NI) ((NI64)(y - (NI64)(d * IL64(10))))))) + ((NI) 48))))));
			i += ((NI) 1);
			y = d;
			{
				if (!(y == IL64(0))) goto LA5;
				goto LA1;
			}
			LA5: ;
		}
	} LA1: ;
	{
		if (!(x < IL64(0))) goto LA9;
		result->data[i] = 45;
		i += ((NI) 1);
	}
	LA9: ;
	result = setLengthStr(result, ((NI) (i)));
	{
		NI j_80736;
		NI HEX3Atmp_80749;
		NI res_80752;
		j_80736 = 0;
		HEX3Atmp_80749 = 0;
		HEX3Atmp_80749 = (NI)((NI)(i / ((NI) 2)) - ((NI) 1));
		res_80752 = ((NI) 0);
		{
			while (1) {
				NIM_CHAR LOC14;
				if (!(res_80752 <= HEX3Atmp_80749)) goto LA13;
				j_80736 = res_80752;
				LOC14 = 0;
				LOC14 = result->data[j_80736];
				result->data[j_80736] = result->data[(NI)((NI)(i - j_80736) - ((NI) 1))];
				result->data[(NI)((NI)(i - j_80736) - ((NI) 1))] = LOC14;
				res_80752 += ((NI) 1);
			} LA13: ;
		}
	}
	return result;
}

N_NIMCALL(NI64, mulInt64)(NI64 a, NI64 b) {
	NI64 result;
	NF resasfloat;
	NF floatprod;
{	result = 0;
	resasfloat = 0;
	floatprod = 0;
	result = (NI64)((NU64)(a) * (NU64)(b));
	floatprod = ((double) (a));
	floatprod = ((NF)(floatprod) * (NF)(((double) (b))));
	resasfloat = ((double) (result));
	{
		if (!(resasfloat == floatprod)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!(((NF)(3.2000000000000000e+01) * (NF)((((NF)(resasfloat) - (NF)(floatprod)) > 0? (((NF)(resasfloat) - (NF)(floatprod))) : -(((NF)(resasfloat) - (NF)(floatprod)))))) <= (floatprod > 0? (floatprod) : -(floatprod)))) goto LA7;
		goto BeforeRet;
	}
	LA7: ;
	raiseOverflow();
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, nimFloatToStr)(NF f) {
	NimStringDesc* result;
	TY80365 buf;
	NI n;
	int LOC1;
	NIM_BOOL hasdot;
	result = 0;
	memset((void*)buf, 0, sizeof(buf));
	LOC1 = 0;
	LOC1 = sprintf(((NCSTRING) (buf)), "%.16g", f);
	n = ((NI) (LOC1));
	hasdot = NIM_FALSE;
	{
		NI i_80378;
		NI HEX3Atmp_80393;
		NI res_80396;
		i_80378 = 0;
		HEX3Atmp_80393 = 0;
		HEX3Atmp_80393 = (NI)(n - ((NI) 1));
		res_80396 = ((NI) 0);
		{
			while (1) {
				if (!(res_80396 <= HEX3Atmp_80393)) goto LA4;
				i_80378 = res_80396;
				{
					if (!((NU8)(buf[(i_80378)- 0]) == (NU8)(44))) goto LA7;
					buf[(i_80378)- 0] = 46;
					hasdot = NIM_TRUE;
				}
				goto LA5;
				LA7: ;
				{
					if (!(((NU8)(buf[(i_80378)- 0])) >= ((NU8)(97)) && ((NU8)(buf[(i_80378)- 0])) <= ((NU8)(122)) || ((NU8)(buf[(i_80378)- 0])) >= ((NU8)(65)) && ((NU8)(buf[(i_80378)- 0])) <= ((NU8)(90)) || ((NU8)(buf[(i_80378)- 0])) == ((NU8)(46)))) goto LA10;
					hasdot = NIM_TRUE;
				}
				goto LA5;
				LA10: ;
				LA5: ;
				res_80396 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		if (!!(hasdot)) goto LA14;
		buf[(n)- 0] = 46;
		buf[((NI)(n + ((NI) 1)))- 0] = 48;
		buf[((NI)(n + ((NI) 2)))- 0] = 0;
	}
	LA14: ;
	{
		if (!((NU8)(buf[((NI)(n - ((NI) 1)))- 0]) == (NU8)(78))) goto LA18;
		result = copyString(((NimStringDesc*) &TMP1399));
	}
	goto LA16;
	LA18: ;
	{
		if (!((NU8)(buf[((NI)(n - ((NI) 1)))- 0]) == (NU8)(70))) goto LA21;
		{
			if (!((NU8)(buf[(((NI) 0))- 0]) == (NU8)(45))) goto LA25;
			result = copyString(((NimStringDesc*) &TMP1400));
		}
		goto LA23;
		LA25: ;
		{
			result = copyString(((NimStringDesc*) &TMP1401));
		}
		LA23: ;
	}
	goto LA16;
	LA21: ;
	{
		result = cstrToNimstr(((NCSTRING) (buf)));
	}
	LA16: ;
	return result;
}

N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_85404, TNimType* mt) {
	void* src;
	src = src_85404;
	genericAssign(dest, ((void*) ((&src))), mt);
}

static N_INLINE(void*, seqtoptr_533160)(TY216913* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_533149)(TY216913* x, TY216913* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_533160(x);
		LOC4 = 0;
		LOC4 = seqtoptr_533160(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_533160(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_533160(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_533225;
			NI HEX3Atmp_533227;
			NI res_533230;
			i_533225 = 0;
			HEX3Atmp_533227 = 0;
			HEX3Atmp_533227 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_533230 = ((NI) 0);
			{
				while (1) {
					if (!(res_533230 <= HEX3Atmp_533227)) goto LA19;
					i_533225 = res_533230;
					{
						if (!!((x->data[i_533225] == y->data[i_533225]))) goto LA22;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA22: ;
					res_533230 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, safeadd_533138)(TY216913** x, NI32 y) {
	{
		NIM_BOOL LOC3;
		TY533234 LOC6;
		LOC3 = 0;
		LOC3 = HEX3DHEX3D_533149((*x), NIM_NIL);
		if (!LOC3) goto LA4;
		unsureAsgnRef((void**) (&(*x)), (TY216913*) newSeq((&NTI216913), 1));
		LOC6[0] = y;
		(*x)->data[0] = LOC6[0];
	}
	goto LA1;
	LA4: ;
	{
		(*x) = (TY216913*) incrSeqV2(&((*x))->Sup, sizeof(NI32));
		(*x)->data[(*x)->Sup.len] = y;
		++(*x)->Sup.len;
	}
	LA1: ;
}

static N_INLINE(void, pushSafePoint)(TSafePoint* s) {
	(*s).hasRaiseAction = NIM_FALSE;
	(*s).prev = exchandler_19437;
	exchandler_19437 = s;
}

N_NIMCALL(NI, rawfilesize_81666)(FILE* file) {
	NI result;
	NI oldpos;
	NI LOC1;
	NI LOC2;
	result = 0;
	oldpos = ftell(file);
	LOC1 = 0;
	LOC1 = fseek(file, ((long) 0), ((NI) 2));
	result = ftell(file);
	LOC2 = 0;
	LOC2 = fseek(file, ((long) (oldpos)), ((NI) 0));
	return result;
}

N_NIMCALL(NIM_BOOL, endoffile_15454)(FILE* f) {
	NIM_BOOL result;
	int c;
{	result = 0;
	c = fgetc(f);
	ungetc(c, f);
	result = (c < ((NI32) 0));
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, readallbuffer_81658)(FILE* file) {
	NimStringDesc* result;
	NimStringDesc* buffer;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP1564));
	buffer = mnewString(((NI) 4000));
	{
		while (1) {
			NI bytesread;
			bytesread = readbuffer_15554(file, ((void*) ((&buffer->data[((NI) 0)]))), ((NI) 4000));
			{
				if (!(bytesread == ((NI) 4000))) goto LA5;
				result = resizeString(result, buffer->Sup.len + 0);
appendString(result, buffer);
			}
			goto LA3;
			LA5: ;
			{
				buffer = setLengthStr(buffer, ((NI) (bytesread)));
				result = resizeString(result, buffer->Sup.len + 0);
appendString(result, buffer);
				goto LA1;
			}
			LA3: ;
		}
	} LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, readallfile_81672)(FILE* file, NI len) {
	NimStringDesc* result;
	NI bytes;
	result = 0;
	result = mnewString(((NI) (len)));
	bytes = readbuffer_15554(file, ((void*) ((&result->data[((NI) 0)]))), ((NI) (len)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = endoffile_15454(file);
		if (!LOC3) goto LA4;
		{
			if (!(bytes < len)) goto LA8;
			result = setLengthStr(result, ((NI) (bytes)));
		}
		LA8: ;
	}
	goto LA1;
	LA4: ;
	{
		NI LOC11;
		LOC11 = 0;
		LOC11 = ferror(file);
		if (!!((LOC11 == ((NI) 0)))) goto LA12;
		raiseeio_81005(((NimStringDesc*) &TMP1563));
	}
	goto LA1;
	LA12: ;
	{
		NimStringDesc* LOC15;
		LOC15 = 0;
		LOC15 = readallbuffer_81658(file);
		result = resizeString(result, LOC15->Sup.len + 0);
appendString(result, LOC15);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NimStringDesc*, readall_15463)(FILE* file) {
	NimStringDesc* result;
	NI len;
	result = 0;
	{
		if (!!((file == stdin))) goto LA3;
		len = rawfilesize_81666(file);
	}
	goto LA1;
	LA3: ;
	{
		len = ((NI) -1);
	}
	LA1: ;
	{
		if (!(((NI) 0) < len)) goto LA8;
		result = readallfile_81672(file, len);
	}
	goto LA6;
	LA8: ;
	{
		result = readallbuffer_81658(file);
	}
	LA6: ;
	return result;
}

static N_INLINE(void, popSafePoint)(void) {
	exchandler_19437 = (*exchandler_19437).prev;
}

N_NIMCALL(NimStringDesc*, readfile_15466)(NimStringDesc* filename) {
	NimStringDesc* volatile result;
	FILE* f;
	TSafePoint TMP1562;
	result = 0;
	f = open_15417(filename, ((NU8) 0), ((NI) -1));
	pushSafePoint(&TMP1562);
	TMP1562.status = setjmp(TMP1562.context);
	if (TMP1562.status == 0) {
		result = readall_15463(f);
		popSafePoint();
	}
	else {
		popSafePoint();
	}
	{
		fclose(f);
	}
	if (TMP1562.status != 0) reraiseException();
	return result;
}

N_NIMCALL(NI, cmp_5680)(NimStringDesc* x, NimStringDesc* y) {
	NI result;
	int LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = strcmp(x->data, y->data);
	result = ((NI) (LOC1));
	return result;
}

N_NIMCALL(NI, hashString)(NimStringDesc* s) {
	NI result;
	NI h;
	result = 0;
	h = ((NI) 0);
	{
		NI i_79820;
		NI HEX3Atmp_79868;
		NI res_79871;
		i_79820 = 0;
		HEX3Atmp_79868 = 0;
		HEX3Atmp_79868 = (NI)((s ? s->Sup.len : 0) - ((NI) 1));
		res_79871 = ((NI) 0);
		{
			while (1) {
				if (!(res_79871 <= HEX3Atmp_79868)) goto LA3;
				i_79820 = res_79871;
				h = (NI)((NU32)(h) + (NU32)(((NI) (((NU8)(s->data[i_79820]))))));
				h = (NI)((NU32)(h) + (NU32)((NI)((NU32)(h) << (NU32)(((NI) 10)))));
				h = (NI)(h ^ (NI)((NU32)(h) >> (NU32)(((NI) 6))));
				res_79871 += ((NI) 1);
			} LA3: ;
		}
	}
	h = (NI)((NU32)(h) + (NU32)((NI)((NU32)(h) << (NU32)(((NI) 3)))));
	h = (NI)(h ^ (NI)((NU32)(h) >> (NU32)(((NI) 11))));
	h = (NI)((NU32)(h) + (NU32)((NI)((NU32)(h) << (NU32)(((NI) 15)))));
	result = h;
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_194093)(Sha1digest194003 x, Sha1digest194003 y) {
	NIM_BOOL result;
{	result = 0;
	{
		NI f_194214;
		NI res_194227;
		f_194214 = 0;
		res_194227 = ((NI) 0);
		{
			while (1) {
				if (!(res_194227 <= ((NI) 19))) goto LA3;
				f_194214 = ((NI) (res_194227));
				{
					if (!!((x[(f_194214)- 0] == y[(f_194214)- 0]))) goto LA6;
					goto BeforeRet;
				}
				LA6: ;
				res_194227 += ((NI) 1);
			} LA3: ;
		}
	}
	result = NIM_TRUE;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, write_15505)(FILE* f, NimStringDesc** a, NI aLen0) {
	{
		NimStringDesc* x_81651;
		NI i_81657;
		x_81651 = 0;
		i_81657 = ((NI) 0);
		{
			while (1) {
				if (!(i_81657 < aLen0)) goto LA3;
				x_81651 = a[i_81657];
				write_15489(f, x_81651);
				i_81657 += ((NI) 1);
			} LA3: ;
		}
	}
}

N_NIMCALL(void, Gcdisablemarkandsweep_9819)(void) {
	gch_49659.cyclethreshold = ((NI) 2147483646);
}

N_NIMCALL(NimStringDesc*, readline_15510)(FILE* f) {
	NimStringDesc* result;
	result = 0;
	result = rawNewString(((NI) 80));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = readline_15513(f, (&result));
		if (!!(LOC3)) goto LA4;
		raiseeio_81005(((NimStringDesc*) &TMP1930));
	}
	LA4: ;
	return result;
}

N_NIMCALL(void, insert_90801)(NimStringDesc** x, NimStringDesc* item, NI i) {
	NI xl;
	NI j;
	xl = ((*x) ? (*x)->Sup.len : 0);
	(*x) = setLengthStr((*x), ((NI) ((NI)(xl + (item ? item->Sup.len : 0)))));
	j = (NI)(xl - ((NI) 1));
	{
		while (1) {
			if (!(((NI) (i)) <= j)) goto LA2;
			(*x)->data[(NI)(j + (item ? item->Sup.len : 0))] = (*x)->data[j];
			j -= ((NI) 1);
		} LA2: ;
	}
	j = ((NI) 0);
	{
		while (1) {
			if (!(j < (item ? item->Sup.len : 0))) goto LA4;
			(*x)->data[(NI)(j + ((NI) (i)))] = item->data[j];
			j += ((NI) 1);
		} LA4: ;
	}
}
N_NIMCALL(void, TMP2317)(void* p, NI op) {
	Assertionerror3644* a;
	a = (Assertionerror3644*)p;
	nimGCvisit((void*)(*a).Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.message, op);
	nimGCvisit((void*)(*a).Sup.trace, op);
}

static N_INLINE(void, sysfatal_89898)(NimStringDesc* message) {
	Assertionerror3644* e;
	NimStringDesc* LOC1;
	e = 0;
	e = (Assertionerror3644*) newObj((&NTI89905), sizeof(Assertionerror3644));
	(*e).Sup.Sup.m_type = (&NTI3644);
	LOC1 = 0;
	LOC1 = (*e).Sup.message; (*e).Sup.message = copyStringRC1(message);
	if (LOC1) nimGCunrefNoCycle(LOC1);
	raiseException((Exception*)e, "AssertionError");
}

N_NOINLINE(void, raiseassert_89893)(NimStringDesc* msg) {
	sysfatal_89898(msg);
}

static N_INLINE(void*, seqtoptr_250938)(Ttypeseq216824* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_250927)(Ttypeseq216824* x, Ttypeseq216824* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_250938(x);
		LOC4 = 0;
		LOC4 = seqtoptr_250938(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_250938(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_250938(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_251003;
			NI HEX3Atmp_251016;
			NI res_251019;
			i_251003 = 0;
			HEX3Atmp_251016 = 0;
			HEX3Atmp_251016 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_251019 = ((NI) 0);
			{
				while (1) {
					if (!(res_251019 <= HEX3Atmp_251016)) goto LA19;
					i_251003 = res_251019;
					{
						if (!!((x->data[i_251003] == y->data[i_251003]))) goto LA22;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA22: ;
					res_251019 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_246515)(TY246443 x, TY246443 y) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!((x.Field0 == y.Field0))) goto LA3;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((x.Field1 == y.Field1))) goto LA7;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA7: ;
	result = NIM_TRUE;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, safeadd_285485)(Ttypeseq216824** x, Ttype216828* y) {
	{
		NIM_BOOL LOC3;
		TY368877 LOC6;
		LOC3 = 0;
		LOC3 = HEX3DHEX3D_250927((*x), NIM_NIL);
		if (!LOC3) goto LA4;
		unsureAsgnRef((void**) (&(*x)), (Ttypeseq216824*) newSeq((&NTI216824), 1));
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = y;
		asgnRefNoCycle((void**) (&(*x)->data[0]), LOC6[0]);
	}
	goto LA1;
	LA4: ;
	{
		(*x) = (Ttypeseq216824*) incrSeqV2(&((*x))->Sup, sizeof(Ttype216828*));
		asgnRefNoCycle((void**) (&(*x)->data[(*x)->Sup.len]), y);
		++(*x)->Sup.len;
	}
	LA1: ;
}

N_NIMCALL(void, setfilepos_15581)(FILE* f, NI64 pos) {
	{
		NI LOC3;
		LOC3 = 0;
		LOC3 = fseek(f, ((long) (pos)), ((NI) 0));
		if (!!((LOC3 == ((NI) 0)))) goto LA4;
		raiseeio_81005(((NimStringDesc*) &TMP2837));
	}
	LA4: ;
}

N_NIMCALL(NI64, getfilepos_15585)(FILE* f) {
	NI64 result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ftell(f);
	result = ((NI64) (LOC1));
	{
		if (!(result < IL64(0))) goto LA4;
		raiseeio_81005(((NimStringDesc*) &TMP2838));
	}
	LA4: ;
	return result;
}

N_NIMCALL(void, writefile_15469)(NimStringDesc* filename, NimStringDesc* content) {
	FILE* f;
	TSafePoint TMP2910;
	f = open_15417(filename, ((NU8) 1), ((NI) -1));
	pushSafePoint(&TMP2910);
	TMP2910.status = setjmp(TMP2910.context);
	if (TMP2910.status == 0) {
		write_15489(f, content);
		popSafePoint();
	}
	else {
		popSafePoint();
	}
	{
		fclose(f);
	}
	if (TMP2910.status != 0) reraiseException();
}

N_NIMCALL(void, genericShallowAssign)(void* dest, void* src, TNimType* mt) {
	genericassignaux_84606(dest, src, mt, NIM_TRUE);
}

N_NIMCALL(NimStringDesc*, HEX24_7801)(NU64 x) {
	NimStringDesc* result;
	result = 0;
	{
		if (!(x == ((NI) 0))) goto LA3;
		result = copyString(((NimStringDesc*) &TMP3075));
	}
	goto LA1;
	LA3: ;
	{
		TY86237 buf;
		NI i;
		NU64 n;
		NI half;
		memset((void*)buf, 0, sizeof(buf));
		i = ((NI) 0);
		n = x;
		{
			while (1) {
				NU64 nn;
				if (!!((n == ((NI) 0)))) goto LA7;
				nn = (NU64)((NU64)(n) / (NU64)(10ULL));
				buf[(i)- 0] = ((NIM_CHAR) ((NU64)((NU64)((NU64)((NU64)(n) - (NU64)((NU64)((NU64)(10ULL) * (NU64)(nn))))) + (NU64)(((NI) 48)))));
				i += ((NI) 1);
				n = nn;
			} LA7: ;
		}
		half = (NI)(i / ((NI) 2));
		{
			NI t_86322;
			NI HEX3Atmp_86337;
			NI res_86340;
			t_86322 = 0;
			HEX3Atmp_86337 = 0;
			HEX3Atmp_86337 = (half - 1);
			res_86340 = ((NI) 0);
			{
				while (1) {
					NIM_CHAR LOC11;
					if (!(res_86340 <= HEX3Atmp_86337)) goto LA10;
					t_86322 = res_86340;
					LOC11 = 0;
					LOC11 = buf[(t_86322)- 0];
					buf[(t_86322)- 0] = buf[((NI)((NI)(i - t_86322) - ((NI) 1)))- 0];
					buf[((NI)((NI)(i - t_86322) - ((NI) 1)))- 0] = LOC11;
					res_86340 += ((NI) 1);
				} LA10: ;
			}
		}
		result = cstrToNimstr(((NCSTRING) (buf)));
	}
	LA1: ;
	return result;
}

N_NIMCALL(NI, clamp_148165)(NI x, NI a, NI b) {
	NI result;
{	result = 0;
	{
		if (!(x < a)) goto LA3;
		result = a;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!(b < x)) goto LA7;
		result = b;
		goto BeforeRet;
	}
	LA7: ;
	result = x;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, nimBoolToStr)(NIM_BOOL x) {
	NimStringDesc* result;
{	result = 0;
	{
		if (!x) goto LA3;
		result = copyString(((NimStringDesc*) &TMP3140));
	}
	goto LA1;
	LA3: ;
	{
		result = copyString(((NimStringDesc*) &TMP3141));
	}
	LA1: ;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tinstantiation216812*, new_430322)(void) {
	Tinstantiation216812* result;
	Tinstantiation216812* r;
{	result = 0;
	r = 0;
	r = (Tinstantiation216812*) newObj((&NTI216814), sizeof(Tinstantiation216812));
	result = r;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

static N_INLINE(void*, seqtoptr_219875)(TY216925* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_219864)(TY216925* x, TY216925* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_219875(x);
		LOC4 = 0;
		LOC4 = seqtoptr_219875(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_219875(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_219875(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_219940;
			NI HEX3Atmp_219953;
			NI res_219956;
			i_219940 = 0;
			HEX3Atmp_219953 = 0;
			HEX3Atmp_219953 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_219956 = ((NI) 0);
			{
				while (1) {
					if (!(res_219956 <= HEX3Atmp_219953)) goto LA19;
					i_219940 = res_219956;
					{
						if (!!((x->data[i_219940] == y->data[i_219940]))) goto LA22;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA22: ;
					res_219956 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, safeadd_430495)(TY216925** x, Tinstantiation216812* y) {
	{
		NIM_BOOL LOC3;
		TY430516 LOC6;
		LOC3 = 0;
		LOC3 = HEX3DHEX3D_219864((*x), NIM_NIL);
		if (!LOC3) goto LA4;
		unsureAsgnRef((void**) (&(*x)), (TY216925*) newSeq((&NTI216925), 1));
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = y;
		asgnRefNoCycle((void**) (&(*x)->data[0]), LOC6[0]);
	}
	goto LA1;
	LA4: ;
	{
		(*x) = (TY216925*) incrSeqV2(&((*x))->Sup, sizeof(Tinstantiation216812*));
		asgnRefNoCycle((void**) (&(*x)->data[(*x)->Sup.len]), y);
		++(*x)->Sup.len;
	}
	LA1: ;
}

static N_INLINE(void*, seqtoptr_284355)(Tnodeseq216784* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_284344)(Tnodeseq216784* x, Tnodeseq216784* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_284355(x);
		LOC4 = 0;
		LOC4 = seqtoptr_284355(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_284355(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_284355(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_284420;
			NI HEX3Atmp_284433;
			NI res_284436;
			i_284420 = 0;
			HEX3Atmp_284433 = 0;
			HEX3Atmp_284433 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_284436 = ((NI) 0);
			{
				while (1) {
					if (!(res_284436 <= HEX3Atmp_284433)) goto LA19;
					i_284420 = res_284436;
					{
						if (!!((x->data[i_284420] == y->data[i_284420]))) goto LA22;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA22: ;
					res_284436 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, safeadd_431175)(Tnodeseq216784** x, Tnode216790* y) {
	{
		NIM_BOOL LOC3;
		TY232280 LOC6;
		LOC3 = 0;
		LOC3 = HEX3DHEX3D_284344((*x), NIM_NIL);
		if (!LOC3) goto LA4;
		unsureAsgnRef((void**) (&(*x)), (Tnodeseq216784*) newSeq((&NTI216784), 1));
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = y;
		asgnRefNoCycle((void**) (&(*x)->data[0]), LOC6[0]);
	}
	goto LA1;
	LA4: ;
	{
		(*x) = (Tnodeseq216784*) incrSeqV2(&((*x))->Sup, sizeof(Tnode216790*));
		asgnRefNoCycle((void**) (&(*x)->data[(*x)->Sup.len]), y);
		++(*x)->Sup.len;
	}
	LA1: ;
}

N_NIMCALL(void, insert_431284)(Tnodeseq216784** x, Tnode216790* item, NI i) {
	NI xl_431602;
	NI j_431604;
	xl_431602 = ((*x) ? (*x)->Sup.len : 0);
	(*x) = (Tnodeseq216784*) setLengthSeq(&((*x))->Sup, sizeof(Tnode216790*), ((NI) ((NI)(xl_431602 + ((NI) 1)))));
	j_431604 = (NI)(xl_431602 - ((NI) 1));
	{
		while (1) {
			if (!(((NI) (i)) <= j_431604)) goto LA2;
			asgnRefNoCycle((void**) (&(*x)->data[(NI)(j_431604 + ((NI) 1))]), (*x)->data[j_431604]);
			j_431604 -= ((NI) 1);
		} LA2: ;
	}
	asgnRefNoCycle((void**) (&(*x)->data[i]), item);
}

N_NIMCALL(Tnodeseq216784*, HEX5BHEX5D_389135)(Tnodeseq216784* s, Slice89480 x) {
	Tnodeseq216784* result;
	NI a;
	NI L;
	result = 0;
	a = x.a;
	L = (NI)((NI)(x.b - a) + ((NI) 1));
	result = (Tnodeseq216784*) newSeq((&NTI216784), ((NI) (L)));
	{
		NI i_389175;
		NI HEX3Atmp_389177;
		NI res_389180;
		i_389175 = 0;
		HEX3Atmp_389177 = 0;
		HEX3Atmp_389177 = (L - 1);
		res_389180 = ((NI) 0);
		{
			while (1) {
				if (!(res_389180 <= HEX3Atmp_389177)) goto LA3;
				i_389175 = res_389180;
				asgnRefNoCycle((void**) (&result->data[i_389175]), s->data[(NI)(i_389175 + a)]);
				res_389180 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(void, HEX5BHEX5DHEX3D_389186)(Tnodeseq216784** s, Slice89480 x, Tnode216790** b, NI bLen0) {
	NI a;
	NI L;
	a = x.a;
	L = (NI)((NI)(x.b - a) + ((NI) 1));
	{
		if (!(L == bLen0)) goto LA3;
		{
			NI i_389237;
			NI HEX3Atmp_389334;
			NI res_389337;
			i_389237 = 0;
			HEX3Atmp_389334 = 0;
			HEX3Atmp_389334 = (L - 1);
			res_389337 = ((NI) 0);
			{
				while (1) {
					if (!(res_389337 <= HEX3Atmp_389334)) goto LA7;
					i_389237 = res_389337;
					asgnRefNoCycle((void**) (&(*s)->data[(NI)(i_389237 + a)]), b[i_389237]);
					res_389337 += ((NI) 1);
				} LA7: ;
			}
		}
	}
	goto LA1;
	LA3: ;
	{
		NI slen_389200;
		NI shift_389202;
		NI newlen_389204;
		slen_389200 = ((*s) ? (*s)->Sup.len : 0);
		shift_389202 = (NI)(bLen0 - L);
		newlen_389204 = (NI)(slen_389200 + shift_389202);
		{
			if (!(((NI) 0) < shift_389202)) goto LA11;
			(*s) = (Tnodeseq216784*) setLengthSeq(&((*s))->Sup, sizeof(Tnode216790*), ((NI) (newlen_389204)));
			{
				NI i_389206;
				NI HEX3Atmp_389342;
				NI HEX3Atmp_389343;
				NI res_389346;
				i_389206 = 0;
				HEX3Atmp_389342 = 0;
				HEX3Atmp_389343 = 0;
				HEX3Atmp_389342 = (NI)(newlen_389204 - ((NI) 1));
				HEX3Atmp_389343 = (NI)((NI)(a + shift_389202) + ((NI) 1));
				res_389346 = HEX3Atmp_389342;
				{
					while (1) {
						if (!(HEX3Atmp_389343 <= res_389346)) goto LA15;
						i_389206 = res_389346;
						asgnRefNoCycle((void**) (&(*s)->data[i_389206]), (*s)->data[(NI)(i_389206 - shift_389202)]);
						res_389346 -= ((NI) 1);
					} LA15: ;
				}
			}
		}
		goto LA9;
		LA11: ;
		{
			{
				NI i_389208;
				NI HEX3Atmp_389351;
				NI HEX3Atmp_389352;
				NI res_389355;
				i_389208 = 0;
				HEX3Atmp_389351 = 0;
				HEX3Atmp_389352 = 0;
				HEX3Atmp_389351 = (NI)(a + bLen0);
				HEX3Atmp_389352 = (NI)((NI)(((*s) ? (*s)->Sup.len : 0) - ((NI) 1)) + shift_389202);
				res_389355 = HEX3Atmp_389351;
				{
					while (1) {
						if (!(res_389355 <= HEX3Atmp_389352)) goto LA19;
						i_389208 = res_389355;
						asgnRefNoCycle((void**) (&(*s)->data[i_389208]), (*s)->data[(NI)(i_389208 - shift_389202)]);
						res_389355 += ((NI) 1);
					} LA19: ;
				}
			}
			(*s) = (Tnodeseq216784*) setLengthSeq(&((*s))->Sup, sizeof(Tnode216790*), ((NI) (newlen_389204)));
		}
		LA9: ;
		{
			NI i_389210;
			NI HEX3Atmp_389360;
			NI res_389363;
			i_389210 = 0;
			HEX3Atmp_389360 = 0;
			HEX3Atmp_389360 = (bLen0 - 1);
			res_389363 = ((NI) 0);
			{
				while (1) {
					if (!(res_389363 <= HEX3Atmp_389360)) goto LA22;
					i_389210 = res_389363;
					asgnRefNoCycle((void**) (&(*s)->data[(NI)(i_389210 + a)]), b[i_389210]);
					res_389363 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	LA1: ;
}

static N_INLINE(void*, seqtoptr_430822)(Tsymseq216792* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_430811)(Tsymseq216792* x, Tsymseq216792* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_430822(x);
		LOC4 = 0;
		LOC4 = seqtoptr_430822(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_430822(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_430822(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_430887;
			NI HEX3Atmp_430900;
			NI res_430903;
			i_430887 = 0;
			HEX3Atmp_430900 = 0;
			HEX3Atmp_430900 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_430903 = ((NI) 0);
			{
				while (1) {
					if (!(res_430903 <= HEX3Atmp_430900)) goto LA19;
					i_430887 = res_430903;
					{
						if (!!((x->data[i_430887] == y->data[i_430887]))) goto LA22;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA22: ;
					res_430903 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, safeadd_430908)(Tsymseq216792** x, Tsym216822* y) {
	{
		NIM_BOOL LOC3;
		TY266332 LOC6;
		LOC3 = 0;
		LOC3 = HEX3DHEX3D_430811((*x), NIM_NIL);
		if (!LOC3) goto LA4;
		unsureAsgnRef((void**) (&(*x)), (Tsymseq216792*) newSeq((&NTI216792), 1));
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = y;
		asgnRefNoCycle((void**) (&(*x)->data[0]), LOC6[0]);
	}
	goto LA1;
	LA4: ;
	{
		(*x) = (Tsymseq216792*) incrSeqV2(&((*x))->Sup, sizeof(Tsym216822*));
		asgnRefNoCycle((void**) (&(*x)->data[(*x)->Sup.len]), y);
		++(*x)->Sup.len;
	}
	LA1: ;
}

N_NIMCALL(void, delete_431831)(Tnodeseq216784** x, NI i) {
	NI xl_432202;
	xl_432202 = ((*x) ? (*x)->Sup.len : 0);
	{
		NI j_432204;
		NI HEX3Atmp_432410;
		NI res_432413;
		j_432204 = 0;
		HEX3Atmp_432410 = 0;
		HEX3Atmp_432410 = (NI)(xl_432202 - ((NI) 2));
		res_432413 = ((NI) (i));
		{
			while (1) {
				if (!(res_432413 <= HEX3Atmp_432410)) goto LA3;
				j_432204 = res_432413;
				asgnRefNoCycle((void**) (&(*x)->data[j_432204]), (*x)->data[(NI)(j_432204 + ((NI) 1))]);
				res_432413 += ((NI) 1);
			} LA3: ;
		}
	}
	(*x) = (Tnodeseq216784*) setLengthSeq(&((*x))->Sup, sizeof(Tnode216790*), ((NI) ((NI)(xl_432202 - ((NI) 1)))));
}

N_NIMCALL(Tnodeseq216784*, newseq_467233)(NI len) {
	Tnodeseq216784* result;
	result = 0;
	result = (Tnodeseq216784*) newSeq((&NTI216784), len);
	return result;
}

N_NIMCALL(void, Gcfullcollect_9805)(void) {
	NI oldthreshold;
	oldthreshold = gch_49659.cyclethreshold;
	gch_49659.cyclethreshold = ((NI) 0);
	collectct_51607((&gch_49659));
	gch_49659.cyclethreshold = oldthreshold;
}

static N_INLINE(void*, seqtoptr_309494)(TY308653* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_309483)(TY308653* x, TY308653* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_309494(x);
		LOC4 = 0;
		LOC4 = seqtoptr_309494(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_309494(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_309494(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_309559;
			NI HEX3Atmp_309561;
			NI res_309564;
			i_309559 = 0;
			HEX3Atmp_309561 = 0;
			HEX3Atmp_309561 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_309564 = ((NI) 0);
			{
				while (1) {
					if (!(res_309564 <= HEX3Atmp_309561)) goto LA19;
					i_309559 = res_309564;
					{
						NIM_BOOL LOC22;
						LOC22 = 0;
						LOC22 = HEX3DHEX3D_309431(x->data[i_309559], y->data[i_309559]);
						if (!!(LOC22)) goto LA23;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA23: ;
					res_309564 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

static N_INLINE(void*, seqtoptr_309582)(TY308648* x) {
	void* result;
	result = 0;
	result = ((void*) (x));
	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, HEX3DHEX3D_309649)(TY309043 x, TY309043 y) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(eqStrings(x.Field0, y.Field0))) goto LA3;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = HEX3DHEX3D_309431(x.Field1, y.Field1);
		if (!!(LOC7)) goto LA8;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA8: ;
	result = NIM_TRUE;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_309571)(TY308648* x, TY308648* y) {
	NIM_BOOL result;
{	result = 0;
	{
		void* LOC3;
		void* LOC4;
		LOC3 = 0;
		LOC3 = seqtoptr_309582(x);
		LOC4 = 0;
		LOC4 = seqtoptr_309582(y);
		if (!(LOC3 == LOC4)) goto LA5;
		result = NIM_TRUE;
	}
	goto LA1;
	LA5: ;
	{
		NIM_BOOL LOC8;
		void* LOC9;
		void* LOC11;
		LOC8 = 0;
		LOC9 = 0;
		LOC9 = seqtoptr_309582(x);
		LOC8 = (LOC9 == NIM_NIL);
		if (LOC8) goto LA10;
		LOC11 = 0;
		LOC11 = seqtoptr_309582(y);
		LOC8 = (LOC11 == NIM_NIL);
		LA10: ;
		if (!LOC8) goto LA12;
		result = NIM_FALSE;
	}
	goto LA1;
	LA12: ;
	{
		if (!((x ? x->Sup.len : 0) == (y ? y->Sup.len : 0))) goto LA15;
		{
			NI i_309647;
			NI HEX3Atmp_309667;
			NI res_309670;
			i_309647 = 0;
			HEX3Atmp_309667 = 0;
			HEX3Atmp_309667 = (NI)((x ? x->Sup.len : 0) - ((NI) 1));
			res_309670 = ((NI) 0);
			{
				while (1) {
					if (!(res_309670 <= HEX3Atmp_309667)) goto LA19;
					i_309647 = res_309670;
					{
						NIM_BOOL LOC22;
						LOC22 = 0;
						LOC22 = HEX3DHEX3D_309649(x->data[i_309647], y->data[i_309647]);
						if (!!(LOC22)) goto LA23;
						result = NIM_FALSE;
						goto BeforeRet;
					}
					LA23: ;
					res_309670 += ((NI) 1);
				} LA19: ;
			}
		}
		result = NIM_TRUE;
	}
	goto LA1;
	LA15: ;
	LA1: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NIM_BOOL, HEX3DHEX3D_331275)(Indexentry329126 x, Indexentry329126 y) {
	NIM_BOOL result;
{	result = 0;
	{
		if (!!(eqStrings(x.keyword, y.keyword))) goto LA3;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!(eqStrings(x.link, y.link))) goto LA7;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA7: ;
	{
		if (!!(eqStrings(x.linktitle, y.linktitle))) goto LA11;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA11: ;
	{
		if (!!(eqStrings(x.linkdesc, y.linkdesc))) goto LA15;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA15: ;
	result = NIM_TRUE;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}
N_NIMCALL(void, TMP5289)(void* p, NI op) {
	TY527219* a;
	NI LOC1;
	a = (TY527219*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	}
}

static N_INLINE(void, Gcdisable_9801)(void) {
	gch_49659.recgclock += ((NI) 1);
}

static N_INLINE(void, Gcenable_9803)(void) {
	{
		if (!(((NI) 0) < gch_49659.recgclock)) goto LA3;
		gch_49659.recgclock -= ((NI) 1);
	}
	LA3: ;
}

N_NIMCALL(NimStringDesc*, Gcgetstatistics_9821)(void) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NI LOC2;
	NimStringDesc* LOC3;
	NI LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	NimStringDesc* LOC8;
	NimStringDesc* LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* LOC11;
	NimStringDesc* LOC12;
	NimStringDesc* LOC13;
	NimStringDesc* LOC14;
	result = 0;
	Gcdisable_9801();
	LOC1 = 0;
	LOC2 = 0;
	LOC2 = gettotalmem_8059();
	LOC3 = 0;
	LOC3 = nimIntToStr(LOC2);
	LOC4 = 0;
	LOC4 = getoccupiedmem_8055();
	LOC5 = 0;
	LOC5 = nimIntToStr(LOC4);
	LOC6 = 0;
	LOC6 = nimIntToStr(gch_49659.stat.stackscans);
	LOC7 = 0;
	LOC7 = nimIntToStr(gch_49659.stat.maxstackcells);
	LOC8 = 0;
	LOC8 = nimIntToStr(gch_49659.stat.cyclecollections);
	LOC9 = 0;
	LOC9 = nimIntToStr(gch_49659.stat.maxthreshold);
	LOC10 = 0;
	LOC10 = nimIntToStr(gch_49659.zct.cap);
	LOC11 = 0;
	LOC11 = nimIntToStr(gch_49659.stat.cycletablesize);
	LOC12 = 0;
	LOC12 = nimInt64ToStr((NI64)(gch_49659.stat.maxpause / IL64(1000000)));
	LOC1 = rawNewString(LOC3->Sup.len + LOC5->Sup.len + LOC6->Sup.len + LOC7->Sup.len + LOC8->Sup.len + LOC9->Sup.len + LOC10->Sup.len + LOC11->Sup.len + LOC12->Sup.len + 209);
appendString(LOC1, ((NimStringDesc*) &TMP5301));
appendString(LOC1, LOC3);
appendString(LOC1, ((NimStringDesc*) &TMP5302));
appendString(LOC1, LOC5);
appendString(LOC1, ((NimStringDesc*) &TMP5303));
appendString(LOC1, LOC6);
appendString(LOC1, ((NimStringDesc*) &TMP5304));
appendString(LOC1, LOC7);
appendString(LOC1, ((NimStringDesc*) &TMP5305));
appendString(LOC1, LOC8);
appendString(LOC1, ((NimStringDesc*) &TMP5306));
appendString(LOC1, LOC9);
appendString(LOC1, ((NimStringDesc*) &TMP5307));
appendString(LOC1, LOC10);
appendString(LOC1, ((NimStringDesc*) &TMP5308));
appendString(LOC1, LOC11);
appendString(LOC1, ((NimStringDesc*) &TMP5309));
appendString(LOC1, LOC12);
	result = LOC1;
	LOC13 = 0;
	LOC14 = 0;
	LOC14 = nimIntToStr(gch_49659.stat.maxstacksize);
	LOC13 = rawNewString(result->Sup.len + LOC14->Sup.len + 23);
appendString(LOC13, result);
appendString(LOC13, ((NimStringDesc*) &TMP5310));
appendString(LOC13, LOC14);
appendString(LOC13, ((NimStringDesc*) &TMP142));
	result = LOC13;
	Gcenable_9803();
	return result;
}
NIM_EXTERNC N_NOINLINE(void, systemInit000)(void) {
	TNimType LOC1;
	NI LOC2;
	NI LOC3;
	nimvm_5751 = NIM_FALSE;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	LOC1.size = ((NI) 4);
	LOC1.kind = ((NU8) 28);
	LOC1.flags = 2;
	strdesc_12203 = LOC1;
	LOC2 = 0;
	LOC2 = fileno(stdin);
	setmode(LOC2, O_BINARY);
	LOC3 = 0;
	LOC3 = fileno(stdout);
	setmode(LOC3, O_BINARY);
	initallocator_11601();
	initStackBottom();
	initgc_11401();
	registersignalhandler_23002();
}

NIM_EXTERNC N_NOINLINE(void, systemDatInit000)(void) {
static TNimNode* TMP51[4];
static TNimNode TMP0[19];
NTI3608.size = sizeof(TNimObject);
NTI3608.kind = 17;
NTI3608.base = 0;
NTI3608.flags = 1;
TMP0[0].len = 0; TMP0[0].kind = 2;
NTI3608.node = &TMP0[0];
NTI104.size = sizeof(NI);
NTI104.kind = 31;
NTI104.base = 0;
NTI104.flags = 3;
NTI138.size = sizeof(NimStringDesc*);
NTI138.kind = 28;
NTI138.base = 0;
NTI138.flags = 2;
NTI3624.size = sizeof(Exception);
NTI3624.kind = 17;
NTI3624.base = (&NTI3608);
TMP51[0] = &TMP0[2];
NTI10010.size = sizeof(Exception*);
NTI10010.kind = 22;
NTI10010.base = (&NTI3624);
NTI10010.marker = TMP52;
TMP0[2].kind = 1;
TMP0[2].offset = offsetof(Exception, parent);
TMP0[2].typ = (&NTI10010);
TMP0[2].name = "parent";
TMP51[1] = &TMP0[3];
NTI140.size = sizeof(NCSTRING);
NTI140.kind = 29;
NTI140.base = 0;
NTI140.flags = 3;
TMP0[3].kind = 1;
TMP0[3].offset = offsetof(Exception, name);
TMP0[3].typ = (&NTI140);
TMP0[3].name = "name";
TMP51[2] = &TMP0[4];
TMP0[4].kind = 1;
TMP0[4].offset = offsetof(Exception, message);
TMP0[4].typ = (&NTI138);
TMP0[4].name = "msg";
TMP51[3] = &TMP0[5];
TMP0[5].kind = 1;
TMP0[5].offset = offsetof(Exception, trace);
TMP0[5].typ = (&NTI138);
TMP0[5].name = "trace";
TMP0[1].len = 4; TMP0[1].kind = 2; TMP0[1].sons = &TMP51[0];
NTI3624.node = &TMP0[1];
NTI3636.size = sizeof(Arithmeticerror3636);
NTI3636.kind = 17;
NTI3636.base = (&NTI3624);
TMP0[6].len = 0; TMP0[6].kind = 2;
NTI3636.node = &TMP0[6];
NTI3640.size = sizeof(Overflowerror3640);
NTI3640.kind = 17;
NTI3640.base = (&NTI3636);
TMP0[7].len = 0; TMP0[7].kind = 2;
NTI3640.node = &TMP0[7];
NTI23869.size = sizeof(Overflowerror3640*);
NTI23869.kind = 22;
NTI23869.base = (&NTI3640);
NTI23869.marker = TMP53;
NTI3626.size = sizeof(Systemerror3626);
NTI3626.kind = 17;
NTI3626.base = (&NTI3624);
TMP0[8].len = 0; TMP0[8].kind = 2;
NTI3626.node = &TMP0[8];
NTI3650.size = sizeof(Outofmemerror3650);
NTI3650.kind = 17;
NTI3650.base = (&NTI3626);
TMP0[9].len = 0; TMP0[9].kind = 2;
NTI3650.node = &TMP0[9];
NTI110.size = sizeof(NI32);
NTI110.kind = 34;
NTI110.base = 0;
NTI110.flags = 3;
NTI3646.size = sizeof(Valueerror3646);
NTI3646.kind = 17;
NTI3646.base = (&NTI3624);
TMP0[10].len = 0; TMP0[10].kind = 2;
NTI3646.node = &TMP0[10];
NTI23625.size = sizeof(Valueerror3646*);
NTI23625.kind = 22;
NTI23625.base = (&NTI3646);
NTI23625.marker = TMP151;
NTI108.size = sizeof(NI16);
NTI108.kind = 33;
NTI108.base = 0;
NTI108.flags = 3;
NTI3628.size = sizeof(Ioerror3628);
NTI3628.kind = 17;
NTI3628.base = (&NTI3626);
TMP0[11].len = 0; TMP0[11].kind = 2;
NTI3628.node = &TMP0[11];
NTI81017.size = sizeof(Ioerror3628*);
NTI81017.kind = 22;
NTI81017.base = (&NTI3628);
NTI81017.marker = TMP441;
NTI82407.size = sizeof(TY82407);
NTI82407.kind = 16;
NTI82407.base = (&NTI108);
NTI82407.flags = 3;
NTI82404.size = sizeof(NI16*);
NTI82404.kind = 22;
NTI82404.base = (&NTI82407);
NTI82404.flags = 2;
NTI82404.marker = TMP503;
NTI130.size = sizeof(NIM_BOOL);
NTI130.kind = 1;
NTI130.base = 0;
NTI130.flags = 3;
NTI7088.size = sizeof(NI64);
NTI7088.kind = 35;
NTI7088.base = 0;
NTI7088.flags = 3;
NTI7090.size = sizeof(NF);
NTI7090.kind = 36;
NTI7090.base = 0;
NTI7090.flags = 3;
NTI142.size = sizeof(void*);
NTI142.kind = 26;
NTI142.base = 0;
NTI142.flags = 3;
NTI116.size = sizeof(NU8);
NTI116.kind = 41;
NTI116.base = 0;
NTI116.flags = 3;
NTI3610.size = sizeof(TNimObject*);
NTI3610.kind = 22;
NTI3610.base = (&NTI3608);
NTI3610.marker = TMP927;
NTI3660.size = sizeof(Reraiseerror3660);
NTI3660.kind = 17;
NTI3660.base = (&NTI3624);
TMP0[12].len = 0; TMP0[12].kind = 2;
NTI3660.node = &TMP0[12];
NTI21224.size = sizeof(Reraiseerror3660*);
NTI21224.kind = 22;
NTI21224.base = (&NTI3660);
NTI21224.marker = TMP1065;
NTI29418.size = sizeof(TY29418);
NTI29418.kind = 16;
NTI29418.base = (&NTI104);
NTI29418.flags = 3;
NTI3604.size = sizeof(NI);
NTI3604.kind = 20;
NTI3604.base = (&NTI104);
NTI3604.flags = 3;
NTI3630.size = sizeof(Oserror3630);
NTI3630.kind = 17;
NTI3630.base = (&NTI3626);
TMP0[13].kind = 1;
TMP0[13].offset = offsetof(Oserror3630, errorcode);
TMP0[13].typ = (&NTI110);
TMP0[13].name = "errorCode";
NTI3630.node = &TMP0[13];
NTI120028.size = sizeof(Oserror3630*);
NTI120028.kind = 22;
NTI120028.base = (&NTI3630);
NTI120028.marker = TMP1206;
NTI124.size = sizeof(NF);
NTI124.kind = 36;
NTI124.base = 0;
NTI124.flags = 3;
NTI15002.size = sizeof(void*);
NTI15002.kind = 18;
NTI15002.base = 0;
NTI15002.flags = 3;
TMP0[14].len = 0; TMP0[14].kind = 2;
NTI15002.node = &TMP0[14];
NTI15004.size = sizeof(FILE*);
NTI15004.kind = 21;
NTI15004.base = (&NTI15002);
NTI15004.flags = 3;
NTI106.size = sizeof(NI8);
NTI106.kind = 32;
NTI106.base = 0;
NTI106.flags = 3;
NTI3648.size = sizeof(Keyerror3648);
NTI3648.kind = 17;
NTI3648.base = (&NTI3646);
TMP0[15].len = 0; TMP0[15].kind = 2;
NTI3648.node = &TMP0[15];
NTI184804.size = sizeof(Keyerror3648*);
NTI184804.kind = 22;
NTI184804.base = (&NTI3648);
NTI184804.marker = TMP1243;
NTI3656.size = sizeof(Rangeerror3656);
NTI3656.kind = 17;
NTI3656.base = (&NTI3624);
TMP0[16].len = 0; TMP0[16].kind = 2;
NTI3656.node = &TMP0[16];
NTI120.size = sizeof(NU32);
NTI120.kind = 43;
NTI120.base = 0;
NTI120.flags = 3;
NTI3644.size = sizeof(Assertionerror3644);
NTI3644.kind = 17;
NTI3644.base = (&NTI3624);
TMP0[17].len = 0; TMP0[17].kind = 2;
NTI3644.node = &TMP0[17];
NTI89905.size = sizeof(Assertionerror3644*);
NTI89905.kind = 22;
NTI89905.base = (&NTI3644);
NTI89905.marker = TMP2317;
NTI136.size = sizeof(NIM_CHAR);
NTI136.kind = 2;
NTI136.base = 0;
NTI136.flags = 3;
NTI15008.size = sizeof(int);
NTI15008.kind = 34;
NTI15008.base = 0;
NTI15008.flags = 3;
NTI7208.size = sizeof(int);
NTI7208.kind = 34;
NTI7208.base = 0;
NTI7208.flags = 3;
NTI3638.size = sizeof(Divbyzeroerror3638);
NTI3638.kind = 17;
NTI3638.base = (&NTI3636);
TMP0[18].len = 0; TMP0[18].kind = 2;
NTI3638.node = &TMP0[18];
NTI527219.size = sizeof(TY527219*);
NTI527219.kind = 24;
NTI527219.base = (&NTI104);
NTI527219.flags = 2;
NTI527219.marker = TMP5289;
}

