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

#include <string.h>

#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tsym190843 Tsym190843;
typedef struct Tdocumentor340007 Tdocumentor340007;
typedef struct Tnode190813 Tnode190813;
typedef struct Ttype190849 Ttype190849;
typedef struct Tlineinfo163338 Tlineinfo163338;
typedef struct Tident167021 Tident167021;
typedef struct Tnodeseq190807 Tnodeseq190807;
typedef struct Tidobj167015 Tidobj167015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Ttypeseq190845 Ttypeseq190845;
typedef struct Tscope190837 Tscope190837;
typedef struct TY190944 TY190944;
typedef struct Tstrtable190817 Tstrtable190817;
typedef struct Tsymseq190815 Tsymseq190815;
typedef struct Tloc190827 Tloc190827;
typedef struct Ropeobj161009 Ropeobj161009;
typedef struct Tlib190831 Tlib190831;
typedef struct Trstgenerator311016 Trstgenerator311016;
typedef struct Trstnode296011 Trstnode296011;
typedef struct Stringtableobj134012 Stringtableobj134012;
typedef struct TY311034 TY311034;
typedef struct Table311052 Table311052;
typedef struct Keyvaluepairseq311055 Keyvaluepairseq311055;
typedef struct Tcell46347 Tcell46347;
typedef struct Tcellseq46363 Tcellseq46363;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46359 Tcellset46359;
typedef struct Tpagedesc46355 Tpagedesc46355;
typedef struct Tmemregion28210 Tmemregion28210;
typedef struct Tsmallchunk27440 Tsmallchunk27440;
typedef struct Tllchunk28204 Tllchunk28204;
typedef struct Tbigchunk27442 Tbigchunk27442;
typedef struct Tintset27417 Tintset27417;
typedef struct Ttrunk27413 Ttrunk27413;
typedef struct Tavlnode28208 Tavlnode28208;
typedef struct Tgcstat48214 Tgcstat48214;
typedef struct Tsrcgen212023 Tsrcgen212023;
typedef struct Trendertokseq212021 Trendertokseq212021;
typedef struct TY119589 TY119589;
typedef struct Jsonnodeobj289726 Jsonnodeobj289726;
typedef struct TY290209 TY290209;
typedef struct Tinstantiation190833 Tinstantiation190833;
typedef struct Tlistentry130022 Tlistentry130022;
typedef struct Trstnodeseq296009 Trstnodeseq296009;
typedef struct Keyvaluepairseq134010 Keyvaluepairseq134010;
typedef struct Ttocentry311012 Ttocentry311012;
typedef struct Keyvaluepair311058 Keyvaluepair311058;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Trendertok212019 Trendertok212019;
typedef struct TY289741 TY289741;
typedef struct TY289746 TY289746;
typedef struct TY190933 TY190933;
typedef struct Keyvaluepair134008 Keyvaluepair134008;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tlineinfo163338  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode190813  {
Ttype190849* typ;
Tlineinfo163338 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym190843* sym;
} S4;
struct {Tident167021* ident;
} S5;
struct {Tnodeseq190807* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj167015  {
  TNimObject Sup;
NI id;
};
struct  Tstrtable190817  {
NI counter;
Tsymseq190815* data;
};
struct  Tloc190827  {
NU8 k;
NU8 s;
NU16 flags;
Ttype190849* t;
Ropeobj161009* r;
Ropeobj161009* heaproot;
};
struct  Tsym190843  {
  Tidobj167015 Sup;
NU8 kind;
union{
struct {Ttypeseq190845* typeinstcache;
Tscope190837* typscope;
} S1;
struct {TY190944* procinstcache;
Tsym190843* gcunsafetyreason;
} S2;
struct {TY190944* usedgenerics;
Tstrtable190817 tab;
} S3;
struct {Tsym190843* guard;
} S4;
} kindU;
NU16 magic;
Ttype190849* typ;
Tident167021* name;
Tlineinfo163338 info;
Tsym190843* owner;
NU32 flags;
Tnode190813* ast;
NU32 options;
NI position;
NI offset;
Tloc190827 loc;
Tlib190831* annex;
Tnode190813* constraint;
};
typedef N_NIMCALL_PTR(NimStringDesc*, Tfindfilehandler297023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, Tmsghandler297021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
typedef NimStringDesc* TY311042[5];
struct  Table311052  {
Keyvaluepairseq311055* data;
NI counter;
};
struct  Trstgenerator311016  {
  TNimObject Sup;
NU8 target;
Stringtableobj134012* config;
NI splitafter;
TY311034* tocpart;
NIM_BOOL hastoc;
NimStringDesc* theindex;
NU8 options;
Tfindfilehandler297023 findfile;
Tmsghandler297021 msghandler;
NimStringDesc* filename;
TY311042 meta;
NimStringDesc* currentsection;
Table311052 seenindexterms;
};
typedef Ropeobj161009* Tsections340005[26];
struct  Tdocumentor340007  {
  Trstgenerator311016 Sup;
Ropeobj161009* moddesc;
NI id;
Tsections340005 toc;
Tsections340005 section;
NimStringDesc* indexvalfilename;
NimStringDesc* analytics;
Stringtableobj134012* seensymbols;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NimStringDesc* TY164566[1];
struct  Tcell46347  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46363  {
NI len;
NI cap;
Tcell46347** d;
};
struct  Tcellset46359  {
NI counter;
NI max;
Tpagedesc46355* head;
Tpagedesc46355** data;
};
typedef Tsmallchunk27440* TY28222[512];
typedef Ttrunk27413* Ttrunkbuckets27415[256];
struct  Tintset27417  {
Ttrunkbuckets27415 data;
};
struct  Tmemregion28210  {
NI minlargeobj;
NI maxlargeobj;
TY28222 freesmallchunks;
Tllchunk28204* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27442* freechunkslist;
Tintset27417 chunkstarts;
Tavlnode28208* root;
Tavlnode28208* deleted;
Tavlnode28208* last;
Tavlnode28208* freeavlnodes;
};
struct  Tgcstat48214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48216  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46363 zct;
Tcellseq46363 decstack;
Tcellset46359 cycleroots;
Tcellseq46363 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  Tident167021  {
  Tidobj167015 Sup;
NimStringDesc* s;
Tident167021* next;
NI h;
};
struct  Tsrcgen212023  {
NI indent;
NI linelen;
NI pos;
NI idx;
Trendertokseq212021* tokens;
NimStringDesc* buf;
NI pendingnl;
Tnodeseq190807* comstack;
NU8 flags;
NIM_BOOL checkanon;
NI inpragma;
};
typedef Ropeobj161009* TY161572[1];
typedef NimStringDesc* TY154965[2];
typedef Ropeobj161009* TY490436[2];
typedef NimStringDesc* TY176061[3];
typedef Ropeobj161009* TY462569[3];
typedef NimStringDesc* TY341106[10];
typedef Ropeobj161009* TY341108[10];
typedef NimStringDesc* TY341111[9];
typedef Ropeobj161009* TY341113[9];
typedef NU8 TY178407[32];
typedef NimStringDesc* TY342923[13];
typedef NimStringDesc* TY164825[4];
typedef Ropeobj161009* TY462566[4];
typedef NimStringDesc* TY403890[6];
typedef Ropeobj161009* TY464247[6];
struct TY119589 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct TY290209 {
NimStringDesc* Field0;
Jsonnodeobj289726* Field1;
};
typedef TY290209 TY342153[1];
typedef TY290209 TY341153[2];
struct  Ttype190849  {
  Tidobj167015 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq190845* sons;
Tnode190813* n;
Tsym190843* owner;
Tsym190843* sym;
Tsym190843* destructor;
Tsym190843* deepcopy;
Tsym190843* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc190827 loc;
};
struct  Tscope190837  {
NI depthlevel;
Tstrtable190817 symbols;
Tnodeseq190807* usingsyms;
Tscope190837* parent;
};
struct  Ropeobj161009  {
  TNimObject Sup;
Ropeobj161009* left;
Ropeobj161009* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry130022  {
  TNimObject Sup;
Tlistentry130022* prev;
Tlistentry130022* next;
};
struct  Tlib190831  {
  Tlistentry130022 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj161009* name;
Tnode190813* path;
};
struct  Trstnode296011  {
NU8 kind;
NimStringDesc* text;
NI level;
Trstnodeseq296009* sons;
};
struct  Stringtableobj134012  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq134010* data;
NU8 mode;
};
struct  Ttocentry311012  {
Trstnode296011* n;
NimStringDesc* refname;
NimStringDesc* header;
};
struct Keyvaluepair311058 {
NI Field0;
NimStringDesc* Field1;
NI Field2;
};
typedef NI TY27420[16];
struct  Tpagedesc46355  {
Tpagedesc46355* next;
NI key;
TY27420 bits;
};
struct  Tbasechunk27438  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27440  {
  Tbasechunk27438 Sup;
Tsmallchunk27440* next;
Tsmallchunk27440* prev;
Tfreecell27430* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28204  {
NI size;
NI acc;
Tllchunk28204* next;
};
struct  Tbigchunk27442  {
  Tbasechunk27438 Sup;
Tbigchunk27442* next;
Tbigchunk27442* prev;
NI align;
NF data;
};
struct  Ttrunk27413  {
Ttrunk27413* next;
NI key;
TY27420 bits;
};
typedef Tavlnode28208* TY28214[2];
struct  Tavlnode28208  {
TY28214 link;
NI key;
NI upperbound;
NI level;
};
struct  Trendertok212019  {
NU8 kind;
NI16 length;
};
struct  Jsonnodeobj289726  {
NU8 kind;
union{
struct {NimStringDesc* str;
} S1;
struct {NI64 num;
} S2;
struct {NF fnum;
} S3;
struct {NIM_BOOL bval;
} S4;
struct {TY289741* fields;
} S6;
struct {TY289746* elems;
} S7;
} kindU;
};
struct  Tinstantiation190833  {
Tsym190843* sym;
Ttypeseq190845* concretetypes;
TY190933* usedby;
};
struct Keyvaluepair134008 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct Tnodeseq190807 {
  TGenericSeq Sup;
  Tnode190813* data[SEQ_DECL_SIZE];
};
struct Ttypeseq190845 {
  TGenericSeq Sup;
  Ttype190849* data[SEQ_DECL_SIZE];
};
struct TY190944 {
  TGenericSeq Sup;
  Tinstantiation190833* data[SEQ_DECL_SIZE];
};
struct Tsymseq190815 {
  TGenericSeq Sup;
  Tsym190843* data[SEQ_DECL_SIZE];
};
struct TY311034 {
  TGenericSeq Sup;
  Ttocentry311012 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq311055 {
  TGenericSeq Sup;
  Keyvaluepair311058 data[SEQ_DECL_SIZE];
};
struct Trendertokseq212021 {
  TGenericSeq Sup;
  Trendertok212019 data[SEQ_DECL_SIZE];
};
struct Trstnodeseq296009 {
  TGenericSeq Sup;
  Trstnode296011* data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq134010 {
  TGenericSeq Sup;
  Keyvaluepair134008 data[SEQ_DECL_SIZE];
};
struct TY289741 {
  TGenericSeq Sup;
  TY290209 data[SEQ_DECL_SIZE];
};
struct TY289746 {
  TGenericSeq Sup;
  Jsonnodeobj289726* data[SEQ_DECL_SIZE];
};
struct TY190933 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(Tnode190813*, finddoccomment_340542)(Tnode190813* n);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
static N_INLINE(NI, safelen_191125)(Tnode190813* n);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, renderrsttoout_311724)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(Trstnode296011*, parserst_340049)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions);
N_NIMCALL(Trstnode296011*, rstparse_304320)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 options, Tfindfilehandler297023 findfile, Tmsghandler297021 msghandler);
N_NIMCALL(NimStringDesc*, docgenfindfile_340039)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, findfile_155339)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, HEX2F_119292)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(void, compilermsghandler_340023)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
N_NIMCALL(void, globalerror_165134)(Tlineinfo163338 info, NU16 msg, NimStringDesc* arg);
static N_INLINE(Tlineinfo163338, newlineinfo_163879)(NimStringDesc* filename, NI line, NI col);
N_NIMCALL(Tlineinfo163338, newlineinfo_163867)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(NI32, fileinfoidx_163854)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_164266)(NI32 fileidx);
static N_INLINE(NI, tolinenumber_164439)(Tlineinfo163338 info);
static N_INLINE(NI, tocolumn_164449)(Tlineinfo163338 info);
N_NIMCALL(NimStringDesc*, nsuStrip)(NimStringDesc* s, NIM_BOOL leading, NIM_BOOL trailing);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(Tnode190813*, parsefile_218041)(NI32 fileidx);
N_NIMCALL(Tdocumentor340007*, newdocumentor_340065)(NimStringDesc* filename, Stringtableobj134012* config);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP4765)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initrstgenerator_311088)(Trstgenerator311016* g, NU8 target, Stringtableobj134012* config, NimStringDesc* filename, NU8 options, Tfindfilehandler297023 findfile, Tmsghandler297021 msghandler);
N_NIMCALL(NIM_BOOL, nsthasKey)(Stringtableobj134012* t, NimStringDesc* key);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, nstGet)(Stringtableobj134012* t, NimStringDesc* key);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
static N_INLINE(Tcell46347*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46347* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46363* s, Tcell46347* c);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(Stringtableobj134012*, nstnewStringTable)(NU8 mode);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_52222)(Tcell46347* c);
static N_INLINE(NIM_BOOL, canbecycleroot_49867)(Tcell46347* c);
static N_INLINE(void, rtladdcycleroot_50623)(Tcell46347* c);
N_NOINLINE(void, incl_47065)(Tcellset46359* s, Tcell46347* cell);
static N_INLINE(void, decref_51804)(Tcell46347* c);
N_NIMCALL(void, generatedoc_341218)(Tdocumentor340007* d, Tnode190813* n);
N_NIMCALL(void, add_161545)(Ropeobj161009** a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, gencomment_340354)(Tdocumentor340007* d, Tnode190813* n);
N_NIMCALL(void, documentraises_326822)(Tnode190813* n);
N_NIMCALL(void, genitem_341012)(Tdocumentor340007* d, Tnode190813* n, Tnode190813* namenode, NU8 k);
N_NIMCALL(NIM_BOOL, isvisible_340658)(Tnode190813* n);
static N_INLINE(NI, len_191097)(Tnode190813* n);
N_NIMCALL(NimStringDesc*, getname_340755)(Tdocumentor340007* d, Tnode190813* n, NI splitafter);
N_NIMCALL(NimStringDesc*, esc_311553)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NimStringDesc*, renderdefinitionname_212154)(Tsym190843* s, NIM_BOOL noquotes);
static N_INLINE(Tnode190813*, HEX5BHEX5D_191244)(Tnode190813* n, NI i);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(void, internalerror_165199)(Tlineinfo163338 info, NimStringDesc* errmsg);
N_NIMCALL(Ropeobj161009*, rope_161320)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, getplaindocstring_340475)(Tnode190813* n);
N_NIMCALL(Ropeobj161009*, genreccomment_340385)(Tdocumentor340007* d, Tnode190813* n);
N_NIMCALL(void, inittokrender_212067)(Tsrcgen212023* r, Tnode190813* n, NU8 renderflags);
N_NIMCALL(void, getnexttok_212078)(Tsrcgen212023* r, NU8* kind, NimStringDesc** literal);
N_NIMCALL(void, dispa_340097)(Ropeobj161009** dest, NimStringDesc* xml, NimStringDesc* tex, Ropeobj161009** args, NI argsLen0);
N_NIMCALL(void, addf_162635)(Ropeobj161009** c, NimStringDesc* frmt, Ropeobj161009** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, escape_332066)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, renderplainsymbolname_337013)(Tnode190813* n);
N_NIMCALL(NimStringDesc*, complexname_340890)(NU8 k, Tnode190813* n, NimStringDesc* basename);
N_NIMCALL(NimStringDesc*, renderparamtypes_339658)(Tnode190813* n, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, encodeurl_335004)(NimStringDesc* s);
N_NIMCALL(Ropeobj161009*, rope_161407)(NI64 i);
N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_340862)(Tdocumentor340007* d, NimStringDesc* original);
N_NIMCALL(void, nstPut)(Stringtableobj134012* t, NimStringDesc* key, NimStringDesc* val);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, getconfigvar_154334)(NimStringDesc* key);
N_NIMCALL(Ropeobj161009*, ropeformatnamedvars_340162)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, Ropeobj161009** varvalues, NI varvaluesLen0);
N_NIMCALL(void, add_161534)(Ropeobj161009** a, Ropeobj161009* b);
N_NIMCALL(void, internalerror_165218)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NI, getvaridx_340120)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, rawmessage_164960)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_76243, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path);
N_NIMCALL(NIM_BOOL, iscallable_340911)(Tnode190813* n);
N_NIMCALL(void, setindexterm_311855)(Trstgenerator311016* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc);
N_NIMCALL(NimStringDesc*, docstringsummary_340921)(NimStringDesc* rsttext);
N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start);
N_NIMCALL(void, nsuDelete)(NimStringDesc** s, NI first, NI last);
N_NIMCALL(NI, nsuFindCharSet)(NimStringDesc* s, TY178407 chars, NI start);
N_NIMCALL(NI, sonslen_193403)(Tnode190813* n);
N_NIMCALL(NIM_BOOL, checkforfalse_341171)(Tnode190813* n);
N_NIMCALL(NIM_BOOL, identeq_167484)(Tident167021* id, NimStringDesc* name);
N_NIMCALL(Tnode190813*, lastson_193431)(Tnode190813* n);
N_NIMCALL(void, tracedeps_341191)(Tdocumentor340007* d, Tnode190813* n);
N_NIMCALL(NimStringDesc*, getmodulename_251018)(Tnode190813* n);
N_NIMCALL(void, writeoutput_343337)(Tdocumentor340007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning);
N_NIMCALL(Ropeobj161009*, genoutfile_342988)(Tdocumentor340007* d);
N_NIMCALL(void, rendertocentries_317176)(Trstgenerator311016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, gensection_342918)(Tdocumentor340007* d, NU8 kind);
N_NIMCALL(NimStringDesc*, ntgetDateStr)(void);
N_NIMCALL(NimStringDesc*, ntgetClockStr)(void);
N_NIMCALL(void, writerope_162070)(FILE* f, Ropeobj161009* r);
N_NIMCALL(void, writerope_162105)(Ropeobj161009* head, NimStringDesc* filename, NIM_BOOL usewarning);
N_NIMCALL(NimStringDesc*, getoutfile_154354)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(void, generateindex_343318)(Tdocumentor340007* d);
N_NIMCALL(void, writeindexfile_311445)(Trstgenerator311016* g, NimStringDesc* outfile);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY119589* Result);
N_NIMCALL(void, commandrstaux_343382)(NimStringDesc* filename, NimStringDesc* outext);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, readfile_13434)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(Jsonnodeobj289726*, generatejson_342143)(Tdocumentor340007* d, Tnode190813* n, Jsonnodeobj289726* jarray);
N_NIMCALL(Jsonnodeobj289726*, HEX25_290206)(TY290209* keyvals, NI keyvalsLen0);
N_NIMCALL(Jsonnodeobj289726*, HEX25_290130)(NimStringDesc* s);
N_NIMCALL(Jsonnodeobj289726*, genjsonitem_341141)(Tdocumentor340007* d, Tnode190813* n, Tnode190813* namenode, NU8 k);
N_NIMCALL(NimStringDesc*, HEX24_162131)(Ropeobj161009* r);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_82529, TNimType* typ);
N_NIMCALL(void, HEX5BHEX5DHEX3D_292619)(Jsonnodeobj289726* obj, NimStringDesc* key, Jsonnodeobj289726* val);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_290661)(Jsonnodeobj289726* a, Jsonnodeobj289726* b);
N_NIMCALL(Jsonnodeobj289726*, newjarray_289927)(void);
N_NIMCALL(void, add_292247)(Jsonnodeobj289726* father, Jsonnodeobj289726* child);
N_NIMCALL(NimStringDesc*, pretty_293446)(Jsonnodeobj289726* node, NI indent);
N_NIMCALL(NimStringDesc*, mergeindexes_316740)(NimStringDesc* dir);
STRING_LITERAL(TMP2091, "##", 2);
STRING_LITERAL(TMP2092, "", 0);
STRING_LITERAL(TMP2615, "\012##", 3);
STRING_LITERAL(TMP2616, "\012", 1);
STRING_LITERAL(TMP4769, "doc.googleAnalytics", 19);
STRING_LITERAL(TMP4770, "<script>\012  (function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']="
"r;i[r]=i[r]||function(){\012  (i[r].q=i[r].q||[]).push(arguments)},"
"i[r].l=1*new Date();a=s.createElement(o),\012  m=s.getElementsByTag"
"Name(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\012  })"
"(window,document,\'script\',\'//www.google-analytics.com/analytics."
"js\',\'ga\');\012\012  ga(\'create\', \'$1\', \'auto\');\012  ga(\'send\', \'pageview"
"\');\012\012</script>\012    ", 402);
STRING_LITERAL(TMP4772, "`", 1);
STRING_LITERAL(TMP4773, "getName()", 9);
STRING_LITERAL(TMP4774, "<span class=\"Comment\">$1</span>", 31);
STRING_LITERAL(TMP4775, "\\spanComment{$1}", 16);
STRING_LITERAL(TMP4776, "<span class=\"Keyword\">$1</span>", 31);
STRING_LITERAL(TMP4777, "\\spanKeyword{$1}", 16);
STRING_LITERAL(TMP4778, "<span class=\"Operator\">$1</span>", 32);
STRING_LITERAL(TMP4779, "\\spanOperator{$1}", 17);
STRING_LITERAL(TMP4780, "<span class=\"StringLit\">$1</span>", 33);
STRING_LITERAL(TMP4781, "\\spanStringLit{$1}", 18);
STRING_LITERAL(TMP4782, "<span class=\"CharLit\">$1</span>", 31);
STRING_LITERAL(TMP4783, "\\spanCharLit{$1}", 16);
STRING_LITERAL(TMP4784, "<span class=\"DecNumber\">$1</span>", 33);
STRING_LITERAL(TMP4785, "\\spanDecNumber{$1}", 18);
STRING_LITERAL(TMP4786, "<span class=\"FloatNumber\">$1</span>", 35);
STRING_LITERAL(TMP4787, "\\spanFloatNumber{$1}", 20);
STRING_LITERAL(TMP4788, "<span class=\"Identifier\">$1</span>", 34);
STRING_LITERAL(TMP4789, "\\spanIdentifier{$1}", 19);
STRING_LITERAL(TMP4790, "<span class=\"Other\">$1</span>", 29);
STRING_LITERAL(TMP4791, "\\spanOther{$1}", 14);
STRING_LITERAL(TMP4801, ",", 1);
STRING_LITERAL(TMP4802, ".m,", 3);
STRING_LITERAL(TMP4803, ".e,", 3);
STRING_LITERAL(TMP4804, ".i,", 3);
STRING_LITERAL(TMP4805, ".t,", 3);
STRING_LITERAL(TMP4806, ".c,", 3);
STRING_LITERAL(TMP4812, "_", 1);
STRING_LITERAL(TMP4813, "doc.item.seesrc", 15);
STRING_LITERAL(TMP4814, "$", 1);
STRING_LITERAL(TMP4815, "ropeFormatNamedVars", 19);
STRING_LITERAL(TMP4816, "}", 1);
STRING_LITERAL(TMP4818, "path", 4);
STRING_LITERAL(TMP4819, "line", 4);
NIM_CONST TY154965 TMP4817 = {((NimStringDesc*) &TMP4818),
((NimStringDesc*) &TMP4819)}
;
STRING_LITERAL(TMP4820, "$1", 2);
STRING_LITERAL(TMP4822, "url", 3);
NIM_CONST TY176061 TMP4821 = {((NimStringDesc*) &TMP4818),
((NimStringDesc*) &TMP4819),
((NimStringDesc*) &TMP4822)}
;
STRING_LITERAL(TMP4823, "doc.item", 8);
STRING_LITERAL(TMP4825, "name", 4);
STRING_LITERAL(TMP4826, "header", 6);
STRING_LITERAL(TMP4827, "desc", 4);
STRING_LITERAL(TMP4828, "itemID", 6);
STRING_LITERAL(TMP4829, "header_plain", 12);
STRING_LITERAL(TMP4830, "itemSym", 7);
STRING_LITERAL(TMP4831, "itemSymOrID", 11);
STRING_LITERAL(TMP4832, "itemSymEnc", 10);
STRING_LITERAL(TMP4833, "itemSymOrIDEnc", 14);
STRING_LITERAL(TMP4834, "seeSrc", 6);
NIM_CONST TY341106 TMP4824 = {((NimStringDesc*) &TMP4825),
((NimStringDesc*) &TMP4826),
((NimStringDesc*) &TMP4827),
((NimStringDesc*) &TMP4828),
((NimStringDesc*) &TMP4829),
((NimStringDesc*) &TMP4830),
((NimStringDesc*) &TMP4831),
((NimStringDesc*) &TMP4832),
((NimStringDesc*) &TMP4833),
((NimStringDesc*) &TMP4834)}
;
STRING_LITERAL(TMP4835, "doc.item.toc", 12);
NIM_CONST TY341111 TMP4836 = {((NimStringDesc*) &TMP4825),
((NimStringDesc*) &TMP4826),
((NimStringDesc*) &TMP4827),
((NimStringDesc*) &TMP4828),
((NimStringDesc*) &TMP4829),
((NimStringDesc*) &TMP4830),
((NimStringDesc*) &TMP4831),
((NimStringDesc*) &TMP4832),
((NimStringDesc*) &TMP4833)}
;
STRING_LITERAL(TMP4837, " : ", 3);
STRING_LITERAL(TMP4838, "\342\200\246", 3);
static NIM_CONST TY178407 TMP4839 = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
STRING_LITERAL(TMP4840, "false", 5);
STRING_LITERAL(TMP4841, ", ", 2);
STRING_LITERAL(TMP4842, "<a class=\"reference external\" href=\"$1.html\">$1</a>", 51);
STRING_LITERAL(TMP4847, "Imports", 7);
STRING_LITERAL(TMP4848, "Types", 5);
STRING_LITERAL(TMP4849, "Vars", 4);
STRING_LITERAL(TMP4850, "Lets", 4);
STRING_LITERAL(TMP4851, "Consts", 6);
STRING_LITERAL(TMP4852, "Procs", 5);
STRING_LITERAL(TMP4853, "Methods", 7);
STRING_LITERAL(TMP4854, "Iterators", 9);
STRING_LITERAL(TMP4855, "Converters", 10);
STRING_LITERAL(TMP4856, "Macros", 6);
STRING_LITERAL(TMP4857, "Templates", 9);
NIM_CONST TY342923 sectionnames_342922 = {((NimStringDesc*) &TMP4847),
((NimStringDesc*) &TMP4848),
((NimStringDesc*) &TMP4849),
((NimStringDesc*) &TMP4850),
((NimStringDesc*) &TMP4851),
((NimStringDesc*) &TMP4849),
((NimStringDesc*) &TMP4852),
((NimStringDesc*) &TMP4853),
((NimStringDesc*) &TMP4854),
((NimStringDesc*) &TMP4854),
((NimStringDesc*) &TMP4855),
((NimStringDesc*) &TMP4856),
((NimStringDesc*) &TMP4857)}
;
STRING_LITERAL(TMP4858, "doc.section", 11);
STRING_LITERAL(TMP4860, "sectionid", 9);
STRING_LITERAL(TMP4861, "sectionTitle", 12);
STRING_LITERAL(TMP4862, "sectionTitleID", 14);
STRING_LITERAL(TMP4863, "content", 7);
NIM_CONST TY164825 TMP4859 = {((NimStringDesc*) &TMP4860),
((NimStringDesc*) &TMP4861),
((NimStringDesc*) &TMP4862),
((NimStringDesc*) &TMP4863)}
;
STRING_LITERAL(TMP4864, "doc.section.toc", 15);
STRING_LITERAL(TMP4865, "doc.toc", 7);
NIM_CONST TY164566 TMP4866 = {((NimStringDesc*) &TMP4863)}
;
STRING_LITERAL(TMP4867, "Module ", 7);
STRING_LITERAL(TMP4868, "doc.body_toc", 12);
STRING_LITERAL(TMP4869, "doc.body_no_toc", 15);
STRING_LITERAL(TMP4871, "title", 5);
STRING_LITERAL(TMP4872, "tableofcontents", 15);
STRING_LITERAL(TMP4873, "moduledesc", 10);
STRING_LITERAL(TMP4874, "date", 4);
STRING_LITERAL(TMP4875, "time", 4);
NIM_CONST TY403890 TMP4870 = {((NimStringDesc*) &TMP4871),
((NimStringDesc*) &TMP4872),
((NimStringDesc*) &TMP4873),
((NimStringDesc*) &TMP4874),
((NimStringDesc*) &TMP4875),
((NimStringDesc*) &TMP4863)}
;
STRING_LITERAL(TMP4876, "doc.file", 8);
STRING_LITERAL(TMP4878, "author", 6);
STRING_LITERAL(TMP4879, "version", 7);
STRING_LITERAL(TMP4880, "analytics", 9);
NIM_CONST TY341111 TMP4877 = {((NimStringDesc*) &TMP4871),
((NimStringDesc*) &TMP4872),
((NimStringDesc*) &TMP4873),
((NimStringDesc*) &TMP4874),
((NimStringDesc*) &TMP4875),
((NimStringDesc*) &TMP4863),
((NimStringDesc*) &TMP4878),
((NimStringDesc*) &TMP4879),
((NimStringDesc*) &TMP4880)}
;
STRING_LITERAL(TMP4881, "html", 4);
STRING_LITERAL(TMP4882, ".idx", 4);
STRING_LITERAL(TMP4888, "txt", 3);
STRING_LITERAL(TMP4890, "\\-", 2);
STRING_LITERAL(TMP4891, "tex", 3);
STRING_LITERAL(TMP4899, "comment", 7);
STRING_LITERAL(TMP4900, "type", 4);
STRING_LITERAL(TMP4901, "description", 11);
STRING_LITERAL(TMP4902, "code", 4);
STRING_LITERAL(TMP4912, "json", 4);
STRING_LITERAL(TMP4952, "Index", 5);
STRING_LITERAL(TMP4953, "theindex", 8);
extern NI32 gprojectmainidx_154237;
extern TNimType NTI311016; /* TRstGenerator */
TNimType NTI340007; /* TDocumentor */
extern TNimType NTI161007; /* Rope */
extern TNimType NTI108; /* int */
TNimType NTI340005; /* TSections */
extern TNimType NTI149; /* string */
extern TNimType NTI134014; /* StringTableRef */
TNimType NTI340009; /* PDoc */
extern NU8 gcmd_154130;
extern Stringtableobj134012* gconfigvars_154231;
extern Tgcheap48216 gch_48244;
extern NimStringDesc* gprojectfull_154236;
extern NimStringDesc* docseesrcurl_154135;
extern NU32 gglobaloptions_154128;
extern NimStringDesc* outfile_154134;
extern NimStringDesc* splitter_311489;
extern TNimType NTI190441; /* TSymKind */

static N_INLINE(NI, safelen_191125)(Tnode190813* n) {
	NI result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n).kind >= ((NU8) 0) && (*n).kind <= ((NU8) 23));
		if (LOC3) goto LA4;
		LOC3 = (*n).kindU.S6.sons == 0;
		LA4: ;
		if (!LOC3) goto LA5;
		result = ((NI) 0);
	}
	goto LA1;
	LA5: ;
	{
		result = ((*n).kindU.S6.sons ? (*n).kindU.S6.sons->Sup.len : 0);
	}
	LA1: ;
	return result;
}

N_NIMCALL(Tnode190813*, finddoccomment_340542)(Tnode190813* n) {
	Tnode190813* result;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = !((*n).comment == 0);
		if (!(LOC7)) goto LA8;
		LOC7 = nsuStartsWith((*n).comment, ((NimStringDesc*) &TMP2091));
		LA8: ;
		if (!LOC7) goto LA9;
		result = n;
		goto BeforeRet;
	}
	LA9: ;
	{
		NI i_340572;
		NI HEX3Atmp_340587;
		NI LOC12;
		NI res_340590;
		i_340572 = 0;
		HEX3Atmp_340587 = 0;
		LOC12 = 0;
		LOC12 = safelen_191125(n);
		HEX3Atmp_340587 = (NI)(LOC12 - ((NI) 1));
		res_340590 = ((NI) 0);
		{
			while (1) {
				if (!(res_340590 <= HEX3Atmp_340587)) goto LA14;
				i_340572 = res_340590;
				result = finddoccomment_340542((*n).kindU.S6.sons->data[i_340572]);
				{
					if (!!((result == NIM_NIL))) goto LA17;
					goto BeforeRet;
				}
				LA17: ;
				res_340590 += ((NI) 1);
			} LA14: ;
		}
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, docgenfindfile_340039)(NimStringDesc* s) {
	NimStringDesc* result;
	result = 0;
	result = findfile_155339(s);
	{
		NimStringDesc* LOC5;
		if (!((result ? result->Sup.len : 0) == ((NI) 0))) goto LA3;
		LOC5 = 0;
		LOC5 = nosgetCurrentDir();
		result = HEX2F_119292(LOC5, s);
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = nosexistsFile(result);
			if (!!(LOC8)) goto LA9;
			result = copyString(((NimStringDesc*) &TMP2092));
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

static N_INLINE(Tlineinfo163338, newlineinfo_163879)(NimStringDesc* filename, NI line, NI col) {
	Tlineinfo163338 result;
	NI32 LOC1;
	memset((void*)(&result), 0, sizeof(result));
	LOC1 = 0;
	LOC1 = fileinfoidx_163854(filename);
	result = newlineinfo_163867(LOC1, line, col);
	return result;
}

N_NIMCALL(void, compilermsghandler_340023)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg) {
	NU16 k;
	Tlineinfo163338 LOC11;
	k = 0;
	switch (msgkind) {
	case ((NU8) 0):
	{
		k = ((NU16) 3);
	}
	break;
	case ((NU8) 1):
	{
		k = ((NU16) 188);
	}
	break;
	case ((NU8) 2):
	{
		k = ((NU16) 191);
	}
	break;
	case ((NU8) 3):
	{
		k = ((NU16) 193);
	}
	break;
	case ((NU8) 4):
	{
		k = ((NU16) 192);
	}
	break;
	case ((NU8) 5):
	{
		k = ((NU16) 30);
	}
	break;
	case ((NU8) 6):
	{
		k = ((NU16) 238);
	}
	break;
	case ((NU8) 7):
	{
		k = ((NU16) 239);
	}
	break;
	case ((NU8) 8):
	{
		k = ((NU16) 240);
	}
	break;
	case ((NU8) 9):
	{
		k = ((NU16) 241);
	}
	break;
	}
	LOC11 = newlineinfo_163879(filename, line, col);
	globalerror_165134(LOC11, k, arg);
}

N_NIMCALL(Trstnode296011*, parserst_340049)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions) {
	Trstnode296011* result;
	result = 0;
	result = rstparse_304320(text, filename, line, column, hastoc, rstoptions, docgenfindfile_340039, compilermsghandler_340023);
	return result;
}

static N_INLINE(NI, tolinenumber_164439)(Tlineinfo163338 info) {
	NI result;
	result = 0;
	result = ((NI) (info.line));
	return result;
}

static N_INLINE(NI, tocolumn_164449)(Tlineinfo163338 info) {
	NI result;
	result = 0;
	result = ((NI) (info.col));
	return result;
}

N_NIMCALL(NimStringDesc*, extractdoccomment_340609)(Tsym190843* s, Tdocumentor340007* d) {
	NimStringDesc* result;
	Tnode190813* n;
	result = 0;
	n = finddoccomment_340542((*s).ast);
	result = copyString(((NimStringDesc*) &TMP2092));
	{
		if (!!(n == 0)) goto LA3;
		{
			NIM_BOOL dummyhastoc;
			Trstgenerator311016* LOC9;
			NimStringDesc* LOC10;
			NI LOC11;
			NI LOC12;
			Trstnode296011* LOC13;
			if (!!(d == 0)) goto LA7;
			dummyhastoc = 0;
			LOC9 = 0;
			LOC9 = &d->Sup;
			LOC10 = 0;
			LOC10 = tofilename_164266((*n).info.fileindex);
			LOC11 = 0;
			LOC11 = tolinenumber_164439((*n).info);
			LOC12 = 0;
			LOC12 = tocolumn_164449((*n).info);
			LOC13 = 0;
			LOC13 = parserst_340049((*n).comment, LOC10, LOC11, LOC12, (&dummyhastoc), ((*d).Sup.options | 1));
			renderrsttoout_311724(LOC9, LOC13, (&result));
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC15;
			NimStringDesc* LOC16;
			LOC15 = 0;
			LOC15 = copyStr((*n).comment, ((NI) 2));
			LOC16 = 0;
			LOC16 = nsuReplaceStr(LOC15, ((NimStringDesc*) &TMP2615), ((NimStringDesc*) &TMP2616));
			result = nsuStrip(LOC16, NIM_TRUE, NIM_TRUE);
		}
		LA5: ;
	}
	LA3: ;
	return result;
}
N_NIMCALL(void, TMP4765)(void* p, NI op) {
	Tdocumentor340007* a;
	NI LOC1;
	NI LOC2;
	NI LOC3;
	a = (Tdocumentor340007*)p;
	nimGCvisit((void*)(*a).Sup.config, op);
	nimGCvisit((void*)(*a).Sup.tocpart, op);
	nimGCvisit((void*)(*a).Sup.theindex, op);
	nimGCvisit((void*)(*a).Sup.filename, op);
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < 5; LOC1++) {
	nimGCvisit((void*)(*a).Sup.meta[LOC1], op);
	}
	nimGCvisit((void*)(*a).Sup.currentsection, op);
	nimGCvisit((void*)(*a).Sup.seenindexterms.data, op);
	nimGCvisit((void*)(*a).moddesc, op);
	LOC2 = 0;
	for (LOC2 = 0; LOC2 < 26; LOC2++) {
	nimGCvisit((void*)(*a).toc[LOC2], op);
	}
	LOC3 = 0;
	for (LOC3 = 0; LOC3 < 26; LOC3++) {
	nimGCvisit((void*)(*a).section[LOC3], op);
	}
	nimGCvisit((void*)(*a).indexvalfilename, op);
	nimGCvisit((void*)(*a).analytics, op);
	nimGCvisit((void*)(*a).seensymbols, op);
}

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

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

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

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

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

static N_INLINE(void, rtladdcycleroot_50623)(Tcell46347* c) {
	{
		if (!!((((NI) ((NI)((*c).refcount & ((NI) 3)))) == ((NI) 3)))) goto LA3;
		(*c).refcount = (NI)((NI)((*c).refcount & ((NI) -4)) | ((NI) 3));
		incl_47065((&gch_48244.cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_52222)(Tcell46347* c) {
	(*c).refcount = (NI)((NU32)((*c).refcount) + (NU32)(((NI) 8)));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_49867(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_50623(c);
	}
	LA4: ;
}

static N_INLINE(void, decref_51804)(Tcell46347* c) {
	{
		(*c).refcount -= ((NI) 8);
		if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA3;
		rtladdzct_51404(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_49867(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_50623(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		Tcell46347* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_49846(src);
		incref_52222(LOC5);
	}
	LA3: ;
	{
		Tcell46347* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_49846((*dest));
		decref_51804(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(Tdocumentor340007*, newdocumentor_340065)(NimStringDesc* filename, Stringtableobj134012* config) {
	Tdocumentor340007* result;
	Trstgenerator311016* LOC1;
	NU8 LOC2;
	result = 0;
	result = (Tdocumentor340007*) newObj((&NTI340009), sizeof(Tdocumentor340007));
	(*result).Sup.Sup.m_type = (&NTI340007);
	LOC1 = 0;
	LOC1 = &result->Sup;
	LOC2 = 0;
	{
		if (!!((gcmd_154130 == ((NU8) 17)))) goto LA5;
		LOC2 = ((NU8) 0);
	}
	goto LA3;
	LA5: ;
	{
		LOC2 = ((NU8) 1);
	}
	LA3: ;
	initrstgenerator_311088(LOC1, LOC2, gconfigvars_154231, filename, 4, docgenfindfile_340039, compilermsghandler_340023);
	{
		NIM_BOOL LOC10;
		TY164566 LOC13;
		LOC10 = 0;
		LOC10 = nsthasKey(config, ((NimStringDesc*) &TMP4769));
		if (!LOC10) goto LA11;
		memset((void*)LOC13, 0, sizeof(LOC13));
		LOC13[0] = nstGet(config, ((NimStringDesc*) &TMP4769));
		asgnRefNoCycle((void**) (&(*result).analytics), nsuFormatOpenArray(((NimStringDesc*) &TMP4770), LOC13, 1));
	}
	goto LA8;
	LA11: ;
	{
		NimStringDesc* LOC15;
		LOC15 = 0;
		LOC15 = (*result).analytics; (*result).analytics = copyStringRC1(((NimStringDesc*) &TMP2092));
		if (LOC15) nimGCunrefNoCycle(LOC15);
	}
	LA8: ;
	asgnRef((void**) (&(*result).seensymbols), nstnewStringTable(((NU8) 1)));
	(*result).id = ((NI) 100);
	return result;
}

N_NIMCALL(NimStringDesc*, gencomment_340354)(Tdocumentor340007* d, Tnode190813* n) {
	NimStringDesc* result;
	NIM_BOOL dummyhastoc;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2092));
	dummyhastoc = 0;
	{
		NIM_BOOL LOC3;
		Trstgenerator311016* LOC7;
		NimStringDesc* LOC8;
		NI LOC9;
		NI LOC10;
		Trstnode296011* LOC11;
		LOC3 = 0;
		LOC3 = !(((*n).comment == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = nsuStartsWith((*n).comment, ((NimStringDesc*) &TMP2091));
		LA4: ;
		if (!LOC3) goto LA5;
		LOC7 = 0;
		LOC7 = &d->Sup;
		LOC8 = 0;
		LOC8 = tofilename_164266((*n).info.fileindex);
		LOC9 = 0;
		LOC9 = tolinenumber_164439((*n).info);
		LOC10 = 0;
		LOC10 = tocolumn_164449((*n).info);
		LOC11 = 0;
		LOC11 = parserst_340049((*n).comment, LOC8, LOC9, LOC10, (&dummyhastoc), ((*d).Sup.options | 1));
		renderrsttoout_311724(LOC7, LOC11, (&result));
	}
	LA5: ;
	return result;
}

static N_INLINE(NI, len_191097)(Tnode190813* n) {
	NI result;
	result = 0;
	{
		if (!(*n).kindU.S6.sons == 0) goto LA3;
		result = ((NI) 0);
	}
	goto LA1;
	LA3: ;
	{
		result = ((*n).kindU.S6.sons ? (*n).kindU.S6.sons->Sup.len : 0);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, isvisible_340658)(Tnode190813* n) {
	NIM_BOOL result;
	result = 0;
	result = NIM_FALSE;
	{
		if (!((*n).kind == ((NU8) 31))) goto LA3;
		{
			NIM_BOOL LOC7;
			NI LOC8;
			Tident167021* v;
			NIM_BOOL LOC12;
			LOC7 = 0;
			LOC8 = 0;
			LOC8 = len_191097(n);
			LOC7 = (LOC8 == ((NI) 2));
			if (!(LOC7)) goto LA9;
			LOC7 = ((*(*n).kindU.S6.sons->data[((NI) 0)]).kind == ((NU8) 2));
			LA9: ;
			if (!LOC7) goto LA10;
			v = (*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident;
			LOC12 = 0;
			LOC12 = ((*v).Sup.id == ((NI) 76));
			if (LOC12) goto LA13;
			LOC12 = ((*v).Sup.id == ((NI) 77));
			LA13: ;
			result = LOC12;
		}
		LA10: ;
	}
	goto LA1;
	LA3: ;
	{
		if (!((*n).kind == ((NU8) 3))) goto LA15;
		result = ((22 & (*(*n).kindU.S4.sym).flags) == 2);
	}
	goto LA1;
	LA15: ;
	{
		if (!((*n).kind == ((NU8) 43))) goto LA18;
		result = isvisible_340658((*n).kindU.S6.sons->data[((NI) 0)]);
	}
	goto LA1;
	LA18: ;
	LA1: ;
	return result;
}

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

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*, getname_340755)(Tdocumentor340007* d, Tnode190813* n, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 31):
	{
		result = getname_340755(d, (*n).kindU.S6.sons->data[((NI) 1)], splitafter);
	}
	break;
	case ((NU8) 43):
	{
		result = getname_340755(d, (*n).kindU.S6.sons->data[((NI) 0)], splitafter);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC4;
		LOC4 = 0;
		LOC4 = renderdefinitionname_212154((*n).kindU.S4.sym, NIM_FALSE);
		result = esc_311553((*d).Sup.target, LOC4, splitafter);
	}
	break;
	case ((NU8) 2):
	{
		result = esc_311553((*d).Sup.target, (*(*n).kindU.S5.ident).s, splitafter);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* LOC13;
		result = esc_311553((*d).Sup.target, ((NimStringDesc*) &TMP4772), ((NI) -1));
		{
			NI i_340785;
			NI HEX3Atmp_340787;
			NI LOC8;
			NI res_340790;
			i_340785 = 0;
			HEX3Atmp_340787 = 0;
			LOC8 = 0;
			LOC8 = len_191097(n);
			HEX3Atmp_340787 = (LOC8 - 1);
			res_340790 = ((NI) 0);
			{
				while (1) {
					Tnode190813* LOC11;
					NimStringDesc* LOC12;
					if (!(res_340790 <= HEX3Atmp_340787)) goto LA10;
					i_340785 = res_340790;
					LOC11 = 0;
					LOC11 = HEX5BHEX5D_191244(n, i_340785);
					LOC12 = 0;
					LOC12 = getname_340755(d, LOC11, splitafter);
					result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
					res_340790 += ((NI) 1);
				} LA10: ;
			}
		}
		LOC13 = 0;
		LOC13 = esc_311553((*d).Sup.target, ((NimStringDesc*) &TMP4772), ((NI) -1));
		result = resizeString(result, LOC13->Sup.len + 0);
appendString(result, LOC13);
	}
	break;
	default:
	{
		internalerror_165199((*n).info, ((NimStringDesc*) &TMP4773));
		result = copyString(((NimStringDesc*) &TMP2092));
	}
	break;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, getplaindocstring_340475)(Tnode190813* n) {
	NimStringDesc* result;
{	result = 0;
	result = copyString(((NimStringDesc*) &TMP2092));
	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = !(((*n).comment == NIM_NIL));
		if (!(LOC7)) goto LA8;
		LOC7 = nsuStartsWith((*n).comment, ((NimStringDesc*) &TMP2091));
		LA8: ;
		if (!LOC7) goto LA9;
		result = copyString((*n).comment);
	}
	LA9: ;
	{
		if (!((result ? result->Sup.len : 0) < ((NI) 1))) goto LA13;
		{
			if (!!(((*n).kind >= ((NU8) 1) && (*n).kind <= ((NU8) 23)))) goto LA17;
			{
				NI i_340517;
				NI HEX3Atmp_340520;
				NI LOC20;
				NI res_340523;
				i_340517 = 0;
				HEX3Atmp_340520 = 0;
				LOC20 = 0;
				LOC20 = len_191097(n);
				HEX3Atmp_340520 = (NI)(LOC20 - ((NI) 1));
				res_340523 = ((NI) 0);
				{
					while (1) {
						if (!(res_340523 <= HEX3Atmp_340520)) goto LA22;
						i_340517 = res_340523;
						result = getplaindocstring_340475((*n).kindU.S6.sons->data[i_340517]);
						{
							if (!(((NI) 0) < (result ? result->Sup.len : 0))) goto LA25;
							goto BeforeRet;
						}
						LA25: ;
						res_340523 += ((NI) 1);
					} LA22: ;
				}
			}
		}
		LA17: ;
	}
	LA13: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ropeobj161009*, genreccomment_340385)(Tdocumentor340007* d, Tnode190813* n) {
	Ropeobj161009* result;
	NimStringDesc* LOC5;
{	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = gencomment_340354(d, n);
	result = rope_161320(LOC5);
	{
		if (!(result == NIM_NIL)) goto LA8;
		{
			if (!!(((*n).kind >= ((NU8) 1) && (*n).kind <= ((NU8) 23)))) goto LA12;
			{
				NI i_340437;
				NI HEX3Atmp_340453;
				NI LOC15;
				NI res_340456;
				i_340437 = 0;
				HEX3Atmp_340453 = 0;
				LOC15 = 0;
				LOC15 = len_191097(n);
				HEX3Atmp_340453 = (NI)(LOC15 - ((NI) 1));
				res_340456 = ((NI) 0);
				{
					while (1) {
						if (!(res_340456 <= HEX3Atmp_340453)) goto LA17;
						i_340437 = res_340456;
						result = genreccomment_340385(d, (*n).kindU.S6.sons->data[i_340437]);
						{
							if (!!((result == NIM_NIL))) goto LA20;
							goto BeforeRet;
						}
						LA20: ;
						res_340456 += ((NI) 1);
					} LA17: ;
				}
			}
		}
		LA12: ;
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC23;
		LOC23 = 0;
		LOC23 = (*n).comment; (*n).comment = copyStringRC1(NIM_NIL);
		if (LOC23) nimGCunrefNoCycle(LOC23);
	}
	LA6: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, dispa_340097)(Ropeobj161009** dest, NimStringDesc* xml, NimStringDesc* tex, Ropeobj161009** args, NI argsLen0) {
	{
		if (!!((gcmd_154130 == ((NU8) 17)))) goto LA3;
		addf_162635(dest, xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		addf_162635(dest, tex, args, argsLen0);
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, complexname_340890)(NU8 k, Tnode190813* n, NimStringDesc* basename) {
	NimStringDesc* result;
	result = 0;
	result = copyString(basename);
	switch (k) {
	case ((NU8) 12):
	{
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP4801));
	}
	break;
	case ((NU8) 17):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4802));
	}
	break;
	case ((NU8) 13):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4803));
	}
	break;
	case ((NU8) 14):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4804));
	}
	break;
	case ((NU8) 18):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4805));
	}
	break;
	case ((NU8) 16):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4806));
	}
	break;
	default:
	{
	}
	break;
	}
	{
		NIM_BOOL LOC10;
		NI LOC11;
		Tnode190813* LOC13;
		Tnode190813* LOC16;
		NimStringDesc* LOC17;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = len_191097(n);
		LOC10 = (((NI) 3) < LOC11);
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_191244(n, ((NI) 3));
		LOC10 = ((*LOC13).kind == ((NU8) 76));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_191244(n, ((NI) 3));
		LOC17 = 0;
		LOC17 = renderparamtypes_339658(LOC16, ((NimStringDesc*) &TMP4801));
		result = resizeString(result, LOC17->Sup.len + 0);
appendString(result, LOC17);
	}
	LA14: ;
	return result;
}

N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_340862)(Tdocumentor340007* d, NimStringDesc* original) {
	NimStringDesc* result;
	NI count;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = nsthasKey((*d).seensymbols, original);
		if (!!(LOC3)) goto LA4;
		result = copyString(original);
		nstPut((*d).seensymbols, original, ((NimStringDesc*) &TMP2092));
		goto BeforeRet;
	}
	LA4: ;
	count = ((NI) 2);
	{
		while (1) {
			NimStringDesc* LOC8;
			NimStringDesc* LOC9;
			LOC8 = 0;
			LOC9 = 0;
			LOC9 = nimIntToStr(count);
			LOC8 = rawNewString(original->Sup.len + LOC9->Sup.len + 1);
appendString(LOC8, original);
appendString(LOC8, ((NimStringDesc*) &TMP4812));
appendString(LOC8, LOC9);
			result = LOC8;
			{
				NIM_BOOL LOC12;
				LOC12 = 0;
				LOC12 = nsthasKey((*d).seensymbols, result);
				if (!!(LOC12)) goto LA13;
				nstPut((*d).seensymbols, result, ((NimStringDesc*) &TMP2092));
				goto LA6;
			}
			LA13: ;
			count += ((NI) 1);
		}
	} LA6: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NI, getvaridx_340120)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id) {
	NI result;
{	result = 0;
	{
		NI i_340138;
		NI HEX3Atmp_340140;
		NI res_340143;
		i_340138 = 0;
		HEX3Atmp_340140 = 0;
		HEX3Atmp_340140 = (varnamesLen0-1);
		res_340143 = ((NI) 0);
		{
			while (1) {
				if (!(res_340143 <= HEX3Atmp_340140)) goto LA3;
				i_340138 = res_340143;
				{
					NI LOC6;
					LOC6 = 0;
					LOC6 = nsuCmpIgnoreStyle(varnames[i_340138], id);
					if (!(LOC6 == ((NI) 0))) goto LA7;
					result = i_340138;
					goto BeforeRet;
				}
				LA7: ;
				res_340143 += ((NI) 1);
			} LA3: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Ropeobj161009*, ropeformatnamedvars_340162)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, Ropeobj161009** varvalues, NI varvaluesLen0) {
	Ropeobj161009* result;
	NI i;
	NI L;
	NI num;
	result = 0;
	i = ((NI) 0);
	L = (frmt ? frmt->Sup.len : 0);
	result = NIM_NIL;
	num = ((NI) 0);
	{
		while (1) {
			NI start;
			if (!(i < L)) goto LA2;
			{
				if (!((NU8)(frmt->data[i]) == (NU8)(36))) goto LA5;
				i += ((NI) 1);
				switch (((NU8)(frmt->data[i]))) {
				case 35:
				{
					add_161534(&result, varvalues[num]);
					num += ((NI) 1);
					i += ((NI) 1);
				}
				break;
				case 36:
				{
					add_161545(&result, ((NimStringDesc*) &TMP4814));
					i += ((NI) 1);
				}
				break;
				case 48 ... 57:
				{
					NI j;
					j = ((NI) 0);
					{
						while (1) {
							j = (NI)((NI)((NI)(j * ((NI) 10)) + ((NI) (((NU8)(frmt->data[i]))))) - ((NI) 48));
							i += ((NI) 1);
							{
								NIM_BOOL LOC14;
								LOC14 = 0;
								LOC14 = ((NI)((NI)(L + ((NI) 0)) - ((NI) 1)) < i);
								if (LOC14) goto LA15;
								LOC14 = !((((NU8)(frmt->data[i])) >= ((NU8)(48)) && ((NU8)(frmt->data[i])) <= ((NU8)(57))));
								LA15: ;
								if (!LOC14) goto LA16;
								goto LA10;
							}
							LA16: ;
						}
					} LA10: ;
					{
						if (!((NI)((varvaluesLen0-1) + ((NI) 1)) < j)) goto LA20;
						internalerror_165218(((NimStringDesc*) &TMP4815));
					}
					LA20: ;
					num = j;
					add_161534(&result, varvalues[(NI)(j - ((NI) 1))]);
				}
				break;
				case 65 ... 90:
				case 97 ... 122:
				case 128 ... 255:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2092));
					{
						while (1) {
							id = addChar(id, frmt->data[i]);
							i += ((NI) 1);
							{
								if (!!((((NU8)(frmt->data[i])) >= ((NU8)(65)) && ((NU8)(frmt->data[i])) <= ((NU8)(90)) || ((NU8)(frmt->data[i])) == ((NU8)(95)) || ((NU8)(frmt->data[i])) >= ((NU8)(97)) && ((NU8)(frmt->data[i])) <= ((NU8)(122)) || ((NU8)(frmt->data[i])) >= ((NU8)(128)) && ((NU8)(frmt->data[i])) <= ((NU8)(255))))) goto LA27;
								goto LA23;
							}
							LA27: ;
						}
					} LA23: ;
					idx = getvaridx_340120(varnames, varnamesLen0, id);
					{
						if (!(((NI) 0) <= idx)) goto LA31;
						add_161534(&result, varvalues[idx]);
					}
					goto LA29;
					LA31: ;
					{
						rawmessage_164960(((NU16) 152), id);
					}
					LA29: ;
				}
				break;
				case 123:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2092));
					i += ((NI) 1);
					{
						while (1) {
							if (!!(((NU8)(frmt->data[i]) == (NU8)(125)))) goto LA36;
							{
								if (!((NU8)(frmt->data[i]) == (NU8)(0))) goto LA39;
								rawmessage_164960(((NU16) 23), ((NimStringDesc*) &TMP4816));
							}
							LA39: ;
							id = addChar(id, frmt->data[i]);
							i += ((NI) 1);
						} LA36: ;
					}
					i += ((NI) 1);
					idx = getvaridx_340120(varnames, varnamesLen0, id);
					{
						if (!(((NI) 0) <= idx)) goto LA43;
						add_161534(&result, varvalues[idx]);
					}
					goto LA41;
					LA43: ;
					{
						rawmessage_164960(((NU16) 152), id);
					}
					LA41: ;
				}
				break;
				default:
				{
					internalerror_165218(((NimStringDesc*) &TMP4815));
				}
				break;
				}
			}
			LA5: ;
			start = i;
			{
				while (1) {
					if (!(i < L)) goto LA48;
					{
						if (!!(((NU8)(frmt->data[i]) == (NU8)(36)))) goto LA51;
						i += ((NI) 1);
					}
					goto LA49;
					LA51: ;
					{
						goto LA47;
					}
					LA49: ;
				} LA48: ;
			} LA47: ;
			{
				NimStringDesc* LOC58;
				if (!(start <= (NI)(i - ((NI) 1)))) goto LA56;
				LOC58 = 0;
				LOC58 = copyStrLast(frmt, start, (NI)(i - ((NI) 1)));
				add_161545(&result, LOC58);
			}
			LA56: ;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NIM_BOOL, iscallable_340911)(Tnode190813* n) {
	NIM_BOOL result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 79):
	case ((NU8) 80):
	case ((NU8) 84):
	case ((NU8) 82):
	case ((NU8) 83):
	case ((NU8) 81):
	{
		result = NIM_TRUE;
	}
	break;
	default:
	{
		result = NIM_FALSE;
	}
	break;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, docstringsummary_340921)(NimStringDesc* rsttext) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NI pos;
	NI last;
{	result = 0;
	LOC1 = 0;
	LOC1 = copyStr(rsttext, ((NI) 2));
	result = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE);
	pos = nsuFindChar(result, 10, ((NI) 0));
	{
		if (!(((NI) 0) < pos)) goto LA4;
		nsuDelete((&result), pos, (NI)((result ? result->Sup.len : 0) - ((NI) 1)));
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4838));
	}
	LA4: ;
	{
		if (!(pos < ((NI) 100))) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	pos = nsuFindCharSet(result, TMP4839, ((NI) 0));
	last = (NI)((result ? result->Sup.len : 0) - ((NI) 1));
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = (((NI) 0) < pos);
		if (!(LOC12)) goto LA13;
		LOC12 = (pos < last);
		LA13: ;
		if (!LOC12) goto LA14;
		nsuDelete((&result), pos, last);
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4838));
	}
	LA14: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, genitem_341012)(Tdocumentor340007* d, Tnode190813* n, Tnode190813* namenode, NU8 k) {
	NimStringDesc* name;
	Ropeobj161009* namerope;
	NimStringDesc* plaindocstring;
	Ropeobj161009* result;
	NimStringDesc* literal;
	NimStringDesc* plainname;
	NU8 kind;
	Ropeobj161009* comm;
	Tsrcgen212023 r;
	Ropeobj161009* plainnamerope;
	NimStringDesc* LOC42;
	NimStringDesc* LOC43;
	NimStringDesc* cleanplainsymbol;
	NimStringDesc* complexsymbol;
	Ropeobj161009* plainsymbolrope;
	Ropeobj161009* plainsymbolencrope;
	NimStringDesc* LOC44;
	Ropeobj161009* itemidrope;
	NimStringDesc* symbolorid;
	Ropeobj161009* symboloridrope;
	Ropeobj161009* symboloridencrope;
	NimStringDesc* LOC45;
	Ropeobj161009* seesrcrope;
	NimStringDesc* docitemseesrc;
	NimStringDesc* LOC59;
	TY341108 LOC60;
	Ropeobj161009* LOC61;
	NimStringDesc* LOC62;
	TY341113 LOC63;
	NimStringDesc* LOC64;
	Ropeobj161009* LOC65;
	NimStringDesc* linktitle;
	NimStringDesc* LOC66;
	NimStringDesc* LOC67;
	NimStringDesc* LOC68;
	Trstgenerator311016* LOC79;
	NimStringDesc* LOC80;
	NimStringDesc* LOC81;
{	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_340658(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_340755(d, namenode, ((NI) -1));
	namerope = rope_161320(name);
	plaindocstring = getplaindocstring_340475(n);
	result = NIM_NIL;
	literal = copyString(((NimStringDesc*) &TMP2092));
	plainname = copyString(((NimStringDesc*) &TMP2092));
	kind = ((NU8) 1);
	comm = genreccomment_340385(d, n);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_212067((&r), n, 94);
	{
		while (1) {
			getnexttok_212078((&r), (&kind), (&literal));
			{
				if (!(kind == ((NU8) 1))) goto LA10;
				goto LA6;
			}
			LA10: ;
			plainname = resizeString(plainname, literal->Sup.len + 0);
appendString(plainname, literal);
		}
	} LA6: ;
	inittokrender_212067((&r), n, 14);
	{
		while (1) {
			getnexttok_212078((&r), (&kind), (&literal));
			switch (kind) {
			case ((NU8) 1):
			{
				goto LA12;
			}
			break;
			case ((NU8) 113):
			{
				TY161572 LOC16;
				NimStringDesc* LOC17;
				memset((void*)LOC16, 0, sizeof(LOC16));
				LOC17 = 0;
				LOC17 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC16[0] = rope_161320(LOC17);
				dispa_340097(&result, ((NimStringDesc*) &TMP4774), ((NimStringDesc*) &TMP4775), LOC16, 1);
			}
			break;
			case ((NU8) 3) ... ((NU8) 72):
			{
				TY161572 LOC19;
				memset((void*)LOC19, 0, sizeof(LOC19));
				LOC19[0] = rope_161320(literal);
				dispa_340097(&result, ((NimStringDesc*) &TMP4776), ((NimStringDesc*) &TMP4777), LOC19, 1);
			}
			break;
			case ((NU8) 112):
			{
				TY161572 LOC21;
				NimStringDesc* LOC22;
				memset((void*)LOC21, 0, sizeof(LOC21));
				LOC22 = 0;
				LOC22 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC21[0] = rope_161320(LOC22);
				dispa_340097(&result, ((NimStringDesc*) &TMP4778), ((NimStringDesc*) &TMP4779), LOC21, 1);
			}
			break;
			case ((NU8) 87) ... ((NU8) 89):
			{
				TY161572 LOC24;
				NimStringDesc* LOC25;
				memset((void*)LOC24, 0, sizeof(LOC24));
				LOC25 = 0;
				LOC25 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC24[0] = rope_161320(LOC25);
				dispa_340097(&result, ((NimStringDesc*) &TMP4780), ((NimStringDesc*) &TMP4781), LOC24, 1);
			}
			break;
			case ((NU8) 92):
			{
				TY161572 LOC27;
				NimStringDesc* LOC28;
				memset((void*)LOC27, 0, sizeof(LOC27));
				LOC28 = 0;
				LOC28 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC27[0] = rope_161320(LOC28);
				dispa_340097(&result, ((NimStringDesc*) &TMP4782), ((NimStringDesc*) &TMP4783), LOC27, 1);
			}
			break;
			case ((NU8) 73) ... ((NU8) 82):
			{
				TY161572 LOC30;
				NimStringDesc* LOC31;
				memset((void*)LOC30, 0, sizeof(LOC30));
				LOC31 = 0;
				LOC31 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC30[0] = rope_161320(LOC31);
				dispa_340097(&result, ((NimStringDesc*) &TMP4784), ((NimStringDesc*) &TMP4785), LOC30, 1);
			}
			break;
			case ((NU8) 83) ... ((NU8) 86):
			{
				TY161572 LOC33;
				NimStringDesc* LOC34;
				memset((void*)LOC33, 0, sizeof(LOC33));
				LOC34 = 0;
				LOC34 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC33[0] = rope_161320(LOC34);
				dispa_340097(&result, ((NimStringDesc*) &TMP4786), ((NimStringDesc*) &TMP4787), LOC33, 1);
			}
			break;
			case ((NU8) 2):
			{
				TY161572 LOC36;
				NimStringDesc* LOC37;
				memset((void*)LOC36, 0, sizeof(LOC36));
				LOC37 = 0;
				LOC37 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC36[0] = rope_161320(LOC37);
				dispa_340097(&result, ((NimStringDesc*) &TMP4788), ((NimStringDesc*) &TMP4789), LOC36, 1);
			}
			break;
			case ((NU8) 115):
			case ((NU8) 0):
			{
				add_161545(&result, literal);
			}
			break;
			case ((NU8) 93):
			case ((NU8) 94):
			case ((NU8) 95):
			case ((NU8) 96):
			case ((NU8) 97):
			case ((NU8) 98):
			case ((NU8) 99):
			case ((NU8) 100):
			case ((NU8) 101):
			case ((NU8) 102):
			case ((NU8) 103):
			case ((NU8) 104):
			case ((NU8) 105):
			case ((NU8) 106):
			case ((NU8) 107):
			case ((NU8) 109):
			case ((NU8) 110):
			case ((NU8) 111):
			case ((NU8) 114):
			case ((NU8) 108):
			case ((NU8) 90):
			case ((NU8) 91):
			case ((NU8) 116):
			case ((NU8) 117):
			case ((NU8) 118):
			{
				TY161572 LOC40;
				NimStringDesc* LOC41;
				memset((void*)LOC40, 0, sizeof(LOC40));
				LOC41 = 0;
				LOC41 = esc_311553((*d).Sup.target, literal, ((NI) -1));
				LOC40[0] = rope_161320(LOC41);
				dispa_340097(&result, ((NimStringDesc*) &TMP4790), ((NimStringDesc*) &TMP4791), LOC40, 1);
			}
			break;
			}
		}
	} LA12: ;
	(*d).id += ((NI) 1);
	LOC42 = 0;
	LOC42 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
	LOC43 = 0;
	LOC43 = escape_332066(LOC42);
	plainnamerope = rope_161320(LOC43);
	cleanplainsymbol = renderplainsymbolname_337013(namenode);
	complexsymbol = complexname_340890(k, n, cleanplainsymbol);
	plainsymbolrope = rope_161320(cleanplainsymbol);
	LOC44 = 0;
	LOC44 = encodeurl_335004(cleanplainsymbol);
	plainsymbolencrope = rope_161320(LOC44);
	itemidrope = rope_161407(((NI64) ((*d).id)));
	symbolorid = newuniqueplainsymbol_340862(d, complexsymbol);
	symboloridrope = rope_161320(symbolorid);
	LOC45 = 0;
	LOC45 = encodeurl_335004(symbolorid);
	symboloridencrope = rope_161320(LOC45);
	seesrcrope = NIM_NIL;
	docitemseesrc = getconfigvar_154334(((NimStringDesc*) &TMP4813));
	{
		NIM_BOOL LOC48;
		Ropeobj161009* urlrope;
		TY490436 LOC52;
		NimStringDesc* LOC53;
		NimStringDesc* LOC54;
		TY161572 LOC55;
		TY462569 LOC56;
		NimStringDesc* LOC57;
		NimStringDesc* LOC58;
		LOC48 = 0;
		LOC48 = (((NI) 0) < (docitemseesrc ? docitemseesrc->Sup.len : 0));
		if (!(LOC48)) goto LA49;
		LOC48 = (((NI) 0) < (docseesrcurl_154135 ? docseesrcurl_154135->Sup.len : 0));
		LA49: ;
		if (!LOC48) goto LA50;
		memset((void*)LOC52, 0, sizeof(LOC52));
		LOC53 = 0;
		LOC53 = tofilename_164266((*n).info.fileindex);
		LOC52[0] = rope_161320(LOC53);
		LOC54 = 0;
		LOC54 = nimIntToStr(((NI) ((*n).info.line)));
		LOC52[1] = rope_161320(LOC54);
		urlrope = ropeformatnamedvars_340162(docseesrcurl_154135, TMP4817, 2, LOC52, 2);
		memset((void*)LOC55, 0, sizeof(LOC55));
		memset((void*)LOC56, 0, sizeof(LOC56));
		LOC57 = 0;
		LOC57 = tofilename_164266((*n).info.fileindex);
		LOC56[0] = rope_161320(LOC57);
		LOC58 = 0;
		LOC58 = nimIntToStr(((NI) ((*n).info.line)));
		LOC56[1] = rope_161320(LOC58);
		LOC56[2] = urlrope;
		LOC55[0] = ropeformatnamedvars_340162(docitemseesrc, TMP4821, 3, LOC56, 3);
		dispa_340097(&seesrcrope, ((NimStringDesc*) &TMP4820), ((NimStringDesc*) &TMP2092), LOC55, 1);
	}
	LA50: ;
	LOC59 = 0;
	LOC59 = getconfigvar_154334(((NimStringDesc*) &TMP4823));
	memset((void*)LOC60, 0, sizeof(LOC60));
	LOC60[0] = namerope;
	LOC60[1] = result;
	LOC60[2] = comm;
	LOC60[3] = itemidrope;
	LOC60[4] = plainnamerope;
	LOC60[5] = plainsymbolrope;
	LOC60[6] = symboloridrope;
	LOC60[7] = plainsymbolencrope;
	LOC60[8] = symboloridencrope;
	LOC60[9] = seesrcrope;
	LOC61 = 0;
	LOC61 = ropeformatnamedvars_340162(LOC59, TMP4824, 10, LOC60, 10);
	add_161534(&(*d).section[(k)- 0], LOC61);
	LOC62 = 0;
	LOC62 = getconfigvar_154334(((NimStringDesc*) &TMP4835));
	memset((void*)LOC63, 0, sizeof(LOC63));
	LOC64 = 0;
	LOC64 = getname_340755(d, namenode, (*d).Sup.splitafter);
	LOC63[0] = rope_161320(LOC64);
	LOC63[1] = result;
	LOC63[2] = comm;
	LOC63[3] = itemidrope;
	LOC63[4] = plainnamerope;
	LOC63[5] = plainsymbolrope;
	LOC63[6] = symboloridrope;
	LOC63[7] = plainsymbolencrope;
	LOC63[8] = symboloridencrope;
	LOC65 = 0;
	LOC65 = ropeformatnamedvars_340162(LOC62, TMP4836, 9, LOC63, 9);
	add_161534(&(*d).toc[(k)- 0], LOC65);
	LOC66 = 0;
	LOC67 = 0;
	LOC67 = nosextractFilename((*d).Sup.filename);
	LOC68 = 0;
	LOC68 = noschangeFileExt(LOC67, ((NimStringDesc*) &TMP2092));
	LOC66 = rawNewString(LOC68->Sup.len + 3);
appendString(LOC66, LOC68);
appendString(LOC66, ((NimStringDesc*) &TMP4837));
	linktitle = LOC66;
	{
		NIM_BOOL LOC71;
		NimStringDesc* LOC74;
		NimStringDesc* LOC75;
		LOC71 = 0;
		LOC71 = iscallable_340911(n);
		if (!LOC71) goto LA72;
		LOC74 = 0;
		LOC74 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
		LOC75 = 0;
		LOC75 = escape_332066(LOC74);
		linktitle = resizeString(linktitle, LOC75->Sup.len + 0);
appendString(linktitle, LOC75);
	}
	goto LA69;
	LA72: ;
	{
		NimStringDesc* LOC77;
		NimStringDesc* LOC78;
		LOC77 = 0;
		LOC77 = nsuStrip(complexsymbol, NIM_TRUE, NIM_TRUE);
		LOC78 = 0;
		LOC78 = escape_332066(LOC77);
		linktitle = resizeString(linktitle, LOC78->Sup.len + 0);
appendString(linktitle, LOC78);
	}
	LA69: ;
	LOC79 = 0;
	LOC79 = &d->Sup;
	LOC80 = 0;
	LOC80 = docstringsummary_340921(plaindocstring);
	LOC81 = 0;
	LOC81 = escape_332066(LOC80);
	setindexterm_311855(LOC79, symbolorid, name, linktitle, LOC81);
	}BeforeRet: ;
}

N_NIMCALL(NIM_BOOL, checkforfalse_341171)(Tnode190813* n) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*n).kind == ((NU8) 2));
	if (!(LOC1)) goto LA2;
	LOC1 = identeq_167484((*n).kindU.S5.ident, ((NimStringDesc*) &TMP4840));
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(void, tracedeps_341191)(Tdocumentor340007* d, Tnode190813* n) {
	TY161572 LOC5;
	NimStringDesc* LOC6;
	{
		if (!!(((*d).section[(((NU8) 6))- 0] == NIM_NIL))) goto LA3;
		add_161545(&(*d).section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4841));
	}
	LA3: ;
	memset((void*)LOC5, 0, sizeof(LOC5));
	LOC6 = 0;
	LOC6 = getmodulename_251018(n);
	LOC5[0] = rope_161320(LOC6);
	dispa_340097(&(*d).section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4842), ((NimStringDesc*) &TMP4820), LOC5, 1);
}

N_NIMCALL(void, generatedoc_341218)(Tdocumentor340007* d, Tnode190813* n) {
	switch ((*n).kind) {
	case ((NU8) 125):
	{
		NimStringDesc* LOC2;
		LOC2 = 0;
		LOC2 = gencomment_340354(d, n);
		add_161545(&(*d).moddesc, LOC2);
	}
	break;
	case ((NU8) 79):
	{
		documentraises_326822(n);
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_326822(n);
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_326822(n);
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_326822(n);
		genitem_341012(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 16));
	}
	break;
	case ((NU8) 98):
	case ((NU8) 99):
	case ((NU8) 100):
	case ((NU8) 101):
	{
		{
			NI i_342014;
			NI HEX3Atmp_342087;
			NI LOC11;
			NI res_342090;
			i_342014 = 0;
			HEX3Atmp_342087 = 0;
			LOC11 = 0;
			LOC11 = sonslen_193403(n);
			HEX3Atmp_342087 = (NI)(LOC11 - ((NI) 1));
			res_342090 = ((NI) 0);
			{
				while (1) {
					if (!(res_342090 <= HEX3Atmp_342087)) goto LA13;
					i_342014 = res_342090;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_342014]).kind == ((NU8) 125)))) goto LA16;
						genitem_341012(d, (*n).kindU.S6.sons->data[i_342014], (*(*n).kindU.S6.sons->data[i_342014]).kindU.S6.sons->data[((NI) 0)], (NU8)(((NU8) 7) + ((NI) ((NI)(((NI) ((*n).kind)) - ((NI) 98))))));
					}
					LA16: ;
					res_342090 += ((NI) 1);
				} LA13: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		{
			NI i_342068;
			NI HEX3Atmp_342095;
			NI LOC20;
			NI res_342098;
			i_342068 = 0;
			HEX3Atmp_342095 = 0;
			LOC20 = 0;
			LOC20 = sonslen_193403(n);
			HEX3Atmp_342095 = (NI)(LOC20 - ((NI) 1));
			res_342098 = ((NI) 0);
			{
				while (1) {
					if (!(res_342098 <= HEX3Atmp_342095)) goto LA22;
					i_342068 = res_342098;
					generatedoc_341218(d, (*n).kindU.S6.sons->data[i_342068]);
					res_342098 += ((NI) 1);
				} LA22: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC26;
			Tnode190813* LOC29;
			LOC26 = 0;
			LOC26 = checkforfalse_341171((*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S6.sons->data[((NI) 0)]);
			if (!!(LOC26)) goto LA27;
			LOC29 = 0;
			LOC29 = lastson_193431((*n).kindU.S6.sons->data[((NI) 0)]);
			generatedoc_341218(d, LOC29);
		}
		LA27: ;
	}
	break;
	case ((NU8) 116):
	{
		{
			NI i_342083;
			NI HEX3Atmp_342103;
			NI LOC32;
			NI res_342106;
			i_342083 = 0;
			HEX3Atmp_342103 = 0;
			LOC32 = 0;
			LOC32 = sonslen_193403(n);
			HEX3Atmp_342103 = (NI)(LOC32 - ((NI) 1));
			res_342106 = ((NI) 0);
			{
				while (1) {
					if (!(res_342106 <= HEX3Atmp_342103)) goto LA34;
					i_342083 = res_342106;
					tracedeps_341191(d, (*n).kindU.S6.sons->data[i_342083]);
					res_342106 += ((NI) 1);
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 120):
	case ((NU8) 117):
	{
		tracedeps_341191(d, (*n).kindU.S6.sons->data[((NI) 0)]);
	}
	break;
	default:
	{
	}
	break;
	}
}

N_NIMCALL(void, gensection_342918)(Tdocumentor340007* d, NU8 kind) {
	Ropeobj161009* title;
	NimStringDesc* LOC5;
	TY462566 LOC6;
	NimStringDesc* LOC7;
	TY462566 LOC8;
{	{
		if (!((*d).section[(kind)- 0] == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	title = rope_161320(sectionnames_342922[(kind)- 6]);
	LOC5 = 0;
	LOC5 = getconfigvar_154334(((NimStringDesc*) &TMP4858));
	memset((void*)LOC6, 0, sizeof(LOC6));
	LOC6[0] = rope_161407(((NI64) (kind)));
	LOC6[1] = title;
	LOC6[2] = rope_161407(((NI64) ((NI)(((NI) (kind)) + ((NI) 50)))));
	LOC6[3] = (*d).section[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).section[(kind)- 0]), ropeformatnamedvars_340162(LOC5, TMP4859, 4, LOC6, 4));
	LOC7 = 0;
	LOC7 = getconfigvar_154334(((NimStringDesc*) &TMP4864));
	memset((void*)LOC8, 0, sizeof(LOC8));
	LOC8[0] = rope_161407(((NI64) (kind)));
	LOC8[1] = title;
	LOC8[2] = rope_161407(((NI64) ((NI)(((NI) (kind)) + ((NI) 50)))));
	LOC8[3] = (*d).toc[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).toc[(kind)- 0]), ropeformatnamedvars_340162(LOC7, TMP4859, 4, LOC8, 4));
	}BeforeRet: ;
}

N_NIMCALL(Ropeobj161009*, genoutfile_342988)(Tdocumentor340007* d) {
	Ropeobj161009* result;
	Ropeobj161009* code;
	Ropeobj161009* content;
	NimStringDesc* title;
	NI j;
	NimStringDesc* tmp;
	Trstgenerator311016* LOC1;
	Ropeobj161009* toc;
	NimStringDesc* bodyname;
	NimStringDesc* LOC28;
	TY464247 LOC29;
	NimStringDesc* LOC30;
	NimStringDesc* LOC31;
	result = 0;
	code = 0;
	content = 0;
	title = copyString(((NimStringDesc*) &TMP2092));
	j = ((NI) 0);
	tmp = copyString(((NimStringDesc*) &TMP2092));
	LOC1 = 0;
	LOC1 = &d->Sup;
	rendertocentries_317176(LOC1, (&j), ((NI) 1), (&tmp));
	toc = rope_161320(tmp);
	{
		NU8 i_343223;
		NI res_343283;
		i_343223 = 0;
		res_343283 = ((NI) 0);
		{
			while (1) {
				if (!(res_343283 <= ((NI) 25))) goto LA4;
				i_343223 = ((NU8) (res_343283));
				gensection_342918(d, i_343223);
				add_161534(&toc, (*d).toc[(i_343223)- 0]);
				res_343283 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		NimStringDesc* LOC9;
		TY161572 LOC10;
		if (!!((toc == NIM_NIL))) goto LA7;
		LOC9 = 0;
		LOC9 = getconfigvar_154334(((NimStringDesc*) &TMP4865));
		memset((void*)LOC10, 0, sizeof(LOC10));
		LOC10[0] = toc;
		toc = ropeformatnamedvars_340162(LOC9, TMP4866, 1, LOC10, 1);
	}
	LA7: ;
	{
		NU8 i_343255;
		NI res_343291;
		i_343255 = 0;
		res_343291 = ((NI) 0);
		{
			while (1) {
				if (!(res_343291 <= ((NI) 25))) goto LA13;
				i_343255 = ((NU8) (res_343291));
				add_161534(&code, (*d).section[(i_343255)- 0]);
				res_343291 += ((NI) 1);
			} LA13: ;
		}
	}
	{
		Trstgenerator311016* LOC18;
		if (!!((((*d).Sup.meta[(((NU8) 1))- 0] ? (*d).Sup.meta[(((NU8) 1))- 0]->Sup.len : 0) == ((NI) 0)))) goto LA16;
		title = copyString((*d).Sup.meta[(((NU8) 1))- 0]);
		LOC18 = 0;
		LOC18 = &d->Sup;
		setindexterm_311855(LOC18, ((NimStringDesc*) &TMP2092), title, ((NimStringDesc*) &TMP2092), ((NimStringDesc*) &TMP2092));
	}
	goto LA14;
	LA16: ;
	{
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		NimStringDesc* LOC22;
		LOC20 = 0;
		LOC21 = 0;
		LOC21 = noschangeFileExt((*d).Sup.filename, ((NimStringDesc*) &TMP2092));
		LOC22 = 0;
		LOC22 = nosextractFilename(LOC21);
		LOC20 = rawNewString(LOC22->Sup.len + 7);
appendString(LOC20, ((NimStringDesc*) &TMP4867));
appendString(LOC20, LOC22);
		title = LOC20;
	}
	LA14: ;
	{
		if (!(*d).Sup.hastoc) goto LA25;
		bodyname = copyString(((NimStringDesc*) &TMP4868));
	}
	goto LA23;
	LA25: ;
	{
		bodyname = copyString(((NimStringDesc*) &TMP4869));
	}
	LA23: ;
	LOC28 = 0;
	LOC28 = getconfigvar_154334(bodyname);
	memset((void*)LOC29, 0, sizeof(LOC29));
	LOC29[0] = rope_161320(title);
	LOC29[1] = toc;
	LOC29[2] = (*d).moddesc;
	LOC30 = 0;
	LOC30 = ntgetDateStr();
	LOC29[3] = rope_161320(LOC30);
	LOC31 = 0;
	LOC31 = ntgetClockStr();
	LOC29[4] = rope_161320(LOC31);
	LOC29[5] = code;
	content = ropeformatnamedvars_340162(LOC28, TMP4870, 6, LOC29, 6);
	{
		NimStringDesc* LOC36;
		TY341113 LOC37;
		NimStringDesc* LOC38;
		NimStringDesc* LOC39;
		if (!!(((gglobaloptions_154128 &(1<<((((NU8) 4))&31)))!=0))) goto LA34;
		LOC36 = 0;
		LOC36 = getconfigvar_154334(((NimStringDesc*) &TMP4876));
		memset((void*)LOC37, 0, sizeof(LOC37));
		LOC37[0] = rope_161320(title);
		LOC37[1] = toc;
		LOC37[2] = (*d).moddesc;
		LOC38 = 0;
		LOC38 = ntgetDateStr();
		LOC37[3] = rope_161320(LOC38);
		LOC39 = 0;
		LOC39 = ntgetClockStr();
		LOC37[4] = rope_161320(LOC39);
		LOC37[5] = content;
		LOC37[6] = rope_161320((*d).Sup.meta[(((NU8) 3))- 0]);
		LOC37[7] = rope_161320((*d).Sup.meta[(((NU8) 4))- 0]);
		LOC37[8] = rope_161320((*d).analytics);
		code = ropeformatnamedvars_340162(LOC36, TMP4877, 9, LOC37, 9);
	}
	goto LA32;
	LA34: ;
	{
		code = content;
	}
	LA32: ;
	result = code;
	return result;
}

N_NIMCALL(void, writeoutput_343337)(Tdocumentor340007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning) {
	Ropeobj161009* content;
	content = genoutfile_342988(d);
	{
		if (!((gglobaloptions_154128 &(1<<((((NU8) 22))&31)))!=0)) goto LA3;
		writerope_162070(stdout, content);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		LOC6 = 0;
		LOC6 = getoutfile_154354(filename, outext);
		writerope_162105(content, LOC6, usewarning);
	}
	LA1: ;
}

N_NIMCALL(void, generateindex_343318)(Tdocumentor340007* d) {
	{
		Trstgenerator311016* LOC5;
		NimStringDesc* LOC6;
		TY119589 LOC7;
		TY119589 LOC8;
		NimStringDesc* LOC9;
		if (!((gglobaloptions_154128 &(1<<((((NU8) 26))&31)))!=0)) goto LA3;
		LOC5 = 0;
		LOC5 = &d->Sup;
		LOC6 = 0;
		memset((void*)(&LOC7), 0, sizeof(LOC7));
		nossplitFile(outfile_154134, (&LOC7));
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		nossplitFile((*d).Sup.filename, (&LOC8));
		LOC9 = 0;
		LOC9 = HEX2F_119292(LOC7.Field0, LOC8.Field1);
		LOC6 = rawNewString(LOC9->Sup.len + 4);
appendString(LOC6, LOC9);
appendString(LOC6, ((NimStringDesc*) &TMP4882));
		writeindexfile_311445(LOC5, LOC6);
	}
	LA3: ;
}

N_NIMCALL(void, commanddoc_343360)(void) {
	Tnode190813* ast;
	Tdocumentor340007* d;
{	ast = parsefile_218041(gprojectmainidx_154237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_340065(gprojectfull_154236, gconfigvars_154231);
	(*d).Sup.hastoc = NIM_TRUE;
	generatedoc_341218(d, ast);
	writeoutput_343337(d, gprojectfull_154236, ((NimStringDesc*) &TMP4881), NIM_FALSE);
	generateindex_343318(d);
	}BeforeRet: ;
}

N_NIMCALL(void, commandrstaux_343382)(NimStringDesc* filename, NimStringDesc* outext) {
	NimStringDesc* filen;
	Tdocumentor340007* d;
	Trstnode296011* rst;
	NimStringDesc* LOC1;
	NimStringDesc* moddesc;
	Trstgenerator311016* LOC2;
	filen = nosaddFileExt(filename, ((NimStringDesc*) &TMP4888));
	d = newdocumentor_340065(filen, gconfigvars_154231);
	LOC1 = 0;
	LOC1 = readfile_13434(filen);
	rst = parserst_340049(LOC1, filen, ((NI) 0), ((NI) 1), (&(*d).Sup.hastoc), 4);
	moddesc = rawNewString(((NI) 30000));
	LOC2 = 0;
	LOC2 = &d->Sup;
	renderrsttoout_311724(LOC2, rst, (&moddesc));
	asgnRefNoCycle((void**) (&(*d).moddesc), rope_161320(moddesc));
	writeoutput_343337(d, filename, outext, NIM_FALSE);
	generateindex_343318(d);
}

N_NIMCALL(void, commandrst2html_343400)(void) {
	commandrstaux_343382(gprojectfull_154236, ((NimStringDesc*) &TMP4881));
}

N_NIMCALL(void, commandrst2tex_343408)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_311489; splitter_311489 = copyStringRC1(((NimStringDesc*) &TMP4890));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	commandrstaux_343382(gprojectfull_154236, ((NimStringDesc*) &TMP4891));
}

N_NIMCALL(Jsonnodeobj289726*, genjsonitem_341141)(Tdocumentor340007* d, Tnode190813* n, Tnode190813* namenode, NU8 k) {
	Jsonnodeobj289726* result;
	NimStringDesc* name;
	NimStringDesc* comm;
	Ropeobj161009* LOC6;
	Tsrcgen212023 r;
	TY341153 LOC7;
{	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_340658(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_340755(d, namenode, ((NI) -1));
	LOC6 = 0;
	LOC6 = genreccomment_340385(d, n);
	comm = HEX24_162131(LOC6);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_212067((&r), n, 14);
	memset((void*)LOC7, 0, sizeof(LOC7));
	LOC7[0].Field0 = copyString(((NimStringDesc*) &TMP4825));
	LOC7[0].Field1 = HEX25_290130(name);
	LOC7[1].Field0 = copyString(((NimStringDesc*) &TMP4900));
	LOC7[1].Field1 = HEX25_290130(reprEnum(k, (&NTI190441)));
	result = HEX25_290206(LOC7, 2);
	{
		NIM_BOOL LOC10;
		Jsonnodeobj289726* LOC14;
		LOC10 = 0;
		LOC10 = !((comm == NIM_NIL));
		if (!(LOC10)) goto LA11;
		LOC10 = !(((comm) && (comm)->Sup.len == 0));
		LA11: ;
		if (!LOC10) goto LA12;
		LOC14 = 0;
		LOC14 = HEX25_290130(comm);
		HEX5BHEX5DHEX3D_292619(result, ((NimStringDesc*) &TMP4901), LOC14);
	}
	LA12: ;
	{
		Jsonnodeobj289726* LOC19;
		if (!!((r.buf == NIM_NIL))) goto LA17;
		LOC19 = 0;
		LOC19 = HEX25_290130(r.buf);
		HEX5BHEX5DHEX3D_292619(result, ((NimStringDesc*) &TMP4902), LOC19);
	}
	LA17: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Jsonnodeobj289726*, generatejson_342143)(Tdocumentor340007* d, Tnode190813* n, Jsonnodeobj289726* jarray) {
	Jsonnodeobj289726* result;
	result = 0;
	switch ((*n).kind) {
	case ((NU8) 125):
	{
		{
			NIM_BOOL LOC4;
			NimStringDesc* stripped;
			NimStringDesc* LOC8;
			TY342153 LOC9;
			LOC4 = 0;
			LOC4 = !(((*n).comment == NIM_NIL));
			if (!(LOC4)) goto LA5;
			LOC4 = nsuStartsWith((*n).comment, ((NimStringDesc*) &TMP2091));
			LA5: ;
			if (!LOC4) goto LA6;
			LOC8 = 0;
			LOC8 = copyStr((*n).comment, ((NI) 2));
			stripped = nsuStrip(LOC8, NIM_TRUE, NIM_TRUE);
			memset((void*)LOC9, 0, sizeof(LOC9));
			LOC9[0].Field0 = copyString(((NimStringDesc*) &TMP4899));
			LOC9[0].Field1 = HEX25_290130(stripped);
			result = HEX25_290206(LOC9, 1);
		}
		LA6: ;
	}
	break;
	case ((NU8) 79):
	{
		documentraises_326822(n);
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_326822(n);
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_326822(n);
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_326822(n);
		result = genjsonitem_341141(d, n, (*n).kindU.S6.sons->data[((NI) 0)], ((NU8) 16));
	}
	break;
	case ((NU8) 98):
	case ((NU8) 99):
	case ((NU8) 100):
	case ((NU8) 101):
	{
		{
			NI i_342814;
			NI HEX3Atmp_342879;
			NI LOC18;
			NI res_342882;
			i_342814 = 0;
			HEX3Atmp_342879 = 0;
			LOC18 = 0;
			LOC18 = sonslen_193403(n);
			HEX3Atmp_342879 = (NI)(LOC18 - ((NI) 1));
			res_342882 = ((NI) 0);
			{
				while (1) {
					if (!(res_342882 <= HEX3Atmp_342879)) goto LA20;
					i_342814 = res_342882;
					{
						if (!!(((*(*n).kindU.S6.sons->data[i_342814]).kind == ((NU8) 125)))) goto LA23;
						result = genjsonitem_341141(d, (*n).kindU.S6.sons->data[i_342814], (*(*n).kindU.S6.sons->data[i_342814]).kindU.S6.sons->data[((NI) 0)], (NU8)(((NU8) 7) + ((NI) ((NI)(((NI) ((*n).kind)) - ((NI) 98))))));
					}
					LA23: ;
					res_342882 += ((NI) 1);
				} LA20: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		{
			NIM_BOOL LOC28;
			LOC28 = 0;
			LOC28 = HEX3DHEX3D_290661(jarray, NIM_NIL);
			if (!!(LOC28)) goto LA29;
			result = jarray;
		}
		goto LA26;
		LA29: ;
		{
			result = newjarray_289927();
		}
		LA26: ;
		{
			NI i_342869;
			NI HEX3Atmp_342887;
			NI LOC33;
			NI res_342890;
			i_342869 = 0;
			HEX3Atmp_342887 = 0;
			LOC33 = 0;
			LOC33 = sonslen_193403(n);
			HEX3Atmp_342887 = (NI)(LOC33 - ((NI) 1));
			res_342890 = ((NI) 0);
			{
				while (1) {
					Jsonnodeobj289726* r;
					if (!(res_342890 <= HEX3Atmp_342887)) goto LA35;
					i_342869 = res_342890;
					r = generatejson_342143(d, (*n).kindU.S6.sons->data[i_342869], result);
					{
						NIM_BOOL LOC38;
						LOC38 = 0;
						LOC38 = HEX3DHEX3D_290661(r, NIM_NIL);
						if (!!(LOC38)) goto LA39;
						add_292247(result, r);
					}
					LA39: ;
					res_342890 += ((NI) 1);
				} LA35: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC44;
			NIM_BOOL LOC45;
			NIM_BOOL LOC47;
			Tnode190813* LOC50;
			Jsonnodeobj289726* LOC51;
			LOC44 = 0;
			LOC45 = 0;
			LOC45 = checkforfalse_341171((*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S6.sons->data[((NI) 0)]);
			LOC44 = !(LOC45);
			if (!(LOC44)) goto LA46;
			LOC47 = 0;
			LOC47 = HEX3DHEX3D_290661(jarray, NIM_NIL);
			LOC44 = !(LOC47);
			LA46: ;
			if (!LOC44) goto LA48;
			LOC50 = 0;
			LOC50 = lastson_193431((*n).kindU.S6.sons->data[((NI) 0)]);
			LOC51 = 0;
			LOC51 = generatejson_342143(d, LOC50, jarray);
		}
		LA48: ;
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

N_NIMCALL(void, commandjson_343416)(void) {
	Tnode190813* ast;
	Tdocumentor340007* d;
	Jsonnodeobj289726* json;
	Ropeobj161009* content;
	NimStringDesc* LOC5;
{	ast = parsefile_218041(gprojectmainidx_154237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_340065(gprojectfull_154236, gconfigvars_154231);
	(*d).Sup.hastoc = NIM_TRUE;
	json = generatejson_342143(d, ast, NIM_NIL);
	LOC5 = 0;
	LOC5 = pretty_293446(json, ((NI) 2));
	content = rope_161320(LOC5);
	{
		if (!((gglobaloptions_154128 &(1<<((((NU8) 22))&31)))!=0)) goto LA8;
		writerope_162070(stdout, content);
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC11;
		NimStringDesc* LOC12;
		LOC11 = 0;
		LOC11 = getoutfile_154354(gprojectfull_154236, ((NimStringDesc*) &TMP4912));
		printf("%s\012", LOC11? (LOC11)->data:"nil");
		LOC12 = 0;
		LOC12 = getoutfile_154354(gprojectfull_154236, ((NimStringDesc*) &TMP4912));
		writerope_162105(content, LOC12, NIM_FALSE);
	}
	LA6: ;
	}BeforeRet: ;
}

N_NIMCALL(void, commandbuildindex_343452)(void) {
	Ropeobj161009* content;
	NimStringDesc* LOC1;
	Ropeobj161009* code;
	NimStringDesc* LOC2;
	TY341113 LOC3;
	NimStringDesc* LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	LOC1 = 0;
	LOC1 = mergeindexes_316740(gprojectfull_154236);
	content = rope_161320(LOC1);
	LOC2 = 0;
	LOC2 = getconfigvar_154334(((NimStringDesc*) &TMP4876));
	memset((void*)LOC3, 0, sizeof(LOC3));
	LOC3[0] = rope_161320(((NimStringDesc*) &TMP4952));
	LOC3[1] = NIM_NIL;
	LOC3[2] = NIM_NIL;
	LOC4 = 0;
	LOC4 = ntgetDateStr();
	LOC3[3] = rope_161320(LOC4);
	LOC5 = 0;
	LOC5 = ntgetClockStr();
	LOC3[4] = rope_161320(LOC5);
	LOC3[5] = content;
	LOC3[6] = NIM_NIL;
	LOC3[7] = NIM_NIL;
	LOC3[8] = NIM_NIL;
	code = ropeformatnamedvars_340162(LOC2, TMP4877, 9, LOC3, 9);
	LOC6 = 0;
	LOC6 = getoutfile_154354(((NimStringDesc*) &TMP4953), ((NimStringDesc*) &TMP4881));
	writerope_162105(code, LOC6, NIM_FALSE);
}
NIM_EXTERNC N_NOINLINE(void, nimsrc_docgenInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, nimsrc_docgenDatInit)(void) {
static TNimNode* TMP4764[7];
static TNimNode TMP878[8];
NTI340007.size = sizeof(Tdocumentor340007);
NTI340007.kind = 17;
NTI340007.base = (&NTI311016);
TMP4764[0] = &TMP878[1];
TMP878[1].kind = 1;
TMP878[1].offset = offsetof(Tdocumentor340007, moddesc);
TMP878[1].typ = (&NTI161007);
TMP878[1].name = "modDesc";
TMP4764[1] = &TMP878[2];
TMP878[2].kind = 1;
TMP878[2].offset = offsetof(Tdocumentor340007, id);
TMP878[2].typ = (&NTI108);
TMP878[2].name = "id";
TMP4764[2] = &TMP878[3];
NTI340005.size = sizeof(Tsections340005);
NTI340005.kind = 16;
NTI340005.base = (&NTI161007);
NTI340005.flags = 2;
TMP878[3].kind = 1;
TMP878[3].offset = offsetof(Tdocumentor340007, toc);
TMP878[3].typ = (&NTI340005);
TMP878[3].name = "toc";
TMP4764[3] = &TMP878[4];
TMP878[4].kind = 1;
TMP878[4].offset = offsetof(Tdocumentor340007, section);
TMP878[4].typ = (&NTI340005);
TMP878[4].name = "section";
TMP4764[4] = &TMP878[5];
TMP878[5].kind = 1;
TMP878[5].offset = offsetof(Tdocumentor340007, indexvalfilename);
TMP878[5].typ = (&NTI149);
TMP878[5].name = "indexValFilename";
TMP4764[5] = &TMP878[6];
TMP878[6].kind = 1;
TMP878[6].offset = offsetof(Tdocumentor340007, analytics);
TMP878[6].typ = (&NTI149);
TMP878[6].name = "analytics";
TMP4764[6] = &TMP878[7];
TMP878[7].kind = 1;
TMP878[7].offset = offsetof(Tdocumentor340007, seensymbols);
TMP878[7].typ = (&NTI134014);
TMP878[7].name = "seenSymbols";
TMP878[0].len = 7; TMP878[0].kind = 2; TMP878[0].sons = &TMP4764[0];
NTI340007.node = &TMP878[0];
NTI340009.size = sizeof(Tdocumentor340007*);
NTI340009.kind = 22;
NTI340009.base = (&NTI340007);
NTI340009.marker = TMP4765;
}

