/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 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 tsym226846 tsym226846;
typedef struct tdocumentor401007 tdocumentor401007;
typedef struct tnode226816 tnode226816;
typedef struct ttype226852 ttype226852;
typedef struct tlineinfo196539 tlineinfo196539;
typedef struct tident201021 tident201021;
typedef struct tnodeseq226810 tnodeseq226810;
typedef struct tidobj201015 tidobj201015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq226848 ttypeseq226848;
typedef struct tscope226840 tscope226840;
typedef struct TY226947 TY226947;
typedef struct tinstantiation226836 tinstantiation226836;
typedef struct tstrtable226820 tstrtable226820;
typedef struct tsymseq226818 tsymseq226818;
typedef struct tloc226830 tloc226830;
typedef struct trope178009 trope178009;
typedef struct tlib226834 tlib226834;
typedef struct trstgenerator359016 trstgenerator359016;
typedef struct trstnode343011 trstnode343011;
typedef struct stringtableobj131012 stringtableobj131012;
typedef struct TY359034 TY359034;
typedef struct ttocentry359012 ttocentry359012;
typedef struct table359052 table359052;
typedef struct keyvaluepairseq359055 keyvaluepairseq359055;
typedef struct keyvaluepair359058 keyvaluepair359058;
typedef struct tcell44933 tcell44933;
typedef struct tcellset44945 tcellset44945;
typedef struct tgcheap47016 tgcheap47016;
typedef struct tcellseq44949 tcellseq44949;
typedef struct tpagedesc44941 tpagedesc44941;
typedef struct tmemregion27210 tmemregion27210;
typedef struct tsmallchunk26440 tsmallchunk26440;
typedef struct tllchunk27204 tllchunk27204;
typedef struct tbigchunk26442 tbigchunk26442;
typedef struct tintset26417 tintset26417;
typedef struct ttrunk26413 ttrunk26413;
typedef struct tavlnode27208 tavlnode27208;
typedef struct tgcstat47014 tgcstat47014;
typedef struct tsrcgen251023 tsrcgen251023;
typedef struct trendertokseq251021 trendertokseq251021;
typedef struct trendertok251019 trendertok251019;
typedef struct TY117604 TY117604;
typedef struct jsonnodeobj337042 jsonnodeobj337042;
typedef struct TY337611 TY337611;
typedef struct TY226936 TY226936;
typedef struct tlistentry127022 tlistentry127022;
typedef struct trstnodeseq343009 trstnodeseq343009;
typedef struct keyvaluepairseq131010 keyvaluepairseq131010;
typedef struct keyvaluepair131008 keyvaluepair131008;
typedef struct tbasechunk26438 tbasechunk26438;
typedef struct tfreecell26430 tfreecell26430;
typedef struct TY337057 TY337057;
typedef struct TY337062 TY337062;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tlineinfo196539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tnode226816  {
ttype226852* Typ;
tlineinfo196539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym226846* Sym;
} S4;
struct {tident201021* Ident;
} S5;
struct {tnodeseq226810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef N_NIMCALL_PTR(void, TY3089) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3094) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3089 marker;
TY3094 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj201015  {
  TNimObject Sup;
NI Id;
};
struct  tstrtable226820  {
NI Counter;
tsymseq226818* Data;
};
struct  tloc226830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype226852* T;
trope178009* R;
trope178009* Heaproot;
};
struct  tsym226846  {
  tidobj201015 Sup;
NU8 Kind;
union {
struct {ttypeseq226848* Typeinstcache;
tscope226840* Typscope;
} S1;
struct {TY226947* Procinstcache;
tscope226840* Scope;
} S2;
struct {TY226947* Usedgenerics;
tstrtable226820 Tab;
} S3;
struct {tsym226846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype226852* Typ;
tident201021* Name;
tlineinfo196539 Info;
tsym226846* Owner;
NU32 Flags;
tnode226816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc226830 Loc;
tlib226834* Annex;
tnode226816* Constraint;
};
typedef N_NIMCALL_PTR(NimStringDesc*, tfindfilehandler344023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, tmsghandler344021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
struct  ttocentry359012  {
trstnode343011* N;
NimStringDesc* Refname;
NimStringDesc* Header;
};
typedef NimStringDesc* TY359042[5];
struct keyvaluepair359058 {
NU8 Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  table359052  {
keyvaluepairseq359055* Data;
NI Counter;
};
struct  trstgenerator359016  {
  TNimObject Sup;
NU8 Target;
stringtableobj131012* Config;
NI Splitafter;
TY359034* Tocpart;
NIM_BOOL Hastoc;
NimStringDesc* Theindex;
NU8 Options;
tfindfilehandler344023 Findfile;
tmsghandler344021 Msghandler;
NimStringDesc* Filename;
TY359042 Meta;
NimStringDesc* Currentsection;
table359052 Seenindexterms;
};
typedef trope178009* tsections401005[26];
struct  tdocumentor401007  {
  trstgenerator359016 Sup;
trope178009* Moddesc;
NI Id;
tsections401005 Toc;
tsections401005 Section;
NimStringDesc* Indexvalfilename;
stringtableobj131012* Seensymbols;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tcell44933  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq44949  {
NI Len;
NI Cap;
tcell44933** D;
};
struct  tcellset44945  {
NI Counter;
NI Max;
tpagedesc44941* Head;
tpagedesc44941** Data;
};
typedef tsmallchunk26440* TY27222[512];
typedef ttrunk26413* ttrunkbuckets26415[256];
struct  tintset26417  {
ttrunkbuckets26415 Data;
};
struct  tmemregion27210  {
NI Minlargeobj;
NI Maxlargeobj;
TY27222 Freesmallchunks;
tllchunk27204* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26442* Freechunkslist;
tintset26417 Chunkstarts;
tavlnode27208* Root;
tavlnode27208* Deleted;
tavlnode27208* Last;
tavlnode27208* Freeavlnodes;
};
struct  tgcstat47014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq44949 Zct;
tcellseq44949 Decstack;
tcellset44945 Cycleroots;
tcellseq44949 Tempstack;
NI Recgclock;
tmemregion27210 Region;
tgcstat47014 Stat;
};
struct  tident201021  {
  tidobj201015 Sup;
NimStringDesc* S;
tident201021* Next;
NI H;
};
struct  trendertok251019  {
NU8 Kind;
NI16 Length;
};
struct  tsrcgen251023  {
NI Indent;
NI Linelen;
NI Pos;
NI Idx;
trendertokseq251021* Tokens;
NimStringDesc* Buf;
NI Pendingnl;
tnodeseq226810* Comstack;
NU8 Flags;
NIM_BOOL Checkanon;
NI Inpragma;
};
typedef trope178009* TY178515[1];
typedef NimStringDesc* TY170969[2];
typedef trope178009* TY589896[2];
typedef NimStringDesc* TY209063[3];
typedef trope178009* TY555018[3];
typedef NimStringDesc* TY402547[10];
typedef trope178009* TY402549[10];
typedef NimStringDesc* TY402556[9];
typedef trope178009* TY402558[9];
typedef NU8 TY212607[32];
typedef NimStringDesc* TY404644[13];
typedef NimStringDesc* TY198620[4];
typedef trope178009* TY557045[4];
typedef NimStringDesc* TY198301[1];
typedef NimStringDesc* TY484908[6];
typedef trope178009* TY559098[6];
typedef NimStringDesc* TY404853[8];
typedef trope178009* TY404855[8];
struct TY117604 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct TY337611 {
NimStringDesc* Field0;
jsonnodeobj337042* Field1;
};
typedef TY337611 TY403693[1];
typedef TY337611 TY402609[2];
struct  ttype226852  {
  tidobj201015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq226848* Sons;
tnode226816* N;
tsym226846* Owner;
tsym226846* Sym;
tsym226846* Destructor;
tsym226846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc226830 Loc;
};
struct  tscope226840  {
NI Depthlevel;
tstrtable226820 Symbols;
tnodeseq226810* Usingsyms;
tscope226840* Parent;
};
struct  tinstantiation226836  {
tsym226846* Sym;
ttypeseq226848* Concretetypes;
TY226936* Usedby;
};
struct  trope178009  {
  TNimObject Sup;
trope178009* Left;
trope178009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib226834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope178009* Name;
tnode226816* Path;
};
struct  trstnode343011  {
NU8 Kind;
NimStringDesc* Text;
NI Level;
trstnodeseq343009* Sons;
};
struct keyvaluepair131008 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct  stringtableobj131012  {
  TNimObject Sup;
NI Counter;
keyvaluepairseq131010* Data;
NU8 Mode;
};
typedef NI TY26420[16];
struct  tpagedesc44941  {
tpagedesc44941* Next;
NI Key;
TY26420 Bits;
};
struct  tbasechunk26438  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26440  {
  tbasechunk26438 Sup;
tsmallchunk26440* Next;
tsmallchunk26440* Prev;
tfreecell26430* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27204  {
NI Size;
NI Acc;
tllchunk27204* Next;
};
struct  tbigchunk26442  {
  tbasechunk26438 Sup;
tbigchunk26442* Next;
tbigchunk26442* Prev;
NI Align;
NF Data;
};
struct  ttrunk26413  {
ttrunk26413* Next;
NI Key;
TY26420 Bits;
};
typedef tavlnode27208* TY27214[2];
struct  tavlnode27208  {
TY27214 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  jsonnodeobj337042  {
NU8 Kind;
union {
struct {NimStringDesc* Str;
} S1;
struct {NI64 Num;
} S2;
struct {NF Fnum;
} S3;
struct {NIM_BOOL Bval;
} S4;
struct {TY337057* Fields;
} S6;
struct {TY337062* Elems;
} S7;
} kindU;
};
struct  tfreecell26430  {
tfreecell26430* Next;
NI Zerofield;
};
struct tnodeseq226810 {
  TGenericSeq Sup;
  tnode226816* data[SEQ_DECL_SIZE];
};
struct ttypeseq226848 {
  TGenericSeq Sup;
  ttype226852* data[SEQ_DECL_SIZE];
};
struct TY226947 {
  TGenericSeq Sup;
  tinstantiation226836* data[SEQ_DECL_SIZE];
};
struct tsymseq226818 {
  TGenericSeq Sup;
  tsym226846* data[SEQ_DECL_SIZE];
};
struct TY359034 {
  TGenericSeq Sup;
  ttocentry359012 data[SEQ_DECL_SIZE];
};
struct keyvaluepairseq359055 {
  TGenericSeq Sup;
  keyvaluepair359058 data[SEQ_DECL_SIZE];
};
struct trendertokseq251021 {
  TGenericSeq Sup;
  trendertok251019 data[SEQ_DECL_SIZE];
};
struct TY226936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct trstnodeseq343009 {
  TGenericSeq Sup;
  trstnode343011* data[SEQ_DECL_SIZE];
};
struct keyvaluepairseq131010 {
  TGenericSeq Sup;
  keyvaluepair131008 data[SEQ_DECL_SIZE];
};
struct TY337057 {
  TGenericSeq Sup;
  TY337611 data[SEQ_DECL_SIZE];
};
struct TY337062 {
  TGenericSeq Sup;
  jsonnodeobj337042* data[SEQ_DECL_SIZE];
};
N_NIMCALL(tnode226816*, finddoccomment_401635)(tnode226816* n);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
static N_INLINE(NI, safelen_227424)(tnode226816* n);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, renderrsttoout_359579)(trstgenerator359016* d, trstnode343011* n, NimStringDesc** result);
N_NIMCALL(trstnode343011*, parserst_401048)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions);
N_NIMCALL(trstnode343011*, rstparse_352164)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 options, tfindfilehandler344023 findfile, tmsghandler344021 msghandler);
N_NIMCALL(NimStringDesc*, docgenfindfile_401038)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, findfile_171356)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, HEX2F_117299)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(void, compilermsghandler_401022)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
N_NIMCALL(void, globalerror_198934)(tlineinfo196539 info, NU16 msg, NimStringDesc* arg);
static N_INLINE(tlineinfo196539, newlineinfo_197141)(NimStringDesc* filename, NI line, NI col);
N_NIMCALL(tlineinfo196539, newlineinfo_197129)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(NI32, fileinfoidx_196747)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_198025)(NI32 fileidx);
static N_INLINE(NI, tolinenumber_198073)(tlineinfo196539 info);
static N_INLINE(NI, tocolumn_198083)(tlineinfo196539 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(tnode226816*, parsefile_261041)(NI32 fileidx);
N_NIMCALL(tdocumentor401007*, newdocumentor_401064)(NimStringDesc* filename, stringtableobj131012* config);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP4633)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initrstgenerator_359088)(trstgenerator359016* g, NU8 target, stringtableobj131012* config, NimStringDesc* filename, NU8 options, tfindfilehandler344023 findfile, tmsghandler344021 msghandler);
N_NIMCALL(stringtableobj131012*, nstnewStringTable)(NU8 mode);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_51025)(tcell44933* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44933* c);
static N_INLINE(void, rtladdcycleroot_49429)(tcell44933* c);
N_NOINLINE(void, incl_45671)(tcellset44945* s, tcell44933* cell);
static N_INLINE(tcell44933*, usrtocell_48646)(void* usr);
static N_INLINE(void, decref_50604)(tcell44933* c);
static N_INLINE(void, rtladdzct_50204)(tcell44933* c);
N_NOINLINE(void, addzct_48617)(tcellseq44949* s, tcell44933* c);
N_NIMCALL(void, generatedoc_402685)(tdocumentor401007* d, tnode226816* n);
N_NIMCALL(void, app_178060)(trope178009** a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, gencomment_401398)(tdocumentor401007* d, tnode226816* n);
N_NIMCALL(void, documentraises_380621)(tnode226816* n);
N_NIMCALL(void, genitem_402416)(tdocumentor401007* d, tnode226816* n, tnode226816* namenode, NU8 k);
N_NIMCALL(NIM_BOOL, isvisible_401778)(tnode226816* n);
static N_INLINE(NI, len_227364)(tnode226816* n);
N_NIMCALL(NimStringDesc*, getname_401948)(tdocumentor401007* d, tnode226816* n, NI splitafter);
N_NIMCALL(NimStringDesc*, esc_359407)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NimStringDesc*, renderdefinitionname_251134)(tsym226846* s, NIM_BOOL noquotes);
static N_INLINE(tnode226816*, HEX5BHEX5D_227698)(tnode226816* n, NI i);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(void, internalerror_198987)(tlineinfo196539 info, NimStringDesc* errmsg);
N_NIMCALL(trope178009*, torope_178076)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, getplaindocstring_401550)(tnode226816* n);
N_NIMCALL(trope178009*, genreccomment_401432)(tdocumentor401007* d, tnode226816* n);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void, inittokrender_251067)(tsrcgen251023* r, tnode226816* n, NU8 renderflags);
N_NIMCALL(void, getnexttok_251078)(tsrcgen251023* r, NU8* kind, NimStringDesc** literal);
N_NIMCALL(void, dispa_401103)(trope178009** dest, NimStringDesc* xml, NimStringDesc* tex, trope178009** args, NI argsLen0);
N_NIMCALL(void, appf_178115)(trope178009** c, NimStringDesc* frmt, trope178009** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, escape_392893)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, renderplainsymbolname_398013)(tnode226816* n);
N_NIMCALL(NimStringDesc*, complexname_402201)(NU8 k, tnode226816* n, NimStringDesc* basename);
N_NIMCALL(NimStringDesc*, renderparamtypes_400862)(tnode226816* n, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, encodeurl_396004)(NimStringDesc* s);
N_NIMCALL(trope178009*, torope_178082)(NI64 i);
N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_402170)(tdocumentor401007* d, NimStringDesc* original);
N_NIMCALL(NIM_BOOL, nsthasKey)(stringtableobj131012* t, NimStringDesc* key);
N_NIMCALL(void, nstPut)(stringtableobj131012* t, NimStringDesc* key, NimStringDesc* val);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, getconfigvar_170350)(NimStringDesc* key);
N_NIMCALL(trope178009*, ropeformatnamedvars_401166)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope178009** varvalues, NI varvaluesLen0);
N_NIMCALL(void, app_178052)(trope178009** a, trope178009* b);
N_NIMCALL(void, internalerror_199006)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NI, getvaridx_401126)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, rawmessage_198733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_74828, 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_402223)(tnode226816* n);
N_NIMCALL(void, setindexterm_359710)(trstgenerator359016* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc);
N_NIMCALL(NimStringDesc*, docstringsummary_402233)(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, TY212607 chars, NI start);
static N_INLINE(NI, sonslen_227249)(tnode226816* n);
N_NIMCALL(NIM_BOOL, checkforfalse_402618)(tnode226816* n);
N_NIMCALL(NIM_BOOL, identeq_201493)(tident201021* id, NimStringDesc* name);
static N_INLINE(tnode226816*, lastson_227261)(tnode226816* n);
N_NIMCALL(void, tracedeps_402651)(tdocumentor401007* d, tnode226816* n);
N_NIMCALL(NimStringDesc*, getmodulename_299018)(tnode226816* n);
N_NIMCALL(void, writeoutput_404920)(tdocumentor401007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning);
N_NIMCALL(trope178009*, genoutfile_404722)(tdocumentor401007* d);
N_NIMCALL(void, rendertocentries_365554)(trstgenerator359016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, gensection_404639)(tdocumentor401007* d, NU8 kind);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, ntgetDateStr)(void);
N_NIMCALL(NimStringDesc*, ntgetClockStr)(void);
N_NIMCALL(void, writerope_179065)(FILE* f, trope178009* c);
N_NIMCALL(void, writerope_179423)(trope178009* head, NimStringDesc* filename, NIM_BOOL usewarning);
N_NIMCALL(NimStringDesc*, getoutfile_170370)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(void, generateindex_404897)(tdocumentor401007* d);
N_NIMCALL(void, writeindexfile_359287)(trstgenerator359016* g, NimStringDesc* outfile);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY117604* Result);
N_NIMCALL(void, commandrstaux_404973)(NimStringDesc* filename, NimStringDesc* outext);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, readfile_12842)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(jsonnodeobj337042*, generatejson_403683)(tdocumentor401007* d, tnode226816* n, jsonnodeobj337042* jarray);
N_NIMCALL(jsonnodeobj337042*, HEX25_337608)(TY337611* keyvals, NI keyvalsLen0);
N_NIMCALL(jsonnodeobj337042*, HEX25_337448)(NimStringDesc* s);
N_NIMCALL(jsonnodeobj337042*, genjsonitem_402586)(tdocumentor401007* d, tnode226816* n, tnode226816* namenode, NU8 k);
N_NIMCALL(NimStringDesc*, ropetostr_178101)(trope178009* p);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_80907, TNimType* typ);
N_NIMCALL(void, HEX5BHEX5DHEX3D_340240)(jsonnodeobj337042* obj, NimStringDesc* key, jsonnodeobj337042* val);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_337893)(jsonnodeobj337042* a, jsonnodeobj337042* b);
N_NIMCALL(jsonnodeobj337042*, newjarray_337389)(void);
N_NIMCALL(void, add_339862)(jsonnodeobj337042* father, jsonnodeobj337042* child);
N_NIMCALL(trope178009*, newrope_178176)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, pretty_341621)(jsonnodeobj337042* node, NI indent);
N_NIMCALL(NimStringDesc*, mergeindexes_365149)(NimStringDesc* dir);
STRING_LITERAL(TMP2111, "##", 2);
STRING_LITERAL(TMP2112, "", 0);
STRING_LITERAL(TMP2631, "\012##", 3);
STRING_LITERAL(TMP2632, "\012", 1);
STRING_LITERAL(TMP4638, "`", 1);
STRING_LITERAL(TMP4639, "getName()", 9);
STRING_LITERAL(TMP4640, "<span class=\"Comment\">$1</span>", 31);
STRING_LITERAL(TMP4641, "\\spanComment{$1}", 16);
STRING_LITERAL(TMP4642, "<span class=\"Keyword\">$1</span>", 31);
STRING_LITERAL(TMP4643, "\\spanKeyword{$1}", 16);
STRING_LITERAL(TMP4644, "<span class=\"Operator\">$1</span>", 32);
STRING_LITERAL(TMP4645, "\\spanOperator{$1}", 17);
STRING_LITERAL(TMP4646, "<span class=\"StringLit\">$1</span>", 33);
STRING_LITERAL(TMP4647, "\\spanStringLit{$1}", 18);
STRING_LITERAL(TMP4648, "<span class=\"CharLit\">$1</span>", 31);
STRING_LITERAL(TMP4649, "\\spanCharLit{$1}", 16);
STRING_LITERAL(TMP4650, "<span class=\"DecNumber\">$1</span>", 33);
STRING_LITERAL(TMP4651, "\\spanDecNumber{$1}", 18);
STRING_LITERAL(TMP4652, "<span class=\"FloatNumber\">$1</span>", 35);
STRING_LITERAL(TMP4653, "\\spanFloatNumber{$1}", 20);
STRING_LITERAL(TMP4654, "<span class=\"Identifier\">$1</span>", 34);
STRING_LITERAL(TMP4655, "\\spanIdentifier{$1}", 19);
STRING_LITERAL(TMP4656, "<span class=\"Other\">$1</span>", 29);
STRING_LITERAL(TMP4657, "\\spanOther{$1}", 14);
STRING_LITERAL(TMP4667, ",", 1);
STRING_LITERAL(TMP4668, ".m,", 3);
STRING_LITERAL(TMP4669, ".e,", 3);
STRING_LITERAL(TMP4670, ".i,", 3);
STRING_LITERAL(TMP4671, ".t,", 3);
STRING_LITERAL(TMP4672, ".c,", 3);
STRING_LITERAL(TMP4678, "_", 1);
STRING_LITERAL(TMP4679, "doc.item.seesrc", 15);
STRING_LITERAL(TMP4680, "$", 1);
STRING_LITERAL(TMP4681, "ropeFormatNamedVars", 19);
STRING_LITERAL(TMP4682, "}", 1);
STRING_LITERAL(TMP4684, "path", 4);
STRING_LITERAL(TMP4685, "line", 4);
NIM_CONST TY170969 TMP4683 = {((NimStringDesc*) &TMP4684),
((NimStringDesc*) &TMP4685)}
;
STRING_LITERAL(TMP4686, "$1", 2);
STRING_LITERAL(TMP4688, "url", 3);
NIM_CONST TY209063 TMP4687 = {((NimStringDesc*) &TMP4684),
((NimStringDesc*) &TMP4685),
((NimStringDesc*) &TMP4688)}
;
STRING_LITERAL(TMP4689, "doc.item", 8);
STRING_LITERAL(TMP4691, "name", 4);
STRING_LITERAL(TMP4692, "header", 6);
STRING_LITERAL(TMP4693, "desc", 4);
STRING_LITERAL(TMP4694, "itemID", 6);
STRING_LITERAL(TMP4695, "header_plain", 12);
STRING_LITERAL(TMP4696, "itemSym", 7);
STRING_LITERAL(TMP4697, "itemSymOrID", 11);
STRING_LITERAL(TMP4698, "itemSymEnc", 10);
STRING_LITERAL(TMP4699, "itemSymOrIDEnc", 14);
STRING_LITERAL(TMP4700, "seeSrc", 6);
NIM_CONST TY402547 TMP4690 = {((NimStringDesc*) &TMP4691),
((NimStringDesc*) &TMP4692),
((NimStringDesc*) &TMP4693),
((NimStringDesc*) &TMP4694),
((NimStringDesc*) &TMP4695),
((NimStringDesc*) &TMP4696),
((NimStringDesc*) &TMP4697),
((NimStringDesc*) &TMP4698),
((NimStringDesc*) &TMP4699),
((NimStringDesc*) &TMP4700)}
;
STRING_LITERAL(TMP4701, "doc.item.toc", 12);
NIM_CONST TY402556 TMP4702 = {((NimStringDesc*) &TMP4691),
((NimStringDesc*) &TMP4692),
((NimStringDesc*) &TMP4693),
((NimStringDesc*) &TMP4694),
((NimStringDesc*) &TMP4695),
((NimStringDesc*) &TMP4696),
((NimStringDesc*) &TMP4697),
((NimStringDesc*) &TMP4698),
((NimStringDesc*) &TMP4699)}
;
STRING_LITERAL(TMP4703, " : ", 3);
STRING_LITERAL(TMP4704, "\342\200\246", 3);
static NIM_CONST TY212607 TMP4705 = {
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(TMP4706, "false", 5);
STRING_LITERAL(TMP4707, ", ", 2);
STRING_LITERAL(TMP4708, "<a class=\"reference external\" href=\"$1.html\">$1</a>", 51);
STRING_LITERAL(TMP4713, "Imports", 7);
STRING_LITERAL(TMP4714, "Types", 5);
STRING_LITERAL(TMP4715, "Vars", 4);
STRING_LITERAL(TMP4716, "Lets", 4);
STRING_LITERAL(TMP4717, "Consts", 6);
STRING_LITERAL(TMP4718, "Procs", 5);
STRING_LITERAL(TMP4719, "Methods", 7);
STRING_LITERAL(TMP4720, "Iterators", 9);
STRING_LITERAL(TMP4721, "Converters", 10);
STRING_LITERAL(TMP4722, "Macros", 6);
STRING_LITERAL(TMP4723, "Templates", 9);
NIM_CONST TY404644 sectionnames_404643 = {((NimStringDesc*) &TMP4713),
((NimStringDesc*) &TMP4714),
((NimStringDesc*) &TMP4715),
((NimStringDesc*) &TMP4716),
((NimStringDesc*) &TMP4717),
((NimStringDesc*) &TMP4715),
((NimStringDesc*) &TMP4718),
((NimStringDesc*) &TMP4719),
((NimStringDesc*) &TMP4720),
((NimStringDesc*) &TMP4720),
((NimStringDesc*) &TMP4721),
((NimStringDesc*) &TMP4722),
((NimStringDesc*) &TMP4723)}
;
STRING_LITERAL(TMP4724, "doc.section", 11);
STRING_LITERAL(TMP4726, "sectionid", 9);
STRING_LITERAL(TMP4727, "sectionTitle", 12);
STRING_LITERAL(TMP4728, "sectionTitleID", 14);
STRING_LITERAL(TMP4729, "content", 7);
NIM_CONST TY198620 TMP4725 = {((NimStringDesc*) &TMP4726),
((NimStringDesc*) &TMP4727),
((NimStringDesc*) &TMP4728),
((NimStringDesc*) &TMP4729)}
;
STRING_LITERAL(TMP4730, "doc.section.toc", 15);
STRING_LITERAL(TMP4731, "doc.toc", 7);
NIM_CONST TY198301 TMP4732 = {((NimStringDesc*) &TMP4729)}
;
STRING_LITERAL(TMP4733, "Module ", 7);
STRING_LITERAL(TMP4734, "doc.body_toc", 12);
STRING_LITERAL(TMP4735, "doc.body_no_toc", 15);
STRING_LITERAL(TMP4737, "title", 5);
STRING_LITERAL(TMP4738, "tableofcontents", 15);
STRING_LITERAL(TMP4739, "moduledesc", 10);
STRING_LITERAL(TMP4740, "date", 4);
STRING_LITERAL(TMP4741, "time", 4);
NIM_CONST TY484908 TMP4736 = {((NimStringDesc*) &TMP4737),
((NimStringDesc*) &TMP4738),
((NimStringDesc*) &TMP4739),
((NimStringDesc*) &TMP4740),
((NimStringDesc*) &TMP4741),
((NimStringDesc*) &TMP4729)}
;
STRING_LITERAL(TMP4742, "doc.file", 8);
STRING_LITERAL(TMP4744, "author", 6);
STRING_LITERAL(TMP4745, "version", 7);
NIM_CONST TY404853 TMP4743 = {((NimStringDesc*) &TMP4737),
((NimStringDesc*) &TMP4738),
((NimStringDesc*) &TMP4739),
((NimStringDesc*) &TMP4740),
((NimStringDesc*) &TMP4741),
((NimStringDesc*) &TMP4729),
((NimStringDesc*) &TMP4744),
((NimStringDesc*) &TMP4745)}
;
STRING_LITERAL(TMP4746, "html", 4);
STRING_LITERAL(TMP4747, ".idx", 4);
STRING_LITERAL(TMP4753, "txt", 3);
STRING_LITERAL(TMP4755, "\\-", 2);
STRING_LITERAL(TMP4756, "tex", 3);
STRING_LITERAL(TMP4764, "comment", 7);
STRING_LITERAL(TMP4765, "type", 4);
STRING_LITERAL(TMP4766, "description", 11);
STRING_LITERAL(TMP4767, "code", 4);
STRING_LITERAL(TMP4785, "json", 4);
STRING_LITERAL(TMP4825, "Index", 5);
STRING_LITERAL(TMP4826, "theindex", 8);
extern NI32 gprojectmainidx_170237;
extern TNimType NTI359016; /* TRstGenerator */
TNimType NTI401007; /* TDocumentor */
extern TNimType NTI178007; /* PRope */
extern TNimType NTI108; /* int */
TNimType NTI401005; /* TSections */
extern TNimType NTI149; /* string */
extern TNimType NTI131014; /* StringTableRef */
TNimType NTI401009; /* PDoc */
extern NU8 gcmd_170120;
extern stringtableobj131012* gconfigvars_170231;
extern tgcheap47016 gch_47044;
extern NimStringDesc* gprojectfull_170236;
extern NimStringDesc* docseesrcurl_170125;
extern NU32 gglobaloptions_170118;
extern NimStringDesc* outfile_170124;
extern NimStringDesc* splitter_359332;
extern TNimType NTI226445; /* TSymKind */

static N_INLINE(NI, safelen_227424)(tnode226816* 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 = 0;
	}
	goto LA1;
	LA5: ;
	{
		result = (*n).kindU.S6.Sons->Sup.len;
	}
	LA1: ;
	return result;
}

N_NIMCALL(tnode226816*, finddoccomment_401635)(tnode226816* n) {
	tnode226816* 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*) &TMP2111));
		LA8: ;
		if (!LOC7) goto LA9;
		result = n;
		goto BeforeRet;
	}
	LA9: ;
	{
		NI i_401668;
		NI HEX3Atmp_401701;
		NI LOC12;
		NI res_401704;
		i_401668 = 0;
		HEX3Atmp_401701 = 0;
		LOC12 = 0;
		LOC12 = safelen_227424(n);
		HEX3Atmp_401701 = (NI32)(LOC12 - 1);
		res_401704 = 0;
		{
			while (1) {
				if (!(res_401704 <= HEX3Atmp_401701)) goto LA14;
				i_401668 = res_401704;
				result = finddoccomment_401635((*n).kindU.S6.Sons->data[i_401668]);
				{
					if (!!((result == NIM_NIL))) goto LA17;
					goto BeforeRet;
				}
				LA17: ;
				res_401704 += 1;
			} LA14: ;
		}
	}
	BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, docgenfindfile_401038)(NimStringDesc* s) {
	NimStringDesc* result;
	result = 0;
	result = findfile_171356(s);
	{
		NimStringDesc* LOC5;
		if (!(result->Sup.len == 0)) goto LA3;
		LOC5 = 0;
		LOC5 = nosgetCurrentDir();
		result = HEX2F_117299(LOC5, s);
		{
			NIM_BOOL LOC8;
			LOC8 = 0;
			LOC8 = nosexistsFile(result);
			if (!!(LOC8)) goto LA9;
			result = copyString(((NimStringDesc*) &TMP2112));
		}
		LA9: ;
	}
	LA3: ;
	return result;
}

static N_INLINE(tlineinfo196539, newlineinfo_197141)(NimStringDesc* filename, NI line, NI col) {
	tlineinfo196539 result;
	NI32 LOC1;
	memset((void*)(&result), 0, sizeof(result));
	LOC1 = 0;
	LOC1 = fileinfoidx_196747(filename);
	result = newlineinfo_197129(LOC1, line, col);
	return result;
}

N_NIMCALL(void, compilermsghandler_401022)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg) {
	NU16 k;
	tlineinfo196539 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_197141(filename, line, col);
	globalerror_198934(LOC11, k, arg);
}

N_NIMCALL(trstnode343011*, parserst_401048)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions) {
	trstnode343011* result;
	result = 0;
	result = rstparse_352164(text, filename, line, column, hastoc, rstoptions, docgenfindfile_401038, compilermsghandler_401022);
	return result;
}

static N_INLINE(NI, tolinenumber_198073)(tlineinfo196539 info) {
	NI result;
	result = 0;
	result = ((NI) (info.Line));
	return result;
}

static N_INLINE(NI, tocolumn_198083)(tlineinfo196539 info) {
	NI result;
	result = 0;
	result = ((NI) (info.Col));
	return result;
}

N_NIMCALL(NimStringDesc*, extractdoccomment_401721)(tsym226846* s, tdocumentor401007* d) {
	NimStringDesc* result;
	tnode226816* n;
	result = 0;
	n = finddoccomment_401635((*s).Ast);
	result = copyString(((NimStringDesc*) &TMP2112));
	{
		if (!!(n == 0)) goto LA3;
		{
			NIM_BOOL dummyhastoc;
			trstgenerator359016* LOC9;
			NimStringDesc* LOC10;
			NI LOC11;
			NI LOC12;
			trstnode343011* LOC13;
			if (!!(d == 0)) goto LA7;
			dummyhastoc = 0;
			LOC9 = 0;
			LOC9 = &d->Sup;
			LOC10 = 0;
			LOC10 = tofilename_198025((*n).Info.Fileindex);
			LOC11 = 0;
			LOC11 = tolinenumber_198073((*n).Info);
			LOC12 = 0;
			LOC12 = tocolumn_198083((*n).Info);
			LOC13 = 0;
			LOC13 = parserst_401048((*n).Comment, LOC10, LOC11, LOC12, (&dummyhastoc), ((*d).Sup.Options | 1));
			renderrsttoout_359579(LOC9, LOC13, (&result));
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC15;
			NimStringDesc* LOC16;
			LOC15 = 0;
			LOC15 = copyStr((*n).Comment, 2);
			LOC16 = 0;
			LOC16 = nsuReplaceStr(LOC15, ((NimStringDesc*) &TMP2631), ((NimStringDesc*) &TMP2632));
			result = nsuStrip(LOC16, NIM_TRUE, NIM_TRUE);
		}
		LA5: ;
	}
	LA3: ;
	return result;
}
N_NIMCALL(void, TMP4633)(void* p, NI op) {
	tdocumentor401007* a;
	NI LOC1;
	NI LOC2;
	NI LOC3;
	a = (tdocumentor401007*)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).Seensymbols, op);
}

static N_INLINE(NIM_BOOL, canbecycleroot_48667)(tcell44933* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).Typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_49429)(tcell44933* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45671((&gch_47044.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_51025)(tcell44933* c) {
	(*c).Refcount = (NI)((NU32)((*c).Refcount) + (NU32)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48667(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49429(c);
	}
	LA4: ;
}

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

static N_INLINE(void, rtladdzct_50204)(tcell44933* c) {
	addzct_48617((&gch_47044.Zct), c);
}

static N_INLINE(void, decref_50604)(tcell44933* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48667(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49429(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell44933* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48646(src);
		incref_51025(LOC5);
	}
	LA3: ;
	{
		tcell44933* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48646((*dest));
		decref_50604(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(tdocumentor401007*, newdocumentor_401064)(NimStringDesc* filename, stringtableobj131012* config) {
	tdocumentor401007* result;
	trstgenerator359016* LOC1;
	NU8 LOC2;
	result = 0;
	result = (tdocumentor401007*) newObj((&NTI401009), sizeof(tdocumentor401007));
	(*result).Sup.Sup.m_type = (&NTI401007);
	LOC1 = 0;
	LOC1 = &result->Sup;
	LOC2 = 0;
	{
		if (!!((gcmd_170120 == ((NU8) 17)))) goto LA5;
		LOC2 = ((NU8) 0);
	}
	goto LA3;
	LA5: ;
	{
		LOC2 = ((NU8) 1);
	}
	LA3: ;
	initrstgenerator_359088(LOC1, LOC2, gconfigvars_170231, filename, 4, docgenfindfile_401038, compilermsghandler_401022);
	asgnRef((void**) (&(*result).Seensymbols), nstnewStringTable(((NU8) 1)));
	(*result).Id = 100;
	return result;
}

N_NIMCALL(NimStringDesc*, gencomment_401398)(tdocumentor401007* d, tnode226816* n) {
	NimStringDesc* result;
	NIM_BOOL dummyhastoc;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2112));
	dummyhastoc = 0;
	{
		NIM_BOOL LOC3;
		trstgenerator359016* LOC7;
		NimStringDesc* LOC8;
		NI LOC9;
		NI LOC10;
		trstnode343011* LOC11;
		LOC3 = 0;
		LOC3 = !(((*n).Comment == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP2111));
		LA4: ;
		if (!LOC3) goto LA5;
		LOC7 = 0;
		LOC7 = &d->Sup;
		LOC8 = 0;
		LOC8 = tofilename_198025((*n).Info.Fileindex);
		LOC9 = 0;
		LOC9 = tolinenumber_198073((*n).Info);
		LOC10 = 0;
		LOC10 = tocolumn_198083((*n).Info);
		LOC11 = 0;
		LOC11 = parserst_401048((*n).Comment, LOC8, LOC9, LOC10, (&dummyhastoc), ((*d).Sup.Options | 1));
		renderrsttoout_359579(LOC7, LOC11, (&result));
	}
	LA5: ;
	return result;
}

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

N_NIMCALL(NIM_BOOL, isvisible_401778)(tnode226816* n) {
	NIM_BOOL result;
	result = 0;
	result = NIM_FALSE;
	{
		if (!((*n).Kind == ((NU8) 31))) goto LA3;
		{
			NIM_BOOL LOC7;
			NI LOC8;
			tident201021* v;
			NIM_BOOL LOC12;
			LOC7 = 0;
			LOC8 = 0;
			LOC8 = len_227364(n);
			LOC7 = (LOC8 == 2);
			if (!(LOC7)) goto LA9;
			LOC7 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
			LA9: ;
			if (!LOC7) goto LA10;
			v = (*(*n).kindU.S6.Sons->data[0]).kindU.S5.Ident;
			LOC12 = 0;
			LOC12 = ((*v).Sup.Id == 75);
			if (LOC12) goto LA13;
			LOC12 = ((*v).Sup.Id == 76);
			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_401778((*n).kindU.S6.Sons->data[0]);
	}
	goto LA1;
	LA18: ;
	LA1: ;
	return result;
}

static N_INLINE(tnode226816*, HEX5BHEX5D_227698)(tnode226816* n, NI i) {
	tnode226816* 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)), (NI32)((*src).Sup.len + 1));
	(*dest).Sup.len += (*src).Sup.len;
}

N_NIMCALL(NimStringDesc*, getname_401948)(tdocumentor401007* d, tnode226816* n, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 31):
	{
		result = getname_401948(d, (*n).kindU.S6.Sons->data[1], splitafter);
	}
	break;
	case ((NU8) 43):
	{
		result = getname_401948(d, (*n).kindU.S6.Sons->data[0], splitafter);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC4;
		LOC4 = 0;
		LOC4 = renderdefinitionname_251134((*n).kindU.S4.Sym, NIM_FALSE);
		result = esc_359407((*d).Sup.Target, LOC4, splitafter);
	}
	break;
	case ((NU8) 2):
	{
		result = esc_359407((*d).Sup.Target, (*(*n).kindU.S5.Ident).S, splitafter);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* LOC13;
		result = esc_359407((*d).Sup.Target, ((NimStringDesc*) &TMP4638), -1);
		{
			NI i_402031;
			NI HEX3Atmp_402033;
			NI LOC8;
			NI res_402036;
			i_402031 = 0;
			HEX3Atmp_402033 = 0;
			LOC8 = 0;
			LOC8 = len_227364(n);
			HEX3Atmp_402033 = (LOC8 - 1);
			res_402036 = 0;
			{
				while (1) {
					tnode226816* LOC11;
					NimStringDesc* LOC12;
					if (!(res_402036 <= HEX3Atmp_402033)) goto LA10;
					i_402031 = res_402036;
					LOC11 = 0;
					LOC11 = HEX5BHEX5D_227698(n, i_402031);
					LOC12 = 0;
					LOC12 = getname_401948(d, LOC11, splitafter);
					result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
					res_402036 += 1;
				} LA10: ;
			}
		}
		LOC13 = 0;
		LOC13 = esc_359407((*d).Sup.Target, ((NimStringDesc*) &TMP4638), -1);
		result = resizeString(result, LOC13->Sup.len + 0);
appendString(result, LOC13);
	}
	break;
	default:
	{
		internalerror_198987((*n).Info, ((NimStringDesc*) &TMP4639));
		result = copyString(((NimStringDesc*) &TMP2112));
	}
	break;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, getplaindocstring_401550)(tnode226816* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2112));
	{
		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*) &TMP2111));
		LA8: ;
		if (!LOC7) goto LA9;
		result = copyString((*n).Comment);
	}
	LA9: ;
	{
		if (!(result->Sup.len < 1)) goto LA13;
		{
			if (!!(((*n).Kind >= ((NU8) 1) && (*n).Kind <= ((NU8) 23)))) goto LA17;
			{
				NI i_401598;
				NI HEX3Atmp_401615;
				NI LOC20;
				NI res_401618;
				i_401598 = 0;
				HEX3Atmp_401615 = 0;
				LOC20 = 0;
				LOC20 = len_227364(n);
				HEX3Atmp_401615 = (NI32)(LOC20 - 1);
				res_401618 = 0;
				{
					while (1) {
						if (!(res_401618 <= HEX3Atmp_401615)) goto LA22;
						i_401598 = res_401618;
						result = getplaindocstring_401550((*n).kindU.S6.Sons->data[i_401598]);
						{
							if (!(0 < result->Sup.len)) goto LA25;
							goto BeforeRet;
						}
						LA25: ;
						res_401618 += 1;
					} LA22: ;
				}
			}
		}
		LA17: ;
	}
	LA13: ;
	BeforeRet: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell44933* c;
	c = usrtocell_48646(p);
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_50204(c);
	}
	LA3: ;
}

N_NIMCALL(trope178009*, genreccomment_401432)(tdocumentor401007* d, tnode226816* n) {
	trope178009* result;
	NimStringDesc* LOC5;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = gencomment_401398(d, n);
	result = torope_178076(LOC5);
	{
		if (!(result == NIM_NIL)) goto LA8;
		{
			if (!!(((*n).Kind >= ((NU8) 1) && (*n).Kind <= ((NU8) 23)))) goto LA12;
			{
				NI i_401497;
				NI HEX3Atmp_401530;
				NI LOC15;
				NI res_401533;
				i_401497 = 0;
				HEX3Atmp_401530 = 0;
				LOC15 = 0;
				LOC15 = len_227364(n);
				HEX3Atmp_401530 = (NI32)(LOC15 - 1);
				res_401533 = 0;
				{
					while (1) {
						if (!(res_401533 <= HEX3Atmp_401530)) goto LA17;
						i_401497 = res_401533;
						result = genreccomment_401432(d, (*n).kindU.S6.Sons->data[i_401497]);
						{
							if (!!((result == NIM_NIL))) goto LA20;
							goto BeforeRet;
						}
						LA20: ;
						res_401533 += 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_401103)(trope178009** dest, NimStringDesc* xml, NimStringDesc* tex, trope178009** args, NI argsLen0) {
	{
		if (!!((gcmd_170120 == ((NU8) 17)))) goto LA3;
		appf_178115(dest, xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		appf_178115(dest, tex, args, argsLen0);
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, complexname_402201)(NU8 k, tnode226816* n, NimStringDesc* basename) {
	NimStringDesc* result;
	result = 0;
	result = copyString(basename);
	switch (k) {
	case ((NU8) 12):
	{
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP4667));
	}
	break;
	case ((NU8) 17):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4668));
	}
	break;
	case ((NU8) 13):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4669));
	}
	break;
	case ((NU8) 14):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4670));
	}
	break;
	case ((NU8) 18):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4671));
	}
	break;
	case ((NU8) 16):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4672));
	}
	break;
	default:
	{
	}
	break;
	}
	{
		NIM_BOOL LOC10;
		NI LOC11;
		tnode226816* LOC13;
		tnode226816* LOC16;
		NimStringDesc* LOC17;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = len_227364(n);
		LOC10 = (3 < LOC11);
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_227698(n, 3);
		LOC10 = ((*LOC13).Kind == ((NU8) 76));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_227698(n, 3);
		LOC17 = 0;
		LOC17 = renderparamtypes_400862(LOC16, ((NimStringDesc*) &TMP4667));
		result = resizeString(result, LOC17->Sup.len + 0);
appendString(result, LOC17);
	}
	LA14: ;
	return result;
}

N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_402170)(tdocumentor401007* 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*) &TMP2112));
		goto BeforeRet;
	}
	LA4: ;
	count = 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*) &TMP4678));
appendString(LOC8, LOC9);
			result = LOC8;
			{
				NIM_BOOL LOC12;
				LOC12 = 0;
				LOC12 = nsthasKey((*d).Seensymbols, result);
				if (!!(LOC12)) goto LA13;
				nstPut((*d).Seensymbols, result, ((NimStringDesc*) &TMP2112));
				goto LA6;
			}
			LA13: ;
			count += 1;
		}
	} LA6: ;
	BeforeRet: ;
	return result;
}

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

N_NIMCALL(trope178009*, ropeformatnamedvars_401166)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope178009** varvalues, NI varvaluesLen0) {
	trope178009* result;
	NI i;
	NI l;
	NI num;
	result = 0;
	i = 0;
	l = frmt->Sup.len;
	result = NIM_NIL;
	num = 0;
	{
		while (1) {
			NI start;
			if (!(i < l)) goto LA2;
			{
				if (!((NU8)(frmt->data[i]) == (NU8)(36))) goto LA5;
				i += 1;
				switch (((NU8)(frmt->data[i]))) {
				case 35:
				{
					app_178052(&result, varvalues[num]);
					num += 1;
					i += 1;
				}
				break;
				case 36:
				{
					app_178060(&result, ((NimStringDesc*) &TMP4680));
					i += 1;
				}
				break;
				case 48 ... 57:
				{
					NI j;
					j = 0;
					{
						while (1) {
							j = (NI32)((NI32)((NI32)(j * 10) + ((NI) (((NU8)(frmt->data[i]))))) - 48);
							i += 1;
							{
								NIM_BOOL LOC14;
								LOC14 = 0;
								LOC14 = ((NI32)((NI32)(l + 0) - 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 (!((NI32)((varvaluesLen0-1) + 1) < j)) goto LA20;
						internalerror_199006(((NimStringDesc*) &TMP4681));
					}
					LA20: ;
					num = j;
					app_178052(&result, varvalues[(NI32)(j - 1)]);
				}
				break;
				case 65 ... 90:
				case 97 ... 122:
				case 128 ... 255:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2112));
					{
						while (1) {
							id = addChar(id, frmt->data[i]);
							i += 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_401126(varnames, varnamesLen0, id);
					{
						if (!(0 <= idx)) goto LA31;
						app_178052(&result, varvalues[idx]);
					}
					goto LA29;
					LA31: ;
					{
						rawmessage_198733(((NU16) 152), id);
					}
					LA29: ;
				}
				break;
				case 123:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2112));
					i += 1;
					{
						while (1) {
							if (!!(((NU8)(frmt->data[i]) == (NU8)(125)))) goto LA36;
							{
								if (!((NU8)(frmt->data[i]) == (NU8)(0))) goto LA39;
								rawmessage_198733(((NU16) 23), ((NimStringDesc*) &TMP4682));
							}
							LA39: ;
							id = addChar(id, frmt->data[i]);
							i += 1;
						} LA36: ;
					}
					i += 1;
					idx = getvaridx_401126(varnames, varnamesLen0, id);
					{
						if (!(0 <= idx)) goto LA43;
						app_178052(&result, varvalues[idx]);
					}
					goto LA41;
					LA43: ;
					{
						rawmessage_198733(((NU16) 152), id);
					}
					LA41: ;
				}
				break;
				default:
				{
					internalerror_199006(((NimStringDesc*) &TMP4681));
				}
				break;
				}
			}
			LA5: ;
			start = i;
			{
				while (1) {
					if (!(i < l)) goto LA48;
					{
						if (!!(((NU8)(frmt->data[i]) == (NU8)(36)))) goto LA51;
						i += 1;
					}
					goto LA49;
					LA51: ;
					{
						goto LA47;
					}
					LA49: ;
				} LA48: ;
			} LA47: ;
			{
				NimStringDesc* LOC58;
				if (!(start <= (NI32)(i - 1))) goto LA56;
				LOC58 = 0;
				LOC58 = copyStrLast(frmt, start, (NI32)(i - 1));
				app_178060(&result, LOC58);
			}
			LA56: ;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NIM_BOOL, iscallable_402223)(tnode226816* 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_402233)(NimStringDesc* rsttext) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NI pos;
	NI last;
	result = 0;
	LOC1 = 0;
	LOC1 = copyStr(rsttext, 2);
	result = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE);
	pos = nsuFindChar(result, 10, 0);
	{
		if (!(0 < pos)) goto LA4;
		nsuDelete((&result), pos, (NI32)(result->Sup.len - 1));
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4704));
	}
	LA4: ;
	{
		if (!(pos < 100)) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	pos = nsuFindCharSet(result, TMP4705, 0);
	last = (NI32)(result->Sup.len - 1);
	{
		NIM_BOOL LOC12;
		LOC12 = 0;
		LOC12 = (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*) &TMP4704));
	}
	LA14: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, genitem_402416)(tdocumentor401007* d, tnode226816* n, tnode226816* namenode, NU8 k) {
	NimStringDesc* name;
	trope178009* namerope;
	NimStringDesc* plaindocstring;
	trope178009* result;
	NimStringDesc* literal;
	NimStringDesc* plainname;
	NU8 kind;
	trope178009* comm;
	tsrcgen251023 r;
	trope178009* plainnamerope;
	NimStringDesc* LOC42;
	NimStringDesc* LOC43;
	NimStringDesc* cleanplainsymbol;
	NimStringDesc* complexsymbol;
	trope178009* plainsymbolrope;
	trope178009* plainsymbolencrope;
	NimStringDesc* LOC44;
	trope178009* itemidrope;
	NimStringDesc* symbolorid;
	trope178009* symboloridrope;
	trope178009* symboloridencrope;
	NimStringDesc* LOC45;
	trope178009* seesrcrope;
	NimStringDesc* docitemseesrc;
	NimStringDesc* LOC59;
	TY402549 LOC60;
	trope178009* LOC61;
	NimStringDesc* LOC62;
	TY402558 LOC63;
	NimStringDesc* LOC64;
	trope178009* LOC65;
	NimStringDesc* linktitle;
	NimStringDesc* LOC66;
	NimStringDesc* LOC67;
	NimStringDesc* LOC68;
	trstgenerator359016* LOC79;
	NimStringDesc* LOC80;
	NimStringDesc* LOC81;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_401778(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_401948(d, namenode, -1);
	namerope = torope_178076(name);
	plaindocstring = getplaindocstring_401550(n);
	result = NIM_NIL;
	literal = copyString(((NimStringDesc*) &TMP2112));
	plainname = copyString(((NimStringDesc*) &TMP2112));
	kind = ((NU8) 1);
	comm = genreccomment_401432(d, n);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_251067((&r), n, 94);
	{
		while (1) {
			getnexttok_251078((&r), (&kind), (&literal));
			{
				if (!(kind == ((NU8) 1))) goto LA10;
				goto LA6;
			}
			LA10: ;
			plainname = resizeString(plainname, literal->Sup.len + 0);
appendString(plainname, literal);
		}
	} LA6: ;
	inittokrender_251067((&r), n, 14);
	{
		while (1) {
			getnexttok_251078((&r), (&kind), (&literal));
			switch (kind) {
			case ((NU8) 1):
			{
				goto LA12;
			}
			break;
			case ((NU8) 112):
			{
				TY178515 LOC16;
				NimStringDesc* LOC17;
				memset((void*)LOC16, 0, sizeof(LOC16));
				LOC17 = 0;
				LOC17 = esc_359407((*d).Sup.Target, literal, -1);
				LOC16[0] = torope_178076(LOC17);
				dispa_401103(&result, ((NimStringDesc*) &TMP4640), ((NimStringDesc*) &TMP4641), LOC16, 1);
			}
			break;
			case ((NU8) 3) ... ((NU8) 71):
			{
				TY178515 LOC19;
				memset((void*)LOC19, 0, sizeof(LOC19));
				LOC19[0] = torope_178076(literal);
				dispa_401103(&result, ((NimStringDesc*) &TMP4642), ((NimStringDesc*) &TMP4643), LOC19, 1);
			}
			break;
			case ((NU8) 111):
			{
				TY178515 LOC21;
				NimStringDesc* LOC22;
				memset((void*)LOC21, 0, sizeof(LOC21));
				LOC22 = 0;
				LOC22 = esc_359407((*d).Sup.Target, literal, -1);
				LOC21[0] = torope_178076(LOC22);
				dispa_401103(&result, ((NimStringDesc*) &TMP4644), ((NimStringDesc*) &TMP4645), LOC21, 1);
			}
			break;
			case ((NU8) 86) ... ((NU8) 88):
			{
				TY178515 LOC24;
				NimStringDesc* LOC25;
				memset((void*)LOC24, 0, sizeof(LOC24));
				LOC25 = 0;
				LOC25 = esc_359407((*d).Sup.Target, literal, -1);
				LOC24[0] = torope_178076(LOC25);
				dispa_401103(&result, ((NimStringDesc*) &TMP4646), ((NimStringDesc*) &TMP4647), LOC24, 1);
			}
			break;
			case ((NU8) 91):
			{
				TY178515 LOC27;
				NimStringDesc* LOC28;
				memset((void*)LOC27, 0, sizeof(LOC27));
				LOC28 = 0;
				LOC28 = esc_359407((*d).Sup.Target, literal, -1);
				LOC27[0] = torope_178076(LOC28);
				dispa_401103(&result, ((NimStringDesc*) &TMP4648), ((NimStringDesc*) &TMP4649), LOC27, 1);
			}
			break;
			case ((NU8) 72) ... ((NU8) 81):
			{
				TY178515 LOC30;
				NimStringDesc* LOC31;
				memset((void*)LOC30, 0, sizeof(LOC30));
				LOC31 = 0;
				LOC31 = esc_359407((*d).Sup.Target, literal, -1);
				LOC30[0] = torope_178076(LOC31);
				dispa_401103(&result, ((NimStringDesc*) &TMP4650), ((NimStringDesc*) &TMP4651), LOC30, 1);
			}
			break;
			case ((NU8) 82) ... ((NU8) 85):
			{
				TY178515 LOC33;
				NimStringDesc* LOC34;
				memset((void*)LOC33, 0, sizeof(LOC33));
				LOC34 = 0;
				LOC34 = esc_359407((*d).Sup.Target, literal, -1);
				LOC33[0] = torope_178076(LOC34);
				dispa_401103(&result, ((NimStringDesc*) &TMP4652), ((NimStringDesc*) &TMP4653), LOC33, 1);
			}
			break;
			case ((NU8) 2):
			{
				TY178515 LOC36;
				NimStringDesc* LOC37;
				memset((void*)LOC36, 0, sizeof(LOC36));
				LOC37 = 0;
				LOC37 = esc_359407((*d).Sup.Target, literal, -1);
				LOC36[0] = torope_178076(LOC37);
				dispa_401103(&result, ((NimStringDesc*) &TMP4654), ((NimStringDesc*) &TMP4655), LOC36, 1);
			}
			break;
			case ((NU8) 114):
			case ((NU8) 0):
			{
				app_178060(&result, literal);
			}
			break;
			case ((NU8) 92):
			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) 108):
			case ((NU8) 109):
			case ((NU8) 110):
			case ((NU8) 113):
			case ((NU8) 107):
			case ((NU8) 89):
			case ((NU8) 90):
			case ((NU8) 115):
			case ((NU8) 116):
			case ((NU8) 117):
			{
				TY178515 LOC40;
				NimStringDesc* LOC41;
				memset((void*)LOC40, 0, sizeof(LOC40));
				LOC41 = 0;
				LOC41 = esc_359407((*d).Sup.Target, literal, -1);
				LOC40[0] = torope_178076(LOC41);
				dispa_401103(&result, ((NimStringDesc*) &TMP4656), ((NimStringDesc*) &TMP4657), LOC40, 1);
			}
			break;
			}
		}
	} LA12: ;
	(*d).Id += 1;
	LOC42 = 0;
	LOC42 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
	LOC43 = 0;
	LOC43 = escape_392893(LOC42);
	plainnamerope = torope_178076(LOC43);
	cleanplainsymbol = renderplainsymbolname_398013(namenode);
	complexsymbol = complexname_402201(k, n, cleanplainsymbol);
	plainsymbolrope = torope_178076(cleanplainsymbol);
	LOC44 = 0;
	LOC44 = encodeurl_396004(cleanplainsymbol);
	plainsymbolencrope = torope_178076(LOC44);
	itemidrope = torope_178082(((NI64) ((*d).Id)));
	symbolorid = newuniqueplainsymbol_402170(d, complexsymbol);
	symboloridrope = torope_178076(symbolorid);
	LOC45 = 0;
	LOC45 = encodeurl_396004(symbolorid);
	symboloridencrope = torope_178076(LOC45);
	seesrcrope = NIM_NIL;
	docitemseesrc = getconfigvar_170350(((NimStringDesc*) &TMP4679));
	{
		NIM_BOOL LOC48;
		trope178009* urlrope;
		TY589896 LOC52;
		NimStringDesc* LOC53;
		NimStringDesc* LOC54;
		TY178515 LOC55;
		TY555018 LOC56;
		NimStringDesc* LOC57;
		NimStringDesc* LOC58;
		LOC48 = 0;
		LOC48 = (0 < docitemseesrc->Sup.len);
		if (!(LOC48)) goto LA49;
		LOC48 = (0 < docseesrcurl_170125->Sup.len);
		LA49: ;
		if (!LOC48) goto LA50;
		memset((void*)LOC52, 0, sizeof(LOC52));
		LOC53 = 0;
		LOC53 = tofilename_198025((*n).Info.Fileindex);
		LOC52[0] = torope_178076(LOC53);
		LOC54 = 0;
		LOC54 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC52[1] = torope_178076(LOC54);
		urlrope = ropeformatnamedvars_401166(docseesrcurl_170125, TMP4683, 2, LOC52, 2);
		memset((void*)LOC55, 0, sizeof(LOC55));
		memset((void*)LOC56, 0, sizeof(LOC56));
		LOC57 = 0;
		LOC57 = tofilename_198025((*n).Info.Fileindex);
		LOC56[0] = torope_178076(LOC57);
		LOC58 = 0;
		LOC58 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC56[1] = torope_178076(LOC58);
		LOC56[2] = urlrope;
		LOC55[0] = ropeformatnamedvars_401166(docitemseesrc, TMP4687, 3, LOC56, 3);
		dispa_401103(&seesrcrope, ((NimStringDesc*) &TMP4686), ((NimStringDesc*) &TMP2112), LOC55, 1);
	}
	LA50: ;
	LOC59 = 0;
	LOC59 = getconfigvar_170350(((NimStringDesc*) &TMP4689));
	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_401166(LOC59, TMP4690, 10, LOC60, 10);
	app_178052(&(*d).Section[(k)- 0], LOC61);
	LOC62 = 0;
	LOC62 = getconfigvar_170350(((NimStringDesc*) &TMP4701));
	memset((void*)LOC63, 0, sizeof(LOC63));
	LOC64 = 0;
	LOC64 = getname_401948(d, namenode, (*d).Sup.Splitafter);
	LOC63[0] = torope_178076(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_401166(LOC62, TMP4702, 9, LOC63, 9);
	app_178052(&(*d).Toc[(k)- 0], LOC65);
	LOC66 = 0;
	LOC67 = 0;
	LOC67 = nosextractFilename((*d).Sup.Filename);
	LOC68 = 0;
	LOC68 = noschangeFileExt(LOC67, ((NimStringDesc*) &TMP2112));
	LOC66 = rawNewString(LOC68->Sup.len + 3);
appendString(LOC66, LOC68);
appendString(LOC66, ((NimStringDesc*) &TMP4703));
	linktitle = LOC66;
	{
		NIM_BOOL LOC71;
		NimStringDesc* LOC74;
		NimStringDesc* LOC75;
		LOC71 = 0;
		LOC71 = iscallable_402223(n);
		if (!LOC71) goto LA72;
		LOC74 = 0;
		LOC74 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
		LOC75 = 0;
		LOC75 = escape_392893(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_392893(LOC77);
		linktitle = resizeString(linktitle, LOC78->Sup.len + 0);
appendString(linktitle, LOC78);
	}
	LA69: ;
	LOC79 = 0;
	LOC79 = &d->Sup;
	LOC80 = 0;
	LOC80 = docstringsummary_402233(plaindocstring);
	LOC81 = 0;
	LOC81 = escape_392893(LOC80);
	setindexterm_359710(LOC79, symbolorid, name, linktitle, LOC81);
	BeforeRet: ;
}

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

N_NIMCALL(NIM_BOOL, checkforfalse_402618)(tnode226816* n) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*n).Kind == ((NU8) 2));
	if (!(LOC1)) goto LA2;
	LOC1 = identeq_201493((*n).kindU.S5.Ident, ((NimStringDesc*) &TMP4706));
	LA2: ;
	result = LOC1;
	return result;
}

static N_INLINE(tnode226816*, lastson_227261)(tnode226816* n) {
	tnode226816* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = sonslen_227249(n);
	result = (*n).kindU.S6.Sons->data[(NI32)(LOC1 - 1)];
	return result;
}

N_NIMCALL(void, tracedeps_402651)(tdocumentor401007* d, tnode226816* n) {
	TY178515 LOC5;
	NimStringDesc* LOC6;
	{
		if (!!(((*d).Section[(((NU8) 6))- 0] == NIM_NIL))) goto LA3;
		app_178060(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4707));
	}
	LA3: ;
	memset((void*)LOC5, 0, sizeof(LOC5));
	LOC6 = 0;
	LOC6 = getmodulename_299018(n);
	LOC5[0] = torope_178076(LOC6);
	dispa_401103(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4708), ((NimStringDesc*) &TMP4686), LOC5, 1);
}

N_NIMCALL(void, generatedoc_402685)(tdocumentor401007* d, tnode226816* n) {
	switch ((*n).Kind) {
	case ((NU8) 125):
	{
		NimStringDesc* LOC2;
		LOC2 = 0;
		LOC2 = gencomment_401398(d, n);
		app_178060(&(*d).Moddesc, LOC2);
	}
	break;
	case ((NU8) 79):
	{
		documentraises_380621(n);
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_380621(n);
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_380621(n);
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_380621(n);
		genitem_402416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 16));
	}
	break;
	case ((NU8) 98):
	case ((NU8) 99):
	case ((NU8) 100):
	case ((NU8) 101):
	{
		{
			NI i_403427;
			NI HEX3Atmp_403633;
			NI LOC11;
			NI res_403636;
			i_403427 = 0;
			HEX3Atmp_403633 = 0;
			LOC11 = 0;
			LOC11 = sonslen_227249(n);
			HEX3Atmp_403633 = (NI32)(LOC11 - 1);
			res_403636 = 0;
			{
				while (1) {
					if (!(res_403636 <= HEX3Atmp_403633)) goto LA13;
					i_403427 = res_403636;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_403427]).Kind == ((NU8) 125)))) goto LA16;
						genitem_402416(d, (*n).kindU.S6.Sons->data[i_403427], (*(*n).kindU.S6.Sons->data[i_403427]).kindU.S6.Sons->data[0], (((NU8) 7) + ((NI) ((NI32)(((NI) ((*n).Kind)) - 98)))));
					}
					LA16: ;
					res_403636 += 1;
				} LA13: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		{
			NI i_403536;
			NI HEX3Atmp_403639;
			NI LOC20;
			NI res_403642;
			i_403536 = 0;
			HEX3Atmp_403639 = 0;
			LOC20 = 0;
			LOC20 = sonslen_227249(n);
			HEX3Atmp_403639 = (NI32)(LOC20 - 1);
			res_403642 = 0;
			{
				while (1) {
					if (!(res_403642 <= HEX3Atmp_403639)) goto LA22;
					i_403536 = res_403642;
					generatedoc_402685(d, (*n).kindU.S6.Sons->data[i_403536]);
					res_403642 += 1;
				} LA22: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC26;
			tnode226816* LOC29;
			LOC26 = 0;
			LOC26 = checkforfalse_402618((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			if (!!(LOC26)) goto LA27;
			LOC29 = 0;
			LOC29 = lastson_227261((*n).kindU.S6.Sons->data[0]);
			generatedoc_402685(d, LOC29);
		}
		LA27: ;
	}
	break;
	case ((NU8) 116):
	{
		{
			NI i_403603;
			NI HEX3Atmp_403645;
			NI LOC32;
			NI res_403648;
			i_403603 = 0;
			HEX3Atmp_403645 = 0;
			LOC32 = 0;
			LOC32 = sonslen_227249(n);
			HEX3Atmp_403645 = (NI32)(LOC32 - 1);
			res_403648 = 0;
			{
				while (1) {
					if (!(res_403648 <= HEX3Atmp_403645)) goto LA34;
					i_403603 = res_403648;
					tracedeps_402651(d, (*n).kindU.S6.Sons->data[i_403603]);
					res_403648 += 1;
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 120):
	case ((NU8) 117):
	{
		tracedeps_402651(d, (*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
	}
	break;
	}
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell44933* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48646(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell44933* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48646((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA11;
			rtladdzct_50204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, gensection_404639)(tdocumentor401007* d, NU8 kind) {
	trope178009* title;
	NimStringDesc* LOC5;
	TY557045 LOC6;
	NimStringDesc* LOC7;
	TY557045 LOC8;
	{
		if (!((*d).Section[(kind)- 0] == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	title = torope_178076(sectionnames_404643[(kind)- 6]);
	LOC5 = 0;
	LOC5 = getconfigvar_170350(((NimStringDesc*) &TMP4724));
	memset((void*)LOC6, 0, sizeof(LOC6));
	LOC6[0] = torope_178082(((NI64) (kind)));
	LOC6[1] = title;
	LOC6[2] = torope_178082(((NI64) ((NI32)(((NI) (kind)) + 50))));
	LOC6[3] = (*d).Section[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).Section[(kind)- 0]), ropeformatnamedvars_401166(LOC5, TMP4725, 4, LOC6, 4));
	LOC7 = 0;
	LOC7 = getconfigvar_170350(((NimStringDesc*) &TMP4730));
	memset((void*)LOC8, 0, sizeof(LOC8));
	LOC8[0] = torope_178082(((NI64) (kind)));
	LOC8[1] = title;
	LOC8[2] = torope_178082(((NI64) ((NI32)(((NI) (kind)) + 50))));
	LOC8[3] = (*d).Toc[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).Toc[(kind)- 0]), ropeformatnamedvars_401166(LOC7, TMP4725, 4, LOC8, 4));
	BeforeRet: ;
}

N_NIMCALL(trope178009*, genoutfile_404722)(tdocumentor401007* d) {
	trope178009* result;
	trope178009* code;
	trope178009* content;
	NimStringDesc* title;
	NI j;
	NimStringDesc* tmp;
	trstgenerator359016* LOC1;
	trope178009* toc;
	NimStringDesc* bodyname;
	NimStringDesc* LOC28;
	TY559098 LOC29;
	NimStringDesc* LOC30;
	NimStringDesc* LOC31;
	result = 0;
	code = 0;
	content = 0;
	title = copyString(((NimStringDesc*) &TMP2112));
	j = 0;
	tmp = copyString(((NimStringDesc*) &TMP2112));
	LOC1 = 0;
	LOC1 = &d->Sup;
	rendertocentries_365554(LOC1, (&j), 1, (&tmp));
	toc = torope_178076(tmp);
	{
		NU8 i_404783;
		NU8 res_404864;
		i_404783 = 0;
		res_404864 = ((NU8) 0);
		{
			while (1) {
				if (!(res_404864 <= ((NU8) 25))) goto LA4;
				i_404783 = res_404864;
				gensection_404639(d, i_404783);
				app_178052(&toc, (*d).Toc[(i_404783)- 0]);
				res_404864 += 1;
			} LA4: ;
		}
	}
	{
		NimStringDesc* LOC9;
		TY178515 LOC10;
		if (!!((toc == NIM_NIL))) goto LA7;
		LOC9 = 0;
		LOC9 = getconfigvar_170350(((NimStringDesc*) &TMP4731));
		memset((void*)LOC10, 0, sizeof(LOC10));
		LOC10[0] = toc;
		toc = ropeformatnamedvars_401166(LOC9, TMP4732, 1, LOC10, 1);
	}
	LA7: ;
	{
		NU8 i_404824;
		NU8 res_404871;
		i_404824 = 0;
		res_404871 = ((NU8) 0);
		{
			while (1) {
				if (!(res_404871 <= ((NU8) 25))) goto LA13;
				i_404824 = res_404871;
				app_178052(&code, (*d).Section[(i_404824)- 0]);
				res_404871 += 1;
			} LA13: ;
		}
	}
	{
		trstgenerator359016* LOC18;
		if (!!(((*d).Sup.Meta[(((NU8) 1))- 0]->Sup.len == 0))) goto LA16;
		title = copyString((*d).Sup.Meta[(((NU8) 1))- 0]);
		LOC18 = 0;
		LOC18 = &d->Sup;
		setindexterm_359710(LOC18, ((NimStringDesc*) &TMP2112), title, ((NimStringDesc*) &TMP2112), ((NimStringDesc*) &TMP2112));
	}
	goto LA14;
	LA16: ;
	{
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		NimStringDesc* LOC22;
		LOC20 = 0;
		LOC21 = 0;
		LOC21 = noschangeFileExt((*d).Sup.Filename, ((NimStringDesc*) &TMP2112));
		LOC22 = 0;
		LOC22 = nosextractFilename(LOC21);
		LOC20 = rawNewString(LOC22->Sup.len + 7);
appendString(LOC20, ((NimStringDesc*) &TMP4733));
appendString(LOC20, LOC22);
		title = LOC20;
	}
	LA14: ;
	{
		if (!(*d).Sup.Hastoc) goto LA25;
		bodyname = copyString(((NimStringDesc*) &TMP4734));
	}
	goto LA23;
	LA25: ;
	{
		bodyname = copyString(((NimStringDesc*) &TMP4735));
	}
	LA23: ;
	LOC28 = 0;
	LOC28 = getconfigvar_170350(bodyname);
	memset((void*)LOC29, 0, sizeof(LOC29));
	LOC29[0] = torope_178076(title);
	LOC29[1] = toc;
	LOC29[2] = (*d).Moddesc;
	LOC30 = 0;
	LOC30 = ntgetDateStr();
	LOC29[3] = torope_178076(LOC30);
	LOC31 = 0;
	LOC31 = ntgetClockStr();
	LOC29[4] = torope_178076(LOC31);
	LOC29[5] = code;
	content = ropeformatnamedvars_401166(LOC28, TMP4736, 6, LOC29, 6);
	{
		NimStringDesc* LOC36;
		TY404855 LOC37;
		NimStringDesc* LOC38;
		NimStringDesc* LOC39;
		if (!!(((gglobaloptions_170118 &(1<<((((NU8) 4))&31)))!=0))) goto LA34;
		LOC36 = 0;
		LOC36 = getconfigvar_170350(((NimStringDesc*) &TMP4742));
		memset((void*)LOC37, 0, sizeof(LOC37));
		LOC37[0] = torope_178076(title);
		LOC37[1] = toc;
		LOC37[2] = (*d).Moddesc;
		LOC38 = 0;
		LOC38 = ntgetDateStr();
		LOC37[3] = torope_178076(LOC38);
		LOC39 = 0;
		LOC39 = ntgetClockStr();
		LOC37[4] = torope_178076(LOC39);
		LOC37[5] = content;
		LOC37[6] = torope_178076((*d).Sup.Meta[(((NU8) 3))- 0]);
		LOC37[7] = torope_178076((*d).Sup.Meta[(((NU8) 4))- 0]);
		code = ropeformatnamedvars_401166(LOC36, TMP4743, 8, LOC37, 8);
	}
	goto LA32;
	LA34: ;
	{
		code = content;
	}
	LA32: ;
	result = code;
	return result;
}

N_NIMCALL(void, writeoutput_404920)(tdocumentor401007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning) {
	trope178009* content;
	content = genoutfile_404722(d);
	{
		if (!((gglobaloptions_170118 &(1<<((((NU8) 22))&31)))!=0)) goto LA3;
		writerope_179065(stdout, content);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		LOC6 = 0;
		LOC6 = getoutfile_170370(filename, outext);
		writerope_179423(content, LOC6, usewarning);
	}
	LA1: ;
}

N_NIMCALL(void, generateindex_404897)(tdocumentor401007* d) {
	{
		trstgenerator359016* LOC5;
		NimStringDesc* LOC6;
		TY117604 LOC7;
		TY117604 LOC8;
		NimStringDesc* LOC9;
		if (!((gglobaloptions_170118 &(1<<((((NU8) 30))&31)))!=0)) goto LA3;
		LOC5 = 0;
		LOC5 = &d->Sup;
		LOC6 = 0;
		memset((void*)(&LOC7), 0, sizeof(LOC7));
		nossplitFile(outfile_170124, (&LOC7));
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		nossplitFile((*d).Sup.Filename, (&LOC8));
		LOC9 = 0;
		LOC9 = HEX2F_117299(LOC7.Field0, LOC8.Field1);
		LOC6 = rawNewString(LOC9->Sup.len + 4);
appendString(LOC6, LOC9);
appendString(LOC6, ((NimStringDesc*) &TMP4747));
		writeindexfile_359287(LOC5, LOC6);
	}
	LA3: ;
}

N_NIMCALL(void, commanddoc_404946)(void) {
	tnode226816* ast;
	tdocumentor401007* d;
	ast = parsefile_261041(gprojectmainidx_170237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_401064(gprojectfull_170236, gconfigvars_170231);
	(*d).Sup.Hastoc = NIM_TRUE;
	generatedoc_402685(d, ast);
	writeoutput_404920(d, gprojectfull_170236, ((NimStringDesc*) &TMP4746), NIM_FALSE);
	generateindex_404897(d);
	BeforeRet: ;
}

N_NIMCALL(void, commandrstaux_404973)(NimStringDesc* filename, NimStringDesc* outext) {
	NimStringDesc* filen;
	tdocumentor401007* d;
	trstnode343011* rst;
	NimStringDesc* LOC1;
	NimStringDesc* moddesc;
	trstgenerator359016* LOC2;
	filen = nosaddFileExt(filename, ((NimStringDesc*) &TMP4753));
	d = newdocumentor_401064(filen, gconfigvars_170231);
	LOC1 = 0;
	LOC1 = readfile_12842(filen);
	rst = parserst_401048(LOC1, filen, 0, 1, (&(*d).Sup.Hastoc), 4);
	moddesc = rawNewString(30000);
	LOC2 = 0;
	LOC2 = &d->Sup;
	renderrsttoout_359579(LOC2, rst, (&moddesc));
	asgnRefNoCycle((void**) (&(*d).Moddesc), torope_178076(moddesc));
	writeoutput_404920(d, filename, outext, NIM_FALSE);
	generateindex_404897(d);
}

N_NIMCALL(void, commandrst2html_404992)(void) {
	commandrstaux_404973(gprojectfull_170236, ((NimStringDesc*) &TMP4746));
}

N_NIMCALL(void, commandrst2tex_405000)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_359332; splitter_359332 = copyStringRC1(((NimStringDesc*) &TMP4755));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	commandrstaux_404973(gprojectfull_170236, ((NimStringDesc*) &TMP4756));
}

N_NIMCALL(jsonnodeobj337042*, genjsonitem_402586)(tdocumentor401007* d, tnode226816* n, tnode226816* namenode, NU8 k) {
	jsonnodeobj337042* result;
	NimStringDesc* name;
	NimStringDesc* comm;
	trope178009* LOC6;
	tsrcgen251023 r;
	TY402609 LOC7;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_401778(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_401948(d, namenode, -1);
	LOC6 = 0;
	LOC6 = genreccomment_401432(d, n);
	comm = ropetostr_178101(LOC6);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_251067((&r), n, 14);
	memset((void*)LOC7, 0, sizeof(LOC7));
	LOC7[0].Field0 = copyString(((NimStringDesc*) &TMP4691));
	LOC7[0].Field1 = HEX25_337448(name);
	LOC7[1].Field0 = copyString(((NimStringDesc*) &TMP4765));
	LOC7[1].Field1 = HEX25_337448(reprEnum(k, (&NTI226445)));
	result = HEX25_337608(LOC7, 2);
	{
		NIM_BOOL LOC10;
		jsonnodeobj337042* 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_337448(comm);
		HEX5BHEX5DHEX3D_340240(result, ((NimStringDesc*) &TMP4766), LOC14);
	}
	LA12: ;
	{
		jsonnodeobj337042* LOC19;
		if (!!((r.Buf == NIM_NIL))) goto LA17;
		LOC19 = 0;
		LOC19 = HEX25_337448(r.Buf);
		HEX5BHEX5DHEX3D_340240(result, ((NimStringDesc*) &TMP4767), LOC19);
	}
	LA17: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(jsonnodeobj337042*, generatejson_403683)(tdocumentor401007* d, tnode226816* n, jsonnodeobj337042* jarray) {
	jsonnodeobj337042* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 125):
	{
		{
			NIM_BOOL LOC4;
			NimStringDesc* stripped;
			NimStringDesc* LOC8;
			TY403693 LOC9;
			LOC4 = 0;
			LOC4 = !(((*n).Comment == NIM_NIL));
			if (!(LOC4)) goto LA5;
			LOC4 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP2111));
			LA5: ;
			if (!LOC4) goto LA6;
			LOC8 = 0;
			LOC8 = copyStr((*n).Comment, 2);
			stripped = nsuStrip(LOC8, NIM_TRUE, NIM_TRUE);
			memset((void*)LOC9, 0, sizeof(LOC9));
			LOC9[0].Field0 = copyString(((NimStringDesc*) &TMP4764));
			LOC9[0].Field1 = HEX25_337448(stripped);
			result = HEX25_337608(LOC9, 1);
		}
		LA6: ;
	}
	break;
	case ((NU8) 79):
	{
		documentraises_380621(n);
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_380621(n);
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_380621(n);
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_380621(n);
		result = genjsonitem_402586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 16));
	}
	break;
	case ((NU8) 98):
	case ((NU8) 99):
	case ((NU8) 100):
	case ((NU8) 101):
	{
		{
			NI i_404427;
			NI HEX3Atmp_404604;
			NI LOC18;
			NI res_404607;
			i_404427 = 0;
			HEX3Atmp_404604 = 0;
			LOC18 = 0;
			LOC18 = sonslen_227249(n);
			HEX3Atmp_404604 = (NI32)(LOC18 - 1);
			res_404607 = 0;
			{
				while (1) {
					if (!(res_404607 <= HEX3Atmp_404604)) goto LA20;
					i_404427 = res_404607;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_404427]).Kind == ((NU8) 125)))) goto LA23;
						result = genjsonitem_402586(d, (*n).kindU.S6.Sons->data[i_404427], (*(*n).kindU.S6.Sons->data[i_404427]).kindU.S6.Sons->data[0], (((NU8) 7) + ((NI) ((NI32)(((NI) ((*n).Kind)) - 98)))));
					}
					LA23: ;
					res_404607 += 1;
				} LA20: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		jsonnodeobj337042* elem;
		elem = jarray;
		{
			NIM_BOOL LOC28;
			LOC28 = 0;
			LOC28 = HEX3DHEX3D_337893(elem, NIM_NIL);
			if (!LOC28) goto LA29;
			elem = newjarray_337389();
		}
		LA29: ;
		{
			NI i_404539;
			NI HEX3Atmp_404610;
			NI LOC32;
			NI res_404613;
			i_404539 = 0;
			HEX3Atmp_404610 = 0;
			LOC32 = 0;
			LOC32 = sonslen_227249(n);
			HEX3Atmp_404610 = (NI32)(LOC32 - 1);
			res_404613 = 0;
			{
				while (1) {
					jsonnodeobj337042* r;
					if (!(res_404613 <= HEX3Atmp_404610)) goto LA34;
					i_404539 = res_404613;
					r = generatejson_403683(d, (*n).kindU.S6.Sons->data[i_404539], elem);
					{
						NIM_BOOL LOC37;
						LOC37 = 0;
						LOC37 = HEX3DHEX3D_337893(r, NIM_NIL);
						if (!!(LOC37)) goto LA38;
						add_339862(elem, r);
						{
							NIM_BOOL LOC42;
							LOC42 = 0;
							LOC42 = HEX3DHEX3D_337893(result, NIM_NIL);
							if (!LOC42) goto LA43;
							result = elem;
						}
						LA43: ;
					}
					LA38: ;
					res_404613 += 1;
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC48;
			NIM_BOOL LOC49;
			NIM_BOOL LOC51;
			tnode226816* LOC54;
			jsonnodeobj337042* LOC55;
			LOC48 = 0;
			LOC49 = 0;
			LOC49 = checkforfalse_402618((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			LOC48 = !(LOC49);
			if (!(LOC48)) goto LA50;
			LOC51 = 0;
			LOC51 = HEX3DHEX3D_337893(jarray, NIM_NIL);
			LOC48 = !(LOC51);
			LA50: ;
			if (!LOC48) goto LA52;
			LOC54 = 0;
			LOC54 = lastson_227261((*n).kindU.S6.Sons->data[0]);
			LOC55 = 0;
			LOC55 = generatejson_403683(d, LOC54, jarray);
		}
		LA52: ;
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

N_NIMCALL(void, commandjson_405008)(void) {
	tnode226816* ast;
	tdocumentor401007* d;
	jsonnodeobj337042* json;
	trope178009* content;
	NimStringDesc* LOC5;
	ast = parsefile_261041(gprojectmainidx_170237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_401064(gprojectfull_170236, gconfigvars_170231);
	(*d).Sup.Hastoc = NIM_TRUE;
	json = generatejson_403683(d, ast, NIM_NIL);
	LOC5 = 0;
	LOC5 = pretty_341621(json, 2);
	content = newrope_178176(LOC5);
	{
		if (!((gglobaloptions_170118 &(1<<((((NU8) 22))&31)))!=0)) goto LA8;
		writerope_179065(stdout, content);
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC11;
		NimStringDesc* LOC12;
		LOC11 = 0;
		LOC11 = getoutfile_170370(gprojectfull_170236, ((NimStringDesc*) &TMP4785));
		printf("%s\012", (LOC11)->data);
		LOC12 = 0;
		LOC12 = getoutfile_170370(gprojectfull_170236, ((NimStringDesc*) &TMP4785));
		writerope_179423(content, LOC12, NIM_FALSE);
	}
	LA6: ;
	BeforeRet: ;
}

N_NIMCALL(void, commandbuildindex_405054)(void) {
	trope178009* content;
	NimStringDesc* LOC1;
	trope178009* code;
	NimStringDesc* LOC2;
	TY404855 LOC3;
	NimStringDesc* LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	LOC1 = 0;
	LOC1 = mergeindexes_365149(gprojectfull_170236);
	content = torope_178076(LOC1);
	LOC2 = 0;
	LOC2 = getconfigvar_170350(((NimStringDesc*) &TMP4742));
	memset((void*)LOC3, 0, sizeof(LOC3));
	LOC3[0] = torope_178076(((NimStringDesc*) &TMP4825));
	LOC3[1] = NIM_NIL;
	LOC3[2] = NIM_NIL;
	LOC4 = 0;
	LOC4 = ntgetDateStr();
	LOC3[3] = torope_178076(LOC4);
	LOC5 = 0;
	LOC5 = ntgetClockStr();
	LOC3[4] = torope_178076(LOC5);
	LOC3[5] = content;
	LOC3[6] = NIM_NIL;
	LOC3[7] = NIM_NIL;
	code = ropeformatnamedvars_401166(LOC2, TMP4743, 8, LOC3, 8);
	LOC6 = 0;
	LOC6 = getoutfile_170370(((NimStringDesc*) &TMP4826), ((NimStringDesc*) &TMP4746));
	writerope_179423(code, LOC6, NIM_FALSE);
}
NIM_EXTERNC N_NOINLINE(void, HEX00_docgenInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_docgenDatInit)(void) {
static TNimNode* TMP4632[6];
static TNimNode TMP878[7];
NTI401007.size = sizeof(tdocumentor401007);
NTI401007.kind = 17;
NTI401007.base = (&NTI359016);
TMP4632[0] = &TMP878[1];
TMP878[1].kind = 1;
TMP878[1].offset = offsetof(tdocumentor401007, Moddesc);
TMP878[1].typ = (&NTI178007);
TMP878[1].name = "modDesc";
TMP4632[1] = &TMP878[2];
TMP878[2].kind = 1;
TMP878[2].offset = offsetof(tdocumentor401007, Id);
TMP878[2].typ = (&NTI108);
TMP878[2].name = "id";
TMP4632[2] = &TMP878[3];
NTI401005.size = sizeof(tsections401005);
NTI401005.kind = 16;
NTI401005.base = (&NTI178007);
NTI401005.flags = 2;
TMP878[3].kind = 1;
TMP878[3].offset = offsetof(tdocumentor401007, Toc);
TMP878[3].typ = (&NTI401005);
TMP878[3].name = "toc";
TMP4632[3] = &TMP878[4];
TMP878[4].kind = 1;
TMP878[4].offset = offsetof(tdocumentor401007, Section);
TMP878[4].typ = (&NTI401005);
TMP878[4].name = "section";
TMP4632[4] = &TMP878[5];
TMP878[5].kind = 1;
TMP878[5].offset = offsetof(tdocumentor401007, Indexvalfilename);
TMP878[5].typ = (&NTI149);
TMP878[5].name = "indexValFilename";
TMP4632[5] = &TMP878[6];
TMP878[6].kind = 1;
TMP878[6].offset = offsetof(tdocumentor401007, Seensymbols);
TMP878[6].typ = (&NTI131014);
TMP878[6].name = "seenSymbols";
TMP878[0].len = 6; TMP878[0].kind = 2; TMP878[0].sons = &TMP4632[0];
NTI401007.node = &TMP878[0];
NTI401009.size = sizeof(tdocumentor401007*);
NTI401009.kind = 22;
NTI401009.base = (&NTI401007);
NTI401009.marker = TMP4633;
}

