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

#include <string.h>

#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tsym225846 tsym225846;
typedef struct tdocumentor400007 tdocumentor400007;
typedef struct tnode225816 tnode225816;
typedef struct ttype225852 ttype225852;
typedef struct tlineinfo195539 tlineinfo195539;
typedef struct tident200021 tident200021;
typedef struct tnodeseq225810 tnodeseq225810;
typedef struct tidobj200015 tidobj200015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq225848 ttypeseq225848;
typedef struct tscope225840 tscope225840;
typedef struct TY225947 TY225947;
typedef struct tinstantiation225836 tinstantiation225836;
typedef struct tstrtable225820 tstrtable225820;
typedef struct tsymseq225818 tsymseq225818;
typedef struct tloc225830 tloc225830;
typedef struct trope177009 trope177009;
typedef struct tlib225834 tlib225834;
typedef struct trstgenerator358016 trstgenerator358016;
typedef struct trstnode342011 trstnode342011;
typedef struct stringtableobj131012 stringtableobj131012;
typedef struct TY358034 TY358034;
typedef struct ttocentry358012 ttocentry358012;
typedef struct table358052 table358052;
typedef struct keyvaluepairseq358055 keyvaluepairseq358055;
typedef struct keyvaluepair358058 keyvaluepair358058;
typedef struct tcell45133 tcell45133;
typedef struct tcellset45145 tcellset45145;
typedef struct tgcheap47216 tgcheap47216;
typedef struct tcellseq45149 tcellseq45149;
typedef struct tpagedesc45141 tpagedesc45141;
typedef struct tmemregion27410 tmemregion27410;
typedef struct tsmallchunk26640 tsmallchunk26640;
typedef struct tllchunk27404 tllchunk27404;
typedef struct tbigchunk26642 tbigchunk26642;
typedef struct tintset26617 tintset26617;
typedef struct ttrunk26613 ttrunk26613;
typedef struct tavlnode27408 tavlnode27408;
typedef struct tgcstat47214 tgcstat47214;
typedef struct tsrcgen250023 tsrcgen250023;
typedef struct trendertokseq250021 trendertokseq250021;
typedef struct trendertok250019 trendertok250019;
typedef struct TY117804 TY117804;
typedef struct jsonnodeobj336042 jsonnodeobj336042;
typedef struct TY336611 TY336611;
typedef struct TY225936 TY225936;
typedef struct tlistentry127022 tlistentry127022;
typedef struct trstnodeseq342009 trstnodeseq342009;
typedef struct keyvaluepairseq131010 keyvaluepairseq131010;
typedef struct keyvaluepair131008 keyvaluepair131008;
typedef struct tbasechunk26638 tbasechunk26638;
typedef struct tfreecell26630 tfreecell26630;
typedef struct TY336057 TY336057;
typedef struct TY336062 TY336062;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tlineinfo195539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tnode225816  {
ttype225852* Typ;
tlineinfo195539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym225846* Sym;
} S4;
struct {tident200021* Ident;
} S5;
struct {tnodeseq225810* 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  tidobj200015  {
  TNimObject Sup;
NI Id;
};
struct  tstrtable225820  {
NI Counter;
tsymseq225818* Data;
};
struct  tloc225830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype225852* T;
trope177009* R;
trope177009* Heaproot;
};
struct  tsym225846  {
  tidobj200015 Sup;
NU8 Kind;
union {
struct {ttypeseq225848* Typeinstcache;
tscope225840* Typscope;
} S1;
struct {TY225947* Procinstcache;
tscope225840* Scope;
} S2;
struct {TY225947* Usedgenerics;
tstrtable225820 Tab;
} S3;
struct {tsym225846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype225852* Typ;
tident200021* Name;
tlineinfo195539 Info;
tsym225846* Owner;
NU32 Flags;
tnode225816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc225830 Loc;
tlib225834* Annex;
tnode225816* Constraint;
};
typedef N_NIMCALL_PTR(NimStringDesc*, tfindfilehandler343023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, tmsghandler343021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
struct  ttocentry358012  {
trstnode342011* N;
NimStringDesc* Refname;
NimStringDesc* Header;
};
typedef NimStringDesc* TY358042[5];
struct keyvaluepair358058 {
NU8 Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  table358052  {
keyvaluepairseq358055* Data;
NI Counter;
};
struct  trstgenerator358016  {
  TNimObject Sup;
NU8 Target;
stringtableobj131012* Config;
NI Splitafter;
TY358034* Tocpart;
NIM_BOOL Hastoc;
NimStringDesc* Theindex;
NU8 Options;
tfindfilehandler343023 Findfile;
tmsghandler343021 Msghandler;
NimStringDesc* Filename;
TY358042 Meta;
NimStringDesc* Currentsection;
table358052 Seenindexterms;
};
typedef trope177009* tsections400005[26];
struct  tdocumentor400007  {
  trstgenerator358016 Sup;
trope177009* Moddesc;
NI Id;
tsections400005 Toc;
tsections400005 Section;
NimStringDesc* Indexvalfilename;
stringtableobj131012* Seensymbols;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tcell45133  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq45149  {
NI Len;
NI Cap;
tcell45133** D;
};
struct  tcellset45145  {
NI Counter;
NI Max;
tpagedesc45141* Head;
tpagedesc45141** Data;
};
typedef tsmallchunk26640* TY27422[512];
typedef ttrunk26613* ttrunkbuckets26615[256];
struct  tintset26617  {
ttrunkbuckets26615 Data;
};
struct  tmemregion27410  {
NI Minlargeobj;
NI Maxlargeobj;
TY27422 Freesmallchunks;
tllchunk27404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk26642* Freechunkslist;
tintset26617 Chunkstarts;
tavlnode27408* Root;
tavlnode27408* Deleted;
tavlnode27408* Last;
tavlnode27408* Freeavlnodes;
};
struct  tgcstat47214  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap47216  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq45149 Zct;
tcellseq45149 Decstack;
tcellset45145 Cycleroots;
tcellseq45149 Tempstack;
NI Recgclock;
tmemregion27410 Region;
tgcstat47214 Stat;
};
struct  tident200021  {
  tidobj200015 Sup;
NimStringDesc* S;
tident200021* Next;
NI H;
};
struct  trendertok250019  {
NU8 Kind;
NI16 Length;
};
struct  tsrcgen250023  {
NI Indent;
NI Linelen;
NI Pos;
NI Idx;
trendertokseq250021* Tokens;
NimStringDesc* Buf;
NI Pendingnl;
tnodeseq225810* Comstack;
NU8 Flags;
NIM_BOOL Checkanon;
NI Inpragma;
};
typedef trope177009* TY177515[1];
typedef NimStringDesc* TY169969[2];
typedef trope177009* TY588896[2];
typedef NimStringDesc* TY208063[3];
typedef trope177009* TY554018[3];
typedef NimStringDesc* TY401547[10];
typedef trope177009* TY401549[10];
typedef NimStringDesc* TY401556[9];
typedef trope177009* TY401558[9];
typedef NU8 TY211607[32];
typedef NimStringDesc* TY403644[13];
typedef NimStringDesc* TY197620[4];
typedef trope177009* TY556046[4];
typedef NimStringDesc* TY197301[1];
typedef NimStringDesc* TY483908[6];
typedef trope177009* TY558098[6];
typedef NimStringDesc* TY403853[8];
typedef trope177009* TY403855[8];
struct TY117804 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct TY336611 {
NimStringDesc* Field0;
jsonnodeobj336042* Field1;
};
typedef TY336611 TY402693[1];
typedef TY336611 TY401609[2];
struct  ttype225852  {
  tidobj200015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq225848* Sons;
tnode225816* N;
tsym225846* Owner;
tsym225846* Sym;
tsym225846* Destructor;
tsym225846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc225830 Loc;
};
struct  tscope225840  {
NI Depthlevel;
tstrtable225820 Symbols;
tnodeseq225810* Usingsyms;
tscope225840* Parent;
};
struct  tinstantiation225836  {
tsym225846* Sym;
ttypeseq225848* Concretetypes;
TY225936* Usedby;
};
struct  trope177009  {
  TNimObject Sup;
trope177009* Left;
trope177009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib225834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope177009* Name;
tnode225816* Path;
};
struct  trstnode342011  {
NU8 Kind;
NimStringDesc* Text;
NI Level;
trstnodeseq342009* Sons;
};
struct keyvaluepair131008 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct  stringtableobj131012  {
  TNimObject Sup;
NI Counter;
keyvaluepairseq131010* Data;
NU8 Mode;
};
typedef NI TY26620[8];
struct  tpagedesc45141  {
tpagedesc45141* Next;
NI Key;
TY26620 Bits;
};
struct  tbasechunk26638  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk26640  {
  tbasechunk26638 Sup;
tsmallchunk26640* Next;
tsmallchunk26640* Prev;
tfreecell26630* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk27404  {
NI Size;
NI Acc;
tllchunk27404* Next;
};
struct  tbigchunk26642  {
  tbasechunk26638 Sup;
tbigchunk26642* Next;
tbigchunk26642* Prev;
NI Align;
NF Data;
};
struct  ttrunk26613  {
ttrunk26613* Next;
NI Key;
TY26620 Bits;
};
typedef tavlnode27408* TY27414[2];
struct  tavlnode27408  {
TY27414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  jsonnodeobj336042  {
NU8 Kind;
union {
struct {NimStringDesc* Str;
} S1;
struct {NI64 Num;
} S2;
struct {NF Fnum;
} S3;
struct {NIM_BOOL Bval;
} S4;
struct {TY336057* Fields;
} S6;
struct {TY336062* Elems;
} S7;
} kindU;
};
struct  tfreecell26630  {
tfreecell26630* Next;
NI Zerofield;
};
struct tnodeseq225810 {
  TGenericSeq Sup;
  tnode225816* data[SEQ_DECL_SIZE];
};
struct ttypeseq225848 {
  TGenericSeq Sup;
  ttype225852* data[SEQ_DECL_SIZE];
};
struct TY225947 {
  TGenericSeq Sup;
  tinstantiation225836* data[SEQ_DECL_SIZE];
};
struct tsymseq225818 {
  TGenericSeq Sup;
  tsym225846* data[SEQ_DECL_SIZE];
};
struct TY358034 {
  TGenericSeq Sup;
  ttocentry358012 data[SEQ_DECL_SIZE];
};
struct keyvaluepairseq358055 {
  TGenericSeq Sup;
  keyvaluepair358058 data[SEQ_DECL_SIZE];
};
struct trendertokseq250021 {
  TGenericSeq Sup;
  trendertok250019 data[SEQ_DECL_SIZE];
};
struct TY225936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct trstnodeseq342009 {
  TGenericSeq Sup;
  trstnode342011* data[SEQ_DECL_SIZE];
};
struct keyvaluepairseq131010 {
  TGenericSeq Sup;
  keyvaluepair131008 data[SEQ_DECL_SIZE];
};
struct TY336057 {
  TGenericSeq Sup;
  TY336611 data[SEQ_DECL_SIZE];
};
struct TY336062 {
  TGenericSeq Sup;
  jsonnodeobj336042* data[SEQ_DECL_SIZE];
};
N_NIMCALL(tnode225816*, finddoccomment_400635)(tnode225816* n);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
static N_INLINE(NI, safelen_226424)(tnode225816* n);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, renderrsttoout_358579)(trstgenerator358016* d, trstnode342011* n, NimStringDesc** result);
N_NIMCALL(trstnode342011*, parserst_400048)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions);
N_NIMCALL(trstnode342011*, rstparse_351164)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 options, tfindfilehandler343023 findfile, tmsghandler343021 msghandler);
N_NIMCALL(NimStringDesc*, docgenfindfile_400038)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, findfile_170356)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, HEX2F_117499)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(void, compilermsghandler_400022)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
N_NIMCALL(void, globalerror_197934)(tlineinfo195539 info, NU16 msg, NimStringDesc* arg);
static N_INLINE(tlineinfo195539, newlineinfo_196140)(NimStringDesc* filename, NI line, NI col);
N_NIMCALL(tlineinfo195539, newlineinfo_196128)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(NI32, fileinfoidx_195747)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_197025)(NI32 fileidx);
static N_INLINE(NI, tolinenumber_197073)(tlineinfo195539 info);
static N_INLINE(NI, tocolumn_197083)(tlineinfo195539 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(tnode225816*, parsefile_260041)(NI32 fileidx);
N_NIMCALL(tdocumentor400007*, newdocumentor_400064)(NimStringDesc* filename, stringtableobj131012* config);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP4628)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initrstgenerator_358088)(trstgenerator358016* g, NU8 target, stringtableobj131012* config, NimStringDesc* filename, NU8 options, tfindfilehandler343023 findfile, tmsghandler343021 msghandler);
N_NIMCALL(stringtableobj131012*, nstnewStringTable)(NU8 mode);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_51225)(tcell45133* c);
static N_INLINE(NIM_BOOL, canbecycleroot_48867)(tcell45133* c);
static N_INLINE(void, rtladdcycleroot_49629)(tcell45133* c);
N_NOINLINE(void, incl_45871)(tcellset45145* s, tcell45133* cell);
static N_INLINE(tcell45133*, usrtocell_48846)(void* usr);
static N_INLINE(void, decref_50804)(tcell45133* c);
static N_INLINE(void, rtladdzct_50404)(tcell45133* c);
N_NOINLINE(void, addzct_48817)(tcellseq45149* s, tcell45133* c);
N_NIMCALL(void, generatedoc_401685)(tdocumentor400007* d, tnode225816* n);
N_NIMCALL(void, app_177060)(trope177009** a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, gencomment_400398)(tdocumentor400007* d, tnode225816* n);
N_NIMCALL(void, documentraises_379621)(tnode225816* n);
N_NIMCALL(void, genitem_401416)(tdocumentor400007* d, tnode225816* n, tnode225816* namenode, NU8 k);
N_NIMCALL(NIM_BOOL, isvisible_400778)(tnode225816* n);
static N_INLINE(NI, len_226364)(tnode225816* n);
N_NIMCALL(NimStringDesc*, getname_400948)(tdocumentor400007* d, tnode225816* n, NI splitafter);
N_NIMCALL(NimStringDesc*, esc_358407)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NimStringDesc*, renderdefinitionname_250134)(tsym225846* s, NIM_BOOL noquotes);
static N_INLINE(tnode225816*, HEX5BHEX5D_226698)(tnode225816* n, NI i);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(void, internalerror_197987)(tlineinfo195539 info, NimStringDesc* errmsg);
N_NIMCALL(trope177009*, torope_177076)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, getplaindocstring_400550)(tnode225816* n);
N_NIMCALL(trope177009*, genreccomment_400432)(tdocumentor400007* d, tnode225816* n);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void, inittokrender_250067)(tsrcgen250023* r, tnode225816* n, NU8 renderflags);
N_NIMCALL(void, getnexttok_250078)(tsrcgen250023* r, NU8* kind, NimStringDesc** literal);
N_NIMCALL(void, dispa_400103)(trope177009** dest, NimStringDesc* xml, NimStringDesc* tex, trope177009** args, NI argsLen0);
N_NIMCALL(void, appf_177115)(trope177009** c, NimStringDesc* frmt, trope177009** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, escape_391893)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, renderplainsymbolname_397013)(tnode225816* n);
N_NIMCALL(NimStringDesc*, complexname_401201)(NU8 k, tnode225816* n, NimStringDesc* basename);
N_NIMCALL(NimStringDesc*, renderparamtypes_399862)(tnode225816* n, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, encodeurl_395004)(NimStringDesc* s);
N_NIMCALL(trope177009*, torope_177082)(NI64 i);
N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_401170)(tdocumentor400007* 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_169350)(NimStringDesc* key);
N_NIMCALL(trope177009*, ropeformatnamedvars_400166)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope177009** varvalues, NI varvaluesLen0);
N_NIMCALL(void, app_177052)(trope177009** a, trope177009* b);
N_NIMCALL(void, internalerror_198006)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NI, getvaridx_400126)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, rawmessage_197733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_75028, 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_401223)(tnode225816* n);
N_NIMCALL(void, setindexterm_358710)(trstgenerator358016* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc);
N_NIMCALL(NimStringDesc*, docstringsummary_401233)(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, TY211607 chars, NI start);
static N_INLINE(NI, sonslen_226249)(tnode225816* n);
N_NIMCALL(NIM_BOOL, checkforfalse_401618)(tnode225816* n);
N_NIMCALL(NIM_BOOL, identeq_200493)(tident200021* id, NimStringDesc* name);
static N_INLINE(tnode225816*, lastson_226261)(tnode225816* n);
N_NIMCALL(void, tracedeps_401651)(tdocumentor400007* d, tnode225816* n);
N_NIMCALL(NimStringDesc*, getmodulename_298018)(tnode225816* n);
N_NIMCALL(void, writeoutput_403920)(tdocumentor400007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning);
N_NIMCALL(trope177009*, genoutfile_403722)(tdocumentor400007* d);
N_NIMCALL(void, rendertocentries_364554)(trstgenerator358016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, gensection_403639)(tdocumentor400007* 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_178065)(FILE* f, trope177009* c);
N_NIMCALL(void, writerope_178423)(trope177009* head, NimStringDesc* filename, NIM_BOOL usewarning);
N_NIMCALL(NimStringDesc*, getoutfile_169370)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(void, generateindex_403897)(tdocumentor400007* d);
N_NIMCALL(void, writeindexfile_358287)(trstgenerator358016* g, NimStringDesc* outfile);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY117804* Result);
N_NIMCALL(void, commandrstaux_403973)(NimStringDesc* filename, NimStringDesc* outext);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, readfile_13042)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(jsonnodeobj336042*, generatejson_402683)(tdocumentor400007* d, tnode225816* n, jsonnodeobj336042* jarray);
N_NIMCALL(jsonnodeobj336042*, HEX25_336608)(TY336611* keyvals, NI keyvalsLen0);
N_NIMCALL(jsonnodeobj336042*, HEX25_336448)(NimStringDesc* s);
N_NIMCALL(jsonnodeobj336042*, genjsonitem_401586)(tdocumentor400007* d, tnode225816* n, tnode225816* namenode, NU8 k);
N_NIMCALL(NimStringDesc*, ropetostr_177101)(trope177009* p);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_81107, TNimType* typ);
N_NIMCALL(void, HEX5BHEX5DHEX3D_339240)(jsonnodeobj336042* obj, NimStringDesc* key, jsonnodeobj336042* val);
N_NIMCALL(NIM_BOOL, HEX3DHEX3D_336893)(jsonnodeobj336042* a, jsonnodeobj336042* b);
N_NIMCALL(jsonnodeobj336042*, newjarray_336389)(void);
N_NIMCALL(void, add_338862)(jsonnodeobj336042* father, jsonnodeobj336042* child);
N_NIMCALL(trope177009*, newrope_177176)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, pretty_340621)(jsonnodeobj336042* node, NI indent);
N_NIMCALL(NimStringDesc*, mergeindexes_364149)(NimStringDesc* dir);
STRING_LITERAL(TMP2107, "##", 2);
STRING_LITERAL(TMP2108, "", 0);
STRING_LITERAL(TMP2627, "\012##", 3);
STRING_LITERAL(TMP2628, "\012", 1);
STRING_LITERAL(TMP4633, "`", 1);
STRING_LITERAL(TMP4634, "getName()", 9);
STRING_LITERAL(TMP4635, "<span class=\"Comment\">$1</span>", 31);
STRING_LITERAL(TMP4636, "\\spanComment{$1}", 16);
STRING_LITERAL(TMP4637, "<span class=\"Keyword\">$1</span>", 31);
STRING_LITERAL(TMP4638, "\\spanKeyword{$1}", 16);
STRING_LITERAL(TMP4639, "<span class=\"Operator\">$1</span>", 32);
STRING_LITERAL(TMP4640, "\\spanOperator{$1}", 17);
STRING_LITERAL(TMP4641, "<span class=\"StringLit\">$1</span>", 33);
STRING_LITERAL(TMP4642, "\\spanStringLit{$1}", 18);
STRING_LITERAL(TMP4643, "<span class=\"CharLit\">$1</span>", 31);
STRING_LITERAL(TMP4644, "\\spanCharLit{$1}", 16);
STRING_LITERAL(TMP4645, "<span class=\"DecNumber\">$1</span>", 33);
STRING_LITERAL(TMP4646, "\\spanDecNumber{$1}", 18);
STRING_LITERAL(TMP4647, "<span class=\"FloatNumber\">$1</span>", 35);
STRING_LITERAL(TMP4648, "\\spanFloatNumber{$1}", 20);
STRING_LITERAL(TMP4649, "<span class=\"Identifier\">$1</span>", 34);
STRING_LITERAL(TMP4650, "\\spanIdentifier{$1}", 19);
STRING_LITERAL(TMP4651, "<span class=\"Other\">$1</span>", 29);
STRING_LITERAL(TMP4652, "\\spanOther{$1}", 14);
STRING_LITERAL(TMP4662, ",", 1);
STRING_LITERAL(TMP4663, ".m,", 3);
STRING_LITERAL(TMP4664, ".e,", 3);
STRING_LITERAL(TMP4665, ".i,", 3);
STRING_LITERAL(TMP4666, ".t,", 3);
STRING_LITERAL(TMP4667, ".c,", 3);
STRING_LITERAL(TMP4673, "_", 1);
STRING_LITERAL(TMP4674, "doc.item.seesrc", 15);
STRING_LITERAL(TMP4675, "$", 1);
STRING_LITERAL(TMP4676, "ropeFormatNamedVars", 19);
STRING_LITERAL(TMP4677, "}", 1);
STRING_LITERAL(TMP4679, "path", 4);
STRING_LITERAL(TMP4680, "line", 4);
NIM_CONST TY169969 TMP4678 = {((NimStringDesc*) &TMP4679),
((NimStringDesc*) &TMP4680)}
;
STRING_LITERAL(TMP4681, "$1", 2);
STRING_LITERAL(TMP4683, "url", 3);
NIM_CONST TY208063 TMP4682 = {((NimStringDesc*) &TMP4679),
((NimStringDesc*) &TMP4680),
((NimStringDesc*) &TMP4683)}
;
STRING_LITERAL(TMP4684, "doc.item", 8);
STRING_LITERAL(TMP4686, "name", 4);
STRING_LITERAL(TMP4687, "header", 6);
STRING_LITERAL(TMP4688, "desc", 4);
STRING_LITERAL(TMP4689, "itemID", 6);
STRING_LITERAL(TMP4690, "header_plain", 12);
STRING_LITERAL(TMP4691, "itemSym", 7);
STRING_LITERAL(TMP4692, "itemSymOrID", 11);
STRING_LITERAL(TMP4693, "itemSymEnc", 10);
STRING_LITERAL(TMP4694, "itemSymOrIDEnc", 14);
STRING_LITERAL(TMP4695, "seeSrc", 6);
NIM_CONST TY401547 TMP4685 = {((NimStringDesc*) &TMP4686),
((NimStringDesc*) &TMP4687),
((NimStringDesc*) &TMP4688),
((NimStringDesc*) &TMP4689),
((NimStringDesc*) &TMP4690),
((NimStringDesc*) &TMP4691),
((NimStringDesc*) &TMP4692),
((NimStringDesc*) &TMP4693),
((NimStringDesc*) &TMP4694),
((NimStringDesc*) &TMP4695)}
;
STRING_LITERAL(TMP4696, "doc.item.toc", 12);
NIM_CONST TY401556 TMP4697 = {((NimStringDesc*) &TMP4686),
((NimStringDesc*) &TMP4687),
((NimStringDesc*) &TMP4688),
((NimStringDesc*) &TMP4689),
((NimStringDesc*) &TMP4690),
((NimStringDesc*) &TMP4691),
((NimStringDesc*) &TMP4692),
((NimStringDesc*) &TMP4693),
((NimStringDesc*) &TMP4694)}
;
STRING_LITERAL(TMP4698, " : ", 3);
STRING_LITERAL(TMP4699, "\342\200\246", 3);
static NIM_CONST TY211607 TMP4700 = {
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(TMP4701, "false", 5);
STRING_LITERAL(TMP4702, ", ", 2);
STRING_LITERAL(TMP4703, "<a class=\"reference external\" href=\"$1.html\">$1</a>", 51);
STRING_LITERAL(TMP4708, "Imports", 7);
STRING_LITERAL(TMP4709, "Types", 5);
STRING_LITERAL(TMP4710, "Vars", 4);
STRING_LITERAL(TMP4711, "Lets", 4);
STRING_LITERAL(TMP4712, "Consts", 6);
STRING_LITERAL(TMP4713, "Procs", 5);
STRING_LITERAL(TMP4714, "Methods", 7);
STRING_LITERAL(TMP4715, "Iterators", 9);
STRING_LITERAL(TMP4716, "Converters", 10);
STRING_LITERAL(TMP4717, "Macros", 6);
STRING_LITERAL(TMP4718, "Templates", 9);
NIM_CONST TY403644 sectionnames_403643 = {((NimStringDesc*) &TMP4708),
((NimStringDesc*) &TMP4709),
((NimStringDesc*) &TMP4710),
((NimStringDesc*) &TMP4711),
((NimStringDesc*) &TMP4712),
((NimStringDesc*) &TMP4710),
((NimStringDesc*) &TMP4713),
((NimStringDesc*) &TMP4714),
((NimStringDesc*) &TMP4715),
((NimStringDesc*) &TMP4715),
((NimStringDesc*) &TMP4716),
((NimStringDesc*) &TMP4717),
((NimStringDesc*) &TMP4718)}
;
STRING_LITERAL(TMP4719, "doc.section", 11);
STRING_LITERAL(TMP4721, "sectionid", 9);
STRING_LITERAL(TMP4722, "sectionTitle", 12);
STRING_LITERAL(TMP4723, "sectionTitleID", 14);
STRING_LITERAL(TMP4724, "content", 7);
NIM_CONST TY197620 TMP4720 = {((NimStringDesc*) &TMP4721),
((NimStringDesc*) &TMP4722),
((NimStringDesc*) &TMP4723),
((NimStringDesc*) &TMP4724)}
;
STRING_LITERAL(TMP4725, "doc.section.toc", 15);
STRING_LITERAL(TMP4726, "doc.toc", 7);
NIM_CONST TY197301 TMP4727 = {((NimStringDesc*) &TMP4724)}
;
STRING_LITERAL(TMP4728, "Module ", 7);
STRING_LITERAL(TMP4729, "doc.body_toc", 12);
STRING_LITERAL(TMP4730, "doc.body_no_toc", 15);
STRING_LITERAL(TMP4732, "title", 5);
STRING_LITERAL(TMP4733, "tableofcontents", 15);
STRING_LITERAL(TMP4734, "moduledesc", 10);
STRING_LITERAL(TMP4735, "date", 4);
STRING_LITERAL(TMP4736, "time", 4);
NIM_CONST TY483908 TMP4731 = {((NimStringDesc*) &TMP4732),
((NimStringDesc*) &TMP4733),
((NimStringDesc*) &TMP4734),
((NimStringDesc*) &TMP4735),
((NimStringDesc*) &TMP4736),
((NimStringDesc*) &TMP4724)}
;
STRING_LITERAL(TMP4737, "doc.file", 8);
STRING_LITERAL(TMP4739, "author", 6);
STRING_LITERAL(TMP4740, "version", 7);
NIM_CONST TY403853 TMP4738 = {((NimStringDesc*) &TMP4732),
((NimStringDesc*) &TMP4733),
((NimStringDesc*) &TMP4734),
((NimStringDesc*) &TMP4735),
((NimStringDesc*) &TMP4736),
((NimStringDesc*) &TMP4724),
((NimStringDesc*) &TMP4739),
((NimStringDesc*) &TMP4740)}
;
STRING_LITERAL(TMP4741, "html", 4);
STRING_LITERAL(TMP4742, ".idx", 4);
STRING_LITERAL(TMP4748, "txt", 3);
STRING_LITERAL(TMP4750, "\\-", 2);
STRING_LITERAL(TMP4751, "tex", 3);
STRING_LITERAL(TMP4759, "comment", 7);
STRING_LITERAL(TMP4760, "type", 4);
STRING_LITERAL(TMP4761, "description", 11);
STRING_LITERAL(TMP4762, "code", 4);
STRING_LITERAL(TMP4780, "json", 4);
STRING_LITERAL(TMP4820, "Index", 5);
STRING_LITERAL(TMP4821, "theindex", 8);
extern NI32 gprojectmainidx_169237;
extern TNimType NTI358016; /* TRstGenerator */
TNimType NTI400007; /* TDocumentor */
extern TNimType NTI177007; /* PRope */
extern TNimType NTI108; /* int */
TNimType NTI400005; /* TSections */
extern TNimType NTI149; /* string */
extern TNimType NTI131014; /* StringTableRef */
TNimType NTI400009; /* PDoc */
extern NU8 gcmd_169120;
extern stringtableobj131012* gconfigvars_169231;
extern tgcheap47216 gch_47244;
extern NimStringDesc* gprojectfull_169236;
extern NimStringDesc* docseesrcurl_169125;
extern NU32 gglobaloptions_169118;
extern NimStringDesc* outfile_169124;
extern NimStringDesc* splitter_358332;
extern TNimType NTI225445; /* TSymKind */

static N_INLINE(NI, safelen_226424)(tnode225816* 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(tnode225816*, finddoccomment_400635)(tnode225816* n) {
	tnode225816* 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*) &TMP2107));
		LA8: ;
		if (!LOC7) goto LA9;
		result = n;
		goto BeforeRet;
	}
	LA9: ;
	{
		NI i_400668;
		NI HEX3Atmp_400701;
		NI LOC12;
		NI res_400704;
		i_400668 = 0;
		HEX3Atmp_400701 = 0;
		LOC12 = 0;
		LOC12 = safelen_226424(n);
		HEX3Atmp_400701 = (NI64)(LOC12 - 1);
		res_400704 = 0;
		{
			while (1) {
				if (!(res_400704 <= HEX3Atmp_400701)) goto LA14;
				i_400668 = res_400704;
				result = finddoccomment_400635((*n).kindU.S6.Sons->data[i_400668]);
				{
					if (!!((result == NIM_NIL))) goto LA17;
					goto BeforeRet;
				}
				LA17: ;
				res_400704 += 1;
			} LA14: ;
		}
	}
	BeforeRet: ;
	return result;
}

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

static N_INLINE(tlineinfo195539, newlineinfo_196140)(NimStringDesc* filename, NI line, NI col) {
	tlineinfo195539 result;
	NI32 LOC1;
	memset((void*)(&result), 0, sizeof(result));
	LOC1 = 0;
	LOC1 = fileinfoidx_195747(filename);
	result = newlineinfo_196128(LOC1, line, col);
	return result;
}

N_NIMCALL(void, compilermsghandler_400022)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg) {
	NU16 k;
	tlineinfo195539 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_196140(filename, line, col);
	globalerror_197934(LOC11, k, arg);
}

N_NIMCALL(trstnode342011*, parserst_400048)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions) {
	trstnode342011* result;
	result = 0;
	result = rstparse_351164(text, filename, line, column, hastoc, rstoptions, docgenfindfile_400038, compilermsghandler_400022);
	return result;
}

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

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

N_NIMCALL(NimStringDesc*, extractdoccomment_400721)(tsym225846* s, tdocumentor400007* d) {
	NimStringDesc* result;
	tnode225816* n;
	result = 0;
	n = finddoccomment_400635((*s).Ast);
	result = copyString(((NimStringDesc*) &TMP2108));
	{
		if (!!(n == 0)) goto LA3;
		{
			NIM_BOOL dummyhastoc;
			trstgenerator358016* LOC9;
			NimStringDesc* LOC10;
			NI LOC11;
			NI LOC12;
			trstnode342011* LOC13;
			if (!!(d == 0)) goto LA7;
			dummyhastoc = 0;
			LOC9 = 0;
			LOC9 = &d->Sup;
			LOC10 = 0;
			LOC10 = tofilename_197025((*n).Info.Fileindex);
			LOC11 = 0;
			LOC11 = tolinenumber_197073((*n).Info);
			LOC12 = 0;
			LOC12 = tocolumn_197083((*n).Info);
			LOC13 = 0;
			LOC13 = parserst_400048((*n).Comment, LOC10, LOC11, LOC12, (&dummyhastoc), ((*d).Sup.Options | 1));
			renderrsttoout_358579(LOC9, LOC13, (&result));
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC15;
			NimStringDesc* LOC16;
			LOC15 = 0;
			LOC15 = copyStr((*n).Comment, 2);
			LOC16 = 0;
			LOC16 = nsuReplaceStr(LOC15, ((NimStringDesc*) &TMP2627), ((NimStringDesc*) &TMP2628));
			result = nsuStrip(LOC16, NIM_TRUE, NIM_TRUE);
		}
		LA5: ;
	}
	LA3: ;
	return result;
}
N_NIMCALL(void, TMP4628)(void* p, NI op) {
	tdocumentor400007* a;
	NI LOC1;
	NI LOC2;
	NI LOC3;
	a = (tdocumentor400007*)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_48867)(tcell45133* c) {
	NIM_BOOL result;
	result = 0;
	result = !((((*(*c).Typ).flags &(1<<((((NU8) 1))&7)))!=0));
	return result;
}

static N_INLINE(void, rtladdcycleroot_49629)(tcell45133* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_45871((&gch_47244.Cycleroots), c);
	}
	LA3: ;
}

static N_INLINE(void, incref_51225)(tcell45133* c) {
	(*c).Refcount = (NI)((NU64)((*c).Refcount) + (NU64)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_48867(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_49629(c);
	}
	LA4: ;
}

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

static N_INLINE(void, rtladdzct_50404)(tcell45133* c) {
	addzct_48817((&gch_47244.Zct), c);
}

static N_INLINE(void, decref_50804)(tcell45133* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA3;
		rtladdzct_50404(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_48867(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_49629(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell45133* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_48846(src);
		incref_51225(LOC5);
	}
	LA3: ;
	{
		tcell45133* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_48846((*dest));
		decref_50804(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(tdocumentor400007*, newdocumentor_400064)(NimStringDesc* filename, stringtableobj131012* config) {
	tdocumentor400007* result;
	trstgenerator358016* LOC1;
	NU8 LOC2;
	result = 0;
	result = (tdocumentor400007*) newObj((&NTI400009), sizeof(tdocumentor400007));
	(*result).Sup.Sup.m_type = (&NTI400007);
	LOC1 = 0;
	LOC1 = &result->Sup;
	LOC2 = 0;
	{
		if (!!((gcmd_169120 == ((NU8) 17)))) goto LA5;
		LOC2 = ((NU8) 0);
	}
	goto LA3;
	LA5: ;
	{
		LOC2 = ((NU8) 1);
	}
	LA3: ;
	initrstgenerator_358088(LOC1, LOC2, gconfigvars_169231, filename, 4, docgenfindfile_400038, compilermsghandler_400022);
	asgnRef((void**) (&(*result).Seensymbols), nstnewStringTable(((NU8) 1)));
	(*result).Id = 100;
	return result;
}

N_NIMCALL(NimStringDesc*, gencomment_400398)(tdocumentor400007* d, tnode225816* n) {
	NimStringDesc* result;
	NIM_BOOL dummyhastoc;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2108));
	dummyhastoc = 0;
	{
		NIM_BOOL LOC3;
		trstgenerator358016* LOC7;
		NimStringDesc* LOC8;
		NI LOC9;
		NI LOC10;
		trstnode342011* LOC11;
		LOC3 = 0;
		LOC3 = !(((*n).Comment == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP2107));
		LA4: ;
		if (!LOC3) goto LA5;
		LOC7 = 0;
		LOC7 = &d->Sup;
		LOC8 = 0;
		LOC8 = tofilename_197025((*n).Info.Fileindex);
		LOC9 = 0;
		LOC9 = tolinenumber_197073((*n).Info);
		LOC10 = 0;
		LOC10 = tocolumn_197083((*n).Info);
		LOC11 = 0;
		LOC11 = parserst_400048((*n).Comment, LOC8, LOC9, LOC10, (&dummyhastoc), ((*d).Sup.Options | 1));
		renderrsttoout_358579(LOC7, LOC11, (&result));
	}
	LA5: ;
	return result;
}

static N_INLINE(NI, len_226364)(tnode225816* 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_400778)(tnode225816* n) {
	NIM_BOOL result;
	result = 0;
	result = NIM_FALSE;
	{
		if (!((*n).Kind == ((NU8) 31))) goto LA3;
		{
			NIM_BOOL LOC7;
			NI LOC8;
			tident200021* v;
			NIM_BOOL LOC12;
			LOC7 = 0;
			LOC8 = 0;
			LOC8 = len_226364(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_400778((*n).kindU.S6.Sons->data[0]);
	}
	goto LA1;
	LA18: ;
	LA1: ;
	return result;
}

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

N_NIMCALL(NimStringDesc*, getname_400948)(tdocumentor400007* d, tnode225816* n, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 31):
	{
		result = getname_400948(d, (*n).kindU.S6.Sons->data[1], splitafter);
	}
	break;
	case ((NU8) 43):
	{
		result = getname_400948(d, (*n).kindU.S6.Sons->data[0], splitafter);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC4;
		LOC4 = 0;
		LOC4 = renderdefinitionname_250134((*n).kindU.S4.Sym, NIM_FALSE);
		result = esc_358407((*d).Sup.Target, LOC4, splitafter);
	}
	break;
	case ((NU8) 2):
	{
		result = esc_358407((*d).Sup.Target, (*(*n).kindU.S5.Ident).S, splitafter);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* LOC13;
		result = esc_358407((*d).Sup.Target, ((NimStringDesc*) &TMP4633), -1);
		{
			NI i_401031;
			NI HEX3Atmp_401033;
			NI LOC8;
			NI res_401036;
			i_401031 = 0;
			HEX3Atmp_401033 = 0;
			LOC8 = 0;
			LOC8 = len_226364(n);
			HEX3Atmp_401033 = (LOC8 - 1);
			res_401036 = 0;
			{
				while (1) {
					tnode225816* LOC11;
					NimStringDesc* LOC12;
					if (!(res_401036 <= HEX3Atmp_401033)) goto LA10;
					i_401031 = res_401036;
					LOC11 = 0;
					LOC11 = HEX5BHEX5D_226698(n, i_401031);
					LOC12 = 0;
					LOC12 = getname_400948(d, LOC11, splitafter);
					result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
					res_401036 += 1;
				} LA10: ;
			}
		}
		LOC13 = 0;
		LOC13 = esc_358407((*d).Sup.Target, ((NimStringDesc*) &TMP4633), -1);
		result = resizeString(result, LOC13->Sup.len + 0);
appendString(result, LOC13);
	}
	break;
	default:
	{
		internalerror_197987((*n).Info, ((NimStringDesc*) &TMP4634));
		result = copyString(((NimStringDesc*) &TMP2108));
	}
	break;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, getplaindocstring_400550)(tnode225816* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2108));
	{
		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*) &TMP2107));
		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_400598;
				NI HEX3Atmp_400615;
				NI LOC20;
				NI res_400618;
				i_400598 = 0;
				HEX3Atmp_400615 = 0;
				LOC20 = 0;
				LOC20 = len_226364(n);
				HEX3Atmp_400615 = (NI64)(LOC20 - 1);
				res_400618 = 0;
				{
					while (1) {
						if (!(res_400618 <= HEX3Atmp_400615)) goto LA22;
						i_400598 = res_400618;
						result = getplaindocstring_400550((*n).kindU.S6.Sons->data[i_400598]);
						{
							if (!(0 < result->Sup.len)) goto LA25;
							goto BeforeRet;
						}
						LA25: ;
						res_400618 += 1;
					} LA22: ;
				}
			}
		}
		LA17: ;
	}
	LA13: ;
	BeforeRet: ;
	return result;
}

static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
	tcell45133* c;
	c = usrtocell_48846(p);
	{
		(*c).Refcount -= 8;
		if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA3;
		rtladdzct_50404(c);
	}
	LA3: ;
}

N_NIMCALL(trope177009*, genreccomment_400432)(tdocumentor400007* d, tnode225816* n) {
	trope177009* result;
	NimStringDesc* LOC5;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = gencomment_400398(d, n);
	result = torope_177076(LOC5);
	{
		if (!(result == NIM_NIL)) goto LA8;
		{
			if (!!(((*n).Kind >= ((NU8) 1) && (*n).Kind <= ((NU8) 23)))) goto LA12;
			{
				NI i_400497;
				NI HEX3Atmp_400530;
				NI LOC15;
				NI res_400533;
				i_400497 = 0;
				HEX3Atmp_400530 = 0;
				LOC15 = 0;
				LOC15 = len_226364(n);
				HEX3Atmp_400530 = (NI64)(LOC15 - 1);
				res_400533 = 0;
				{
					while (1) {
						if (!(res_400533 <= HEX3Atmp_400530)) goto LA17;
						i_400497 = res_400533;
						result = genreccomment_400432(d, (*n).kindU.S6.Sons->data[i_400497]);
						{
							if (!!((result == NIM_NIL))) goto LA20;
							goto BeforeRet;
						}
						LA20: ;
						res_400533 += 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_400103)(trope177009** dest, NimStringDesc* xml, NimStringDesc* tex, trope177009** args, NI argsLen0) {
	{
		if (!!((gcmd_169120 == ((NU8) 17)))) goto LA3;
		appf_177115(dest, xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		appf_177115(dest, tex, args, argsLen0);
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, complexname_401201)(NU8 k, tnode225816* n, NimStringDesc* basename) {
	NimStringDesc* result;
	result = 0;
	result = copyString(basename);
	switch (k) {
	case ((NU8) 12):
	{
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP4662));
	}
	break;
	case ((NU8) 17):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4663));
	}
	break;
	case ((NU8) 13):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4664));
	}
	break;
	case ((NU8) 14):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4665));
	}
	break;
	case ((NU8) 18):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4666));
	}
	break;
	case ((NU8) 16):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4667));
	}
	break;
	default:
	{
	}
	break;
	}
	{
		NIM_BOOL LOC10;
		NI LOC11;
		tnode225816* LOC13;
		tnode225816* LOC16;
		NimStringDesc* LOC17;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = len_226364(n);
		LOC10 = (3 < LOC11);
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_226698(n, 3);
		LOC10 = ((*LOC13).Kind == ((NU8) 76));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_226698(n, 3);
		LOC17 = 0;
		LOC17 = renderparamtypes_399862(LOC16, ((NimStringDesc*) &TMP4662));
		result = resizeString(result, LOC17->Sup.len + 0);
appendString(result, LOC17);
	}
	LA14: ;
	return result;
}

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

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

N_NIMCALL(trope177009*, ropeformatnamedvars_400166)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope177009** varvalues, NI varvaluesLen0) {
	trope177009* 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_177052(&result, varvalues[num]);
					num += 1;
					i += 1;
				}
				break;
				case 36:
				{
					app_177060(&result, ((NimStringDesc*) &TMP4675));
					i += 1;
				}
				break;
				case 48 ... 57:
				{
					NI j;
					j = 0;
					{
						while (1) {
							j = (NI64)((NI64)((NI64)(j * 10) + ((NI) (((NU8)(frmt->data[i]))))) - 48);
							i += 1;
							{
								NIM_BOOL LOC14;
								LOC14 = 0;
								LOC14 = ((NI64)((NI64)(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 (!((NI64)((varvaluesLen0-1) + 1) < j)) goto LA20;
						internalerror_198006(((NimStringDesc*) &TMP4676));
					}
					LA20: ;
					num = j;
					app_177052(&result, varvalues[(NI64)(j - 1)]);
				}
				break;
				case 65 ... 90:
				case 97 ... 122:
				case 128 ... 255:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2108));
					{
						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_400126(varnames, varnamesLen0, id);
					{
						if (!(0 <= idx)) goto LA31;
						app_177052(&result, varvalues[idx]);
					}
					goto LA29;
					LA31: ;
					{
						rawmessage_197733(((NU16) 152), id);
					}
					LA29: ;
				}
				break;
				case 123:
				{
					NimStringDesc* id;
					NI idx;
					id = copyString(((NimStringDesc*) &TMP2108));
					i += 1;
					{
						while (1) {
							if (!!(((NU8)(frmt->data[i]) == (NU8)(125)))) goto LA36;
							{
								if (!((NU8)(frmt->data[i]) == (NU8)(0))) goto LA39;
								rawmessage_197733(((NU16) 23), ((NimStringDesc*) &TMP4677));
							}
							LA39: ;
							id = addChar(id, frmt->data[i]);
							i += 1;
						} LA36: ;
					}
					i += 1;
					idx = getvaridx_400126(varnames, varnamesLen0, id);
					{
						if (!(0 <= idx)) goto LA43;
						app_177052(&result, varvalues[idx]);
					}
					goto LA41;
					LA43: ;
					{
						rawmessage_197733(((NU16) 152), id);
					}
					LA41: ;
				}
				break;
				default:
				{
					internalerror_198006(((NimStringDesc*) &TMP4676));
				}
				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 <= (NI64)(i - 1))) goto LA56;
				LOC58 = 0;
				LOC58 = copyStrLast(frmt, start, (NI64)(i - 1));
				app_177060(&result, LOC58);
			}
			LA56: ;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NIM_BOOL, iscallable_401223)(tnode225816* 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_401233)(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, (NI64)(result->Sup.len - 1));
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4699));
	}
	LA4: ;
	{
		if (!(pos < 100)) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	pos = nsuFindCharSet(result, TMP4700, 0);
	last = (NI64)(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*) &TMP4699));
	}
	LA14: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, genitem_401416)(tdocumentor400007* d, tnode225816* n, tnode225816* namenode, NU8 k) {
	NimStringDesc* name;
	trope177009* namerope;
	NimStringDesc* plaindocstring;
	trope177009* result;
	NimStringDesc* literal;
	NimStringDesc* plainname;
	NU8 kind;
	trope177009* comm;
	tsrcgen250023 r;
	trope177009* plainnamerope;
	NimStringDesc* LOC42;
	NimStringDesc* LOC43;
	NimStringDesc* cleanplainsymbol;
	NimStringDesc* complexsymbol;
	trope177009* plainsymbolrope;
	trope177009* plainsymbolencrope;
	NimStringDesc* LOC44;
	trope177009* itemidrope;
	NimStringDesc* symbolorid;
	trope177009* symboloridrope;
	trope177009* symboloridencrope;
	NimStringDesc* LOC45;
	trope177009* seesrcrope;
	NimStringDesc* docitemseesrc;
	NimStringDesc* LOC59;
	TY401549 LOC60;
	trope177009* LOC61;
	NimStringDesc* LOC62;
	TY401558 LOC63;
	NimStringDesc* LOC64;
	trope177009* LOC65;
	NimStringDesc* linktitle;
	NimStringDesc* LOC66;
	NimStringDesc* LOC67;
	NimStringDesc* LOC68;
	trstgenerator358016* LOC79;
	NimStringDesc* LOC80;
	NimStringDesc* LOC81;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_400778(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_400948(d, namenode, -1);
	namerope = torope_177076(name);
	plaindocstring = getplaindocstring_400550(n);
	result = NIM_NIL;
	literal = copyString(((NimStringDesc*) &TMP2108));
	plainname = copyString(((NimStringDesc*) &TMP2108));
	kind = ((NU8) 1);
	comm = genreccomment_400432(d, n);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_250067((&r), n, 94);
	{
		while (1) {
			getnexttok_250078((&r), (&kind), (&literal));
			{
				if (!(kind == ((NU8) 1))) goto LA10;
				goto LA6;
			}
			LA10: ;
			plainname = resizeString(plainname, literal->Sup.len + 0);
appendString(plainname, literal);
		}
	} LA6: ;
	inittokrender_250067((&r), n, 14);
	{
		while (1) {
			getnexttok_250078((&r), (&kind), (&literal));
			switch (kind) {
			case ((NU8) 1):
			{
				goto LA12;
			}
			break;
			case ((NU8) 112):
			{
				TY177515 LOC16;
				NimStringDesc* LOC17;
				memset((void*)LOC16, 0, sizeof(LOC16));
				LOC17 = 0;
				LOC17 = esc_358407((*d).Sup.Target, literal, -1);
				LOC16[0] = torope_177076(LOC17);
				dispa_400103(&result, ((NimStringDesc*) &TMP4635), ((NimStringDesc*) &TMP4636), LOC16, 1);
			}
			break;
			case ((NU8) 3) ... ((NU8) 71):
			{
				TY177515 LOC19;
				memset((void*)LOC19, 0, sizeof(LOC19));
				LOC19[0] = torope_177076(literal);
				dispa_400103(&result, ((NimStringDesc*) &TMP4637), ((NimStringDesc*) &TMP4638), LOC19, 1);
			}
			break;
			case ((NU8) 111):
			{
				TY177515 LOC21;
				NimStringDesc* LOC22;
				memset((void*)LOC21, 0, sizeof(LOC21));
				LOC22 = 0;
				LOC22 = esc_358407((*d).Sup.Target, literal, -1);
				LOC21[0] = torope_177076(LOC22);
				dispa_400103(&result, ((NimStringDesc*) &TMP4639), ((NimStringDesc*) &TMP4640), LOC21, 1);
			}
			break;
			case ((NU8) 86) ... ((NU8) 88):
			{
				TY177515 LOC24;
				NimStringDesc* LOC25;
				memset((void*)LOC24, 0, sizeof(LOC24));
				LOC25 = 0;
				LOC25 = esc_358407((*d).Sup.Target, literal, -1);
				LOC24[0] = torope_177076(LOC25);
				dispa_400103(&result, ((NimStringDesc*) &TMP4641), ((NimStringDesc*) &TMP4642), LOC24, 1);
			}
			break;
			case ((NU8) 91):
			{
				TY177515 LOC27;
				NimStringDesc* LOC28;
				memset((void*)LOC27, 0, sizeof(LOC27));
				LOC28 = 0;
				LOC28 = esc_358407((*d).Sup.Target, literal, -1);
				LOC27[0] = torope_177076(LOC28);
				dispa_400103(&result, ((NimStringDesc*) &TMP4643), ((NimStringDesc*) &TMP4644), LOC27, 1);
			}
			break;
			case ((NU8) 72) ... ((NU8) 81):
			{
				TY177515 LOC30;
				NimStringDesc* LOC31;
				memset((void*)LOC30, 0, sizeof(LOC30));
				LOC31 = 0;
				LOC31 = esc_358407((*d).Sup.Target, literal, -1);
				LOC30[0] = torope_177076(LOC31);
				dispa_400103(&result, ((NimStringDesc*) &TMP4645), ((NimStringDesc*) &TMP4646), LOC30, 1);
			}
			break;
			case ((NU8) 82) ... ((NU8) 85):
			{
				TY177515 LOC33;
				NimStringDesc* LOC34;
				memset((void*)LOC33, 0, sizeof(LOC33));
				LOC34 = 0;
				LOC34 = esc_358407((*d).Sup.Target, literal, -1);
				LOC33[0] = torope_177076(LOC34);
				dispa_400103(&result, ((NimStringDesc*) &TMP4647), ((NimStringDesc*) &TMP4648), LOC33, 1);
			}
			break;
			case ((NU8) 2):
			{
				TY177515 LOC36;
				NimStringDesc* LOC37;
				memset((void*)LOC36, 0, sizeof(LOC36));
				LOC37 = 0;
				LOC37 = esc_358407((*d).Sup.Target, literal, -1);
				LOC36[0] = torope_177076(LOC37);
				dispa_400103(&result, ((NimStringDesc*) &TMP4649), ((NimStringDesc*) &TMP4650), LOC36, 1);
			}
			break;
			case ((NU8) 114):
			case ((NU8) 0):
			{
				app_177060(&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):
			{
				TY177515 LOC40;
				NimStringDesc* LOC41;
				memset((void*)LOC40, 0, sizeof(LOC40));
				LOC41 = 0;
				LOC41 = esc_358407((*d).Sup.Target, literal, -1);
				LOC40[0] = torope_177076(LOC41);
				dispa_400103(&result, ((NimStringDesc*) &TMP4651), ((NimStringDesc*) &TMP4652), LOC40, 1);
			}
			break;
			}
		}
	} LA12: ;
	(*d).Id += 1;
	LOC42 = 0;
	LOC42 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
	LOC43 = 0;
	LOC43 = escape_391893(LOC42);
	plainnamerope = torope_177076(LOC43);
	cleanplainsymbol = renderplainsymbolname_397013(namenode);
	complexsymbol = complexname_401201(k, n, cleanplainsymbol);
	plainsymbolrope = torope_177076(cleanplainsymbol);
	LOC44 = 0;
	LOC44 = encodeurl_395004(cleanplainsymbol);
	plainsymbolencrope = torope_177076(LOC44);
	itemidrope = torope_177082(((NI64) ((*d).Id)));
	symbolorid = newuniqueplainsymbol_401170(d, complexsymbol);
	symboloridrope = torope_177076(symbolorid);
	LOC45 = 0;
	LOC45 = encodeurl_395004(symbolorid);
	symboloridencrope = torope_177076(LOC45);
	seesrcrope = NIM_NIL;
	docitemseesrc = getconfigvar_169350(((NimStringDesc*) &TMP4674));
	{
		NIM_BOOL LOC48;
		trope177009* urlrope;
		TY588896 LOC52;
		NimStringDesc* LOC53;
		NimStringDesc* LOC54;
		TY177515 LOC55;
		TY554018 LOC56;
		NimStringDesc* LOC57;
		NimStringDesc* LOC58;
		LOC48 = 0;
		LOC48 = (0 < docitemseesrc->Sup.len);
		if (!(LOC48)) goto LA49;
		LOC48 = (0 < docseesrcurl_169125->Sup.len);
		LA49: ;
		if (!LOC48) goto LA50;
		memset((void*)LOC52, 0, sizeof(LOC52));
		LOC53 = 0;
		LOC53 = tofilename_197025((*n).Info.Fileindex);
		LOC52[0] = torope_177076(LOC53);
		LOC54 = 0;
		LOC54 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC52[1] = torope_177076(LOC54);
		urlrope = ropeformatnamedvars_400166(docseesrcurl_169125, TMP4678, 2, LOC52, 2);
		memset((void*)LOC55, 0, sizeof(LOC55));
		memset((void*)LOC56, 0, sizeof(LOC56));
		LOC57 = 0;
		LOC57 = tofilename_197025((*n).Info.Fileindex);
		LOC56[0] = torope_177076(LOC57);
		LOC58 = 0;
		LOC58 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC56[1] = torope_177076(LOC58);
		LOC56[2] = urlrope;
		LOC55[0] = ropeformatnamedvars_400166(docitemseesrc, TMP4682, 3, LOC56, 3);
		dispa_400103(&seesrcrope, ((NimStringDesc*) &TMP4681), ((NimStringDesc*) &TMP2108), LOC55, 1);
	}
	LA50: ;
	LOC59 = 0;
	LOC59 = getconfigvar_169350(((NimStringDesc*) &TMP4684));
	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_400166(LOC59, TMP4685, 10, LOC60, 10);
	app_177052(&(*d).Section[(k)- 0], LOC61);
	LOC62 = 0;
	LOC62 = getconfigvar_169350(((NimStringDesc*) &TMP4696));
	memset((void*)LOC63, 0, sizeof(LOC63));
	LOC64 = 0;
	LOC64 = getname_400948(d, namenode, (*d).Sup.Splitafter);
	LOC63[0] = torope_177076(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_400166(LOC62, TMP4697, 9, LOC63, 9);
	app_177052(&(*d).Toc[(k)- 0], LOC65);
	LOC66 = 0;
	LOC67 = 0;
	LOC67 = nosextractFilename((*d).Sup.Filename);
	LOC68 = 0;
	LOC68 = noschangeFileExt(LOC67, ((NimStringDesc*) &TMP2108));
	LOC66 = rawNewString(LOC68->Sup.len + 3);
appendString(LOC66, LOC68);
appendString(LOC66, ((NimStringDesc*) &TMP4698));
	linktitle = LOC66;
	{
		NIM_BOOL LOC71;
		NimStringDesc* LOC74;
		NimStringDesc* LOC75;
		LOC71 = 0;
		LOC71 = iscallable_401223(n);
		if (!LOC71) goto LA72;
		LOC74 = 0;
		LOC74 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
		LOC75 = 0;
		LOC75 = escape_391893(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_391893(LOC77);
		linktitle = resizeString(linktitle, LOC78->Sup.len + 0);
appendString(linktitle, LOC78);
	}
	LA69: ;
	LOC79 = 0;
	LOC79 = &d->Sup;
	LOC80 = 0;
	LOC80 = docstringsummary_401233(plaindocstring);
	LOC81 = 0;
	LOC81 = escape_391893(LOC80);
	setindexterm_358710(LOC79, symbolorid, name, linktitle, LOC81);
	BeforeRet: ;
}

static N_INLINE(NI, sonslen_226249)(tnode225816* 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_401618)(tnode225816* n) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*n).Kind == ((NU8) 2));
	if (!(LOC1)) goto LA2;
	LOC1 = identeq_200493((*n).kindU.S5.Ident, ((NimStringDesc*) &TMP4701));
	LA2: ;
	result = LOC1;
	return result;
}

static N_INLINE(tnode225816*, lastson_226261)(tnode225816* n) {
	tnode225816* result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = sonslen_226249(n);
	result = (*n).kindU.S6.Sons->data[(NI64)(LOC1 - 1)];
	return result;
}

N_NIMCALL(void, tracedeps_401651)(tdocumentor400007* d, tnode225816* n) {
	TY177515 LOC5;
	NimStringDesc* LOC6;
	{
		if (!!(((*d).Section[(((NU8) 6))- 0] == NIM_NIL))) goto LA3;
		app_177060(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4702));
	}
	LA3: ;
	memset((void*)LOC5, 0, sizeof(LOC5));
	LOC6 = 0;
	LOC6 = getmodulename_298018(n);
	LOC5[0] = torope_177076(LOC6);
	dispa_400103(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4703), ((NimStringDesc*) &TMP4681), LOC5, 1);
}

N_NIMCALL(void, generatedoc_401685)(tdocumentor400007* d, tnode225816* n) {
	switch ((*n).Kind) {
	case ((NU8) 125):
	{
		NimStringDesc* LOC2;
		LOC2 = 0;
		LOC2 = gencomment_400398(d, n);
		app_177060(&(*d).Moddesc, LOC2);
	}
	break;
	case ((NU8) 79):
	{
		documentraises_379621(n);
		genitem_401416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_379621(n);
		genitem_401416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_379621(n);
		genitem_401416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		genitem_401416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		genitem_401416(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_379621(n);
		genitem_401416(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_402427;
			NI HEX3Atmp_402633;
			NI LOC11;
			NI res_402636;
			i_402427 = 0;
			HEX3Atmp_402633 = 0;
			LOC11 = 0;
			LOC11 = sonslen_226249(n);
			HEX3Atmp_402633 = (NI64)(LOC11 - 1);
			res_402636 = 0;
			{
				while (1) {
					if (!(res_402636 <= HEX3Atmp_402633)) goto LA13;
					i_402427 = res_402636;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_402427]).Kind == ((NU8) 125)))) goto LA16;
						genitem_401416(d, (*n).kindU.S6.Sons->data[i_402427], (*(*n).kindU.S6.Sons->data[i_402427]).kindU.S6.Sons->data[0], (((NU8) 7) + ((NI) ((NI64)(((NI) ((*n).Kind)) - 98)))));
					}
					LA16: ;
					res_402636 += 1;
				} LA13: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		{
			NI i_402536;
			NI HEX3Atmp_402639;
			NI LOC20;
			NI res_402642;
			i_402536 = 0;
			HEX3Atmp_402639 = 0;
			LOC20 = 0;
			LOC20 = sonslen_226249(n);
			HEX3Atmp_402639 = (NI64)(LOC20 - 1);
			res_402642 = 0;
			{
				while (1) {
					if (!(res_402642 <= HEX3Atmp_402639)) goto LA22;
					i_402536 = res_402642;
					generatedoc_401685(d, (*n).kindU.S6.Sons->data[i_402536]);
					res_402642 += 1;
				} LA22: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC26;
			tnode225816* LOC29;
			LOC26 = 0;
			LOC26 = checkforfalse_401618((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			if (!!(LOC26)) goto LA27;
			LOC29 = 0;
			LOC29 = lastson_226261((*n).kindU.S6.Sons->data[0]);
			generatedoc_401685(d, LOC29);
		}
		LA27: ;
	}
	break;
	case ((NU8) 116):
	{
		{
			NI i_402603;
			NI HEX3Atmp_402645;
			NI LOC32;
			NI res_402648;
			i_402603 = 0;
			HEX3Atmp_402645 = 0;
			LOC32 = 0;
			LOC32 = sonslen_226249(n);
			HEX3Atmp_402645 = (NI64)(LOC32 - 1);
			res_402648 = 0;
			{
				while (1) {
					if (!(res_402648 <= HEX3Atmp_402645)) goto LA34;
					i_402603 = res_402648;
					tracedeps_401651(d, (*n).kindU.S6.Sons->data[i_402603]);
					res_402648 += 1;
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 120):
	case ((NU8) 117):
	{
		tracedeps_401651(d, (*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
	}
	break;
	}
}

static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src) {
	{
		tcell45133* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_48846(src);
		(*c).Refcount += 8;
	}
	LA3: ;
	{
		tcell45133* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_48846((*dest));
		{
			(*c).Refcount -= 8;
			if (!((NU64)((*c).Refcount) < (NU64)(8))) goto LA11;
			rtladdzct_50404(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, gensection_403639)(tdocumentor400007* d, NU8 kind) {
	trope177009* title;
	NimStringDesc* LOC5;
	TY556046 LOC6;
	NimStringDesc* LOC7;
	TY556046 LOC8;
	{
		if (!((*d).Section[(kind)- 0] == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	title = torope_177076(sectionnames_403643[(kind)- 6]);
	LOC5 = 0;
	LOC5 = getconfigvar_169350(((NimStringDesc*) &TMP4719));
	memset((void*)LOC6, 0, sizeof(LOC6));
	LOC6[0] = torope_177082(((NI64) (kind)));
	LOC6[1] = title;
	LOC6[2] = torope_177082(((NI64) ((NI64)(((NI) (kind)) + 50))));
	LOC6[3] = (*d).Section[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).Section[(kind)- 0]), ropeformatnamedvars_400166(LOC5, TMP4720, 4, LOC6, 4));
	LOC7 = 0;
	LOC7 = getconfigvar_169350(((NimStringDesc*) &TMP4725));
	memset((void*)LOC8, 0, sizeof(LOC8));
	LOC8[0] = torope_177082(((NI64) (kind)));
	LOC8[1] = title;
	LOC8[2] = torope_177082(((NI64) ((NI64)(((NI) (kind)) + 50))));
	LOC8[3] = (*d).Toc[(kind)- 0];
	asgnRefNoCycle((void**) (&(*d).Toc[(kind)- 0]), ropeformatnamedvars_400166(LOC7, TMP4720, 4, LOC8, 4));
	BeforeRet: ;
}

N_NIMCALL(trope177009*, genoutfile_403722)(tdocumentor400007* d) {
	trope177009* result;
	trope177009* code;
	trope177009* content;
	NimStringDesc* title;
	NI j;
	NimStringDesc* tmp;
	trstgenerator358016* LOC1;
	trope177009* toc;
	NimStringDesc* bodyname;
	NimStringDesc* LOC28;
	TY558098 LOC29;
	NimStringDesc* LOC30;
	NimStringDesc* LOC31;
	result = 0;
	code = 0;
	content = 0;
	title = copyString(((NimStringDesc*) &TMP2108));
	j = 0;
	tmp = copyString(((NimStringDesc*) &TMP2108));
	LOC1 = 0;
	LOC1 = &d->Sup;
	rendertocentries_364554(LOC1, (&j), 1, (&tmp));
	toc = torope_177076(tmp);
	{
		NU8 i_403783;
		NU8 res_403864;
		i_403783 = 0;
		res_403864 = ((NU8) 0);
		{
			while (1) {
				if (!(res_403864 <= ((NU8) 25))) goto LA4;
				i_403783 = res_403864;
				gensection_403639(d, i_403783);
				app_177052(&toc, (*d).Toc[(i_403783)- 0]);
				res_403864 += 1;
			} LA4: ;
		}
	}
	{
		NimStringDesc* LOC9;
		TY177515 LOC10;
		if (!!((toc == NIM_NIL))) goto LA7;
		LOC9 = 0;
		LOC9 = getconfigvar_169350(((NimStringDesc*) &TMP4726));
		memset((void*)LOC10, 0, sizeof(LOC10));
		LOC10[0] = toc;
		toc = ropeformatnamedvars_400166(LOC9, TMP4727, 1, LOC10, 1);
	}
	LA7: ;
	{
		NU8 i_403824;
		NU8 res_403871;
		i_403824 = 0;
		res_403871 = ((NU8) 0);
		{
			while (1) {
				if (!(res_403871 <= ((NU8) 25))) goto LA13;
				i_403824 = res_403871;
				app_177052(&code, (*d).Section[(i_403824)- 0]);
				res_403871 += 1;
			} LA13: ;
		}
	}
	{
		trstgenerator358016* 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_358710(LOC18, ((NimStringDesc*) &TMP2108), title, ((NimStringDesc*) &TMP2108), ((NimStringDesc*) &TMP2108));
	}
	goto LA14;
	LA16: ;
	{
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		NimStringDesc* LOC22;
		LOC20 = 0;
		LOC21 = 0;
		LOC21 = noschangeFileExt((*d).Sup.Filename, ((NimStringDesc*) &TMP2108));
		LOC22 = 0;
		LOC22 = nosextractFilename(LOC21);
		LOC20 = rawNewString(LOC22->Sup.len + 7);
appendString(LOC20, ((NimStringDesc*) &TMP4728));
appendString(LOC20, LOC22);
		title = LOC20;
	}
	LA14: ;
	{
		if (!(*d).Sup.Hastoc) goto LA25;
		bodyname = copyString(((NimStringDesc*) &TMP4729));
	}
	goto LA23;
	LA25: ;
	{
		bodyname = copyString(((NimStringDesc*) &TMP4730));
	}
	LA23: ;
	LOC28 = 0;
	LOC28 = getconfigvar_169350(bodyname);
	memset((void*)LOC29, 0, sizeof(LOC29));
	LOC29[0] = torope_177076(title);
	LOC29[1] = toc;
	LOC29[2] = (*d).Moddesc;
	LOC30 = 0;
	LOC30 = ntgetDateStr();
	LOC29[3] = torope_177076(LOC30);
	LOC31 = 0;
	LOC31 = ntgetClockStr();
	LOC29[4] = torope_177076(LOC31);
	LOC29[5] = code;
	content = ropeformatnamedvars_400166(LOC28, TMP4731, 6, LOC29, 6);
	{
		NimStringDesc* LOC36;
		TY403855 LOC37;
		NimStringDesc* LOC38;
		NimStringDesc* LOC39;
		if (!!(((gglobaloptions_169118 &(1<<((((NU8) 4))&31)))!=0))) goto LA34;
		LOC36 = 0;
		LOC36 = getconfigvar_169350(((NimStringDesc*) &TMP4737));
		memset((void*)LOC37, 0, sizeof(LOC37));
		LOC37[0] = torope_177076(title);
		LOC37[1] = toc;
		LOC37[2] = (*d).Moddesc;
		LOC38 = 0;
		LOC38 = ntgetDateStr();
		LOC37[3] = torope_177076(LOC38);
		LOC39 = 0;
		LOC39 = ntgetClockStr();
		LOC37[4] = torope_177076(LOC39);
		LOC37[5] = content;
		LOC37[6] = torope_177076((*d).Sup.Meta[(((NU8) 3))- 0]);
		LOC37[7] = torope_177076((*d).Sup.Meta[(((NU8) 4))- 0]);
		code = ropeformatnamedvars_400166(LOC36, TMP4738, 8, LOC37, 8);
	}
	goto LA32;
	LA34: ;
	{
		code = content;
	}
	LA32: ;
	result = code;
	return result;
}

N_NIMCALL(void, writeoutput_403920)(tdocumentor400007* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning) {
	trope177009* content;
	content = genoutfile_403722(d);
	{
		if (!((gglobaloptions_169118 &(1<<((((NU8) 22))&31)))!=0)) goto LA3;
		writerope_178065(stdout, content);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		LOC6 = 0;
		LOC6 = getoutfile_169370(filename, outext);
		writerope_178423(content, LOC6, usewarning);
	}
	LA1: ;
}

N_NIMCALL(void, generateindex_403897)(tdocumentor400007* d) {
	{
		trstgenerator358016* LOC5;
		NimStringDesc* LOC6;
		TY117804 LOC7;
		TY117804 LOC8;
		NimStringDesc* LOC9;
		if (!((gglobaloptions_169118 &(1<<((((NU8) 30))&31)))!=0)) goto LA3;
		LOC5 = 0;
		LOC5 = &d->Sup;
		LOC6 = 0;
		memset((void*)(&LOC7), 0, sizeof(LOC7));
		nossplitFile(outfile_169124, (&LOC7));
		memset((void*)(&LOC8), 0, sizeof(LOC8));
		nossplitFile((*d).Sup.Filename, (&LOC8));
		LOC9 = 0;
		LOC9 = HEX2F_117499(LOC7.Field0, LOC8.Field1);
		LOC6 = rawNewString(LOC9->Sup.len + 4);
appendString(LOC6, LOC9);
appendString(LOC6, ((NimStringDesc*) &TMP4742));
		writeindexfile_358287(LOC5, LOC6);
	}
	LA3: ;
}

N_NIMCALL(void, commanddoc_403946)(void) {
	tnode225816* ast;
	tdocumentor400007* d;
	ast = parsefile_260041(gprojectmainidx_169237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_400064(gprojectfull_169236, gconfigvars_169231);
	(*d).Sup.Hastoc = NIM_TRUE;
	generatedoc_401685(d, ast);
	writeoutput_403920(d, gprojectfull_169236, ((NimStringDesc*) &TMP4741), NIM_FALSE);
	generateindex_403897(d);
	BeforeRet: ;
}

N_NIMCALL(void, commandrstaux_403973)(NimStringDesc* filename, NimStringDesc* outext) {
	NimStringDesc* filen;
	tdocumentor400007* d;
	trstnode342011* rst;
	NimStringDesc* LOC1;
	NimStringDesc* moddesc;
	trstgenerator358016* LOC2;
	filen = nosaddFileExt(filename, ((NimStringDesc*) &TMP4748));
	d = newdocumentor_400064(filen, gconfigvars_169231);
	LOC1 = 0;
	LOC1 = readfile_13042(filen);
	rst = parserst_400048(LOC1, filen, 0, 1, (&(*d).Sup.Hastoc), 4);
	moddesc = rawNewString(30000);
	LOC2 = 0;
	LOC2 = &d->Sup;
	renderrsttoout_358579(LOC2, rst, (&moddesc));
	asgnRefNoCycle((void**) (&(*d).Moddesc), torope_177076(moddesc));
	writeoutput_403920(d, filename, outext, NIM_FALSE);
	generateindex_403897(d);
}

N_NIMCALL(void, commandrst2html_403992)(void) {
	commandrstaux_403973(gprojectfull_169236, ((NimStringDesc*) &TMP4741));
}

N_NIMCALL(void, commandrst2tex_404000)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_358332; splitter_358332 = copyStringRC1(((NimStringDesc*) &TMP4750));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	commandrstaux_403973(gprojectfull_169236, ((NimStringDesc*) &TMP4751));
}

N_NIMCALL(jsonnodeobj336042*, genjsonitem_401586)(tdocumentor400007* d, tnode225816* n, tnode225816* namenode, NU8 k) {
	jsonnodeobj336042* result;
	NimStringDesc* name;
	NimStringDesc* comm;
	trope177009* LOC6;
	tsrcgen250023 r;
	TY401609 LOC7;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_400778(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_400948(d, namenode, -1);
	LOC6 = 0;
	LOC6 = genreccomment_400432(d, n);
	comm = ropetostr_177101(LOC6);
	memset((void*)(&r), 0, sizeof(r));
	inittokrender_250067((&r), n, 14);
	memset((void*)LOC7, 0, sizeof(LOC7));
	LOC7[0].Field0 = copyString(((NimStringDesc*) &TMP4686));
	LOC7[0].Field1 = HEX25_336448(name);
	LOC7[1].Field0 = copyString(((NimStringDesc*) &TMP4760));
	LOC7[1].Field1 = HEX25_336448(reprEnum(k, (&NTI225445)));
	result = HEX25_336608(LOC7, 2);
	{
		NIM_BOOL LOC10;
		jsonnodeobj336042* 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_336448(comm);
		HEX5BHEX5DHEX3D_339240(result, ((NimStringDesc*) &TMP4761), LOC14);
	}
	LA12: ;
	{
		jsonnodeobj336042* LOC19;
		if (!!((r.Buf == NIM_NIL))) goto LA17;
		LOC19 = 0;
		LOC19 = HEX25_336448(r.Buf);
		HEX5BHEX5DHEX3D_339240(result, ((NimStringDesc*) &TMP4762), LOC19);
	}
	LA17: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(jsonnodeobj336042*, generatejson_402683)(tdocumentor400007* d, tnode225816* n, jsonnodeobj336042* jarray) {
	jsonnodeobj336042* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 125):
	{
		{
			NIM_BOOL LOC4;
			NimStringDesc* stripped;
			NimStringDesc* LOC8;
			TY402693 LOC9;
			LOC4 = 0;
			LOC4 = !(((*n).Comment == NIM_NIL));
			if (!(LOC4)) goto LA5;
			LOC4 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP2107));
			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*) &TMP4759));
			LOC9[0].Field1 = HEX25_336448(stripped);
			result = HEX25_336608(LOC9, 1);
		}
		LA6: ;
	}
	break;
	case ((NU8) 79):
	{
		documentraises_379621(n);
		result = genjsonitem_401586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_379621(n);
		result = genjsonitem_401586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_379621(n);
		result = genjsonitem_401586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		result = genjsonitem_401586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		result = genjsonitem_401586(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_379621(n);
		result = genjsonitem_401586(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_403604;
			NI LOC18;
			NI res_403607;
			i_403427 = 0;
			HEX3Atmp_403604 = 0;
			LOC18 = 0;
			LOC18 = sonslen_226249(n);
			HEX3Atmp_403604 = (NI64)(LOC18 - 1);
			res_403607 = 0;
			{
				while (1) {
					if (!(res_403607 <= HEX3Atmp_403604)) goto LA20;
					i_403427 = res_403607;
					{
						if (!!(((*(*n).kindU.S6.Sons->data[i_403427]).Kind == ((NU8) 125)))) goto LA23;
						result = genjsonitem_401586(d, (*n).kindU.S6.Sons->data[i_403427], (*(*n).kindU.S6.Sons->data[i_403427]).kindU.S6.Sons->data[0], (((NU8) 7) + ((NI) ((NI64)(((NI) ((*n).Kind)) - 98)))));
					}
					LA23: ;
					res_403607 += 1;
				} LA20: ;
			}
		}
	}
	break;
	case ((NU8) 115):
	{
		jsonnodeobj336042* elem;
		elem = jarray;
		{
			NIM_BOOL LOC28;
			LOC28 = 0;
			LOC28 = HEX3DHEX3D_336893(elem, NIM_NIL);
			if (!LOC28) goto LA29;
			elem = newjarray_336389();
		}
		LA29: ;
		{
			NI i_403539;
			NI HEX3Atmp_403610;
			NI LOC32;
			NI res_403613;
			i_403539 = 0;
			HEX3Atmp_403610 = 0;
			LOC32 = 0;
			LOC32 = sonslen_226249(n);
			HEX3Atmp_403610 = (NI64)(LOC32 - 1);
			res_403613 = 0;
			{
				while (1) {
					jsonnodeobj336042* r;
					if (!(res_403613 <= HEX3Atmp_403610)) goto LA34;
					i_403539 = res_403613;
					r = generatejson_402683(d, (*n).kindU.S6.Sons->data[i_403539], elem);
					{
						NIM_BOOL LOC37;
						LOC37 = 0;
						LOC37 = HEX3DHEX3D_336893(r, NIM_NIL);
						if (!!(LOC37)) goto LA38;
						add_338862(elem, r);
						{
							NIM_BOOL LOC42;
							LOC42 = 0;
							LOC42 = HEX3DHEX3D_336893(result, NIM_NIL);
							if (!LOC42) goto LA43;
							result = elem;
						}
						LA43: ;
					}
					LA38: ;
					res_403613 += 1;
				} LA34: ;
			}
		}
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC48;
			NIM_BOOL LOC49;
			NIM_BOOL LOC51;
			tnode225816* LOC54;
			jsonnodeobj336042* LOC55;
			LOC48 = 0;
			LOC49 = 0;
			LOC49 = checkforfalse_401618((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			LOC48 = !(LOC49);
			if (!(LOC48)) goto LA50;
			LOC51 = 0;
			LOC51 = HEX3DHEX3D_336893(jarray, NIM_NIL);
			LOC48 = !(LOC51);
			LA50: ;
			if (!LOC48) goto LA52;
			LOC54 = 0;
			LOC54 = lastson_226261((*n).kindU.S6.Sons->data[0]);
			LOC55 = 0;
			LOC55 = generatejson_402683(d, LOC54, jarray);
		}
		LA52: ;
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

N_NIMCALL(void, commandjson_404008)(void) {
	tnode225816* ast;
	tdocumentor400007* d;
	jsonnodeobj336042* json;
	trope177009* content;
	NimStringDesc* LOC5;
	ast = parsefile_260041(gprojectmainidx_169237);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_400064(gprojectfull_169236, gconfigvars_169231);
	(*d).Sup.Hastoc = NIM_TRUE;
	json = generatejson_402683(d, ast, NIM_NIL);
	LOC5 = 0;
	LOC5 = pretty_340621(json, 2);
	content = newrope_177176(LOC5);
	{
		if (!((gglobaloptions_169118 &(1<<((((NU8) 22))&31)))!=0)) goto LA8;
		writerope_178065(stdout, content);
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC11;
		NimStringDesc* LOC12;
		LOC11 = 0;
		LOC11 = getoutfile_169370(gprojectfull_169236, ((NimStringDesc*) &TMP4780));
		printf("%s\012", (LOC11)->data);
		LOC12 = 0;
		LOC12 = getoutfile_169370(gprojectfull_169236, ((NimStringDesc*) &TMP4780));
		writerope_178423(content, LOC12, NIM_FALSE);
	}
	LA6: ;
	BeforeRet: ;
}

N_NIMCALL(void, commandbuildindex_404054)(void) {
	trope177009* content;
	NimStringDesc* LOC1;
	trope177009* code;
	NimStringDesc* LOC2;
	TY403855 LOC3;
	NimStringDesc* LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	LOC1 = 0;
	LOC1 = mergeindexes_364149(gprojectfull_169236);
	content = torope_177076(LOC1);
	LOC2 = 0;
	LOC2 = getconfigvar_169350(((NimStringDesc*) &TMP4737));
	memset((void*)LOC3, 0, sizeof(LOC3));
	LOC3[0] = torope_177076(((NimStringDesc*) &TMP4820));
	LOC3[1] = NIM_NIL;
	LOC3[2] = NIM_NIL;
	LOC4 = 0;
	LOC4 = ntgetDateStr();
	LOC3[3] = torope_177076(LOC4);
	LOC5 = 0;
	LOC5 = ntgetClockStr();
	LOC3[4] = torope_177076(LOC5);
	LOC3[5] = content;
	LOC3[6] = NIM_NIL;
	LOC3[7] = NIM_NIL;
	code = ropeformatnamedvars_400166(LOC2, TMP4738, 8, LOC3, 8);
	LOC6 = 0;
	LOC6 = getoutfile_169370(((NimStringDesc*) &TMP4821), ((NimStringDesc*) &TMP4741));
	writerope_178423(code, LOC6, NIM_FALSE);
}
NIM_EXTERNC N_NOINLINE(void, HEX00_docgenInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_docgenDatInit)(void) {
static TNimNode* TMP4627[6];
static TNimNode TMP876[7];
NTI400007.size = sizeof(tdocumentor400007);
NTI400007.kind = 17;
NTI400007.base = (&NTI358016);
TMP4627[0] = &TMP876[1];
TMP876[1].kind = 1;
TMP876[1].offset = offsetof(tdocumentor400007, Moddesc);
TMP876[1].typ = (&NTI177007);
TMP876[1].name = "modDesc";
TMP4627[1] = &TMP876[2];
TMP876[2].kind = 1;
TMP876[2].offset = offsetof(tdocumentor400007, Id);
TMP876[2].typ = (&NTI108);
TMP876[2].name = "id";
TMP4627[2] = &TMP876[3];
NTI400005.size = sizeof(tsections400005);
NTI400005.kind = 16;
NTI400005.base = (&NTI177007);
NTI400005.flags = 2;
TMP876[3].kind = 1;
TMP876[3].offset = offsetof(tdocumentor400007, Toc);
TMP876[3].typ = (&NTI400005);
TMP876[3].name = "toc";
TMP4627[3] = &TMP876[4];
TMP876[4].kind = 1;
TMP876[4].offset = offsetof(tdocumentor400007, Section);
TMP876[4].typ = (&NTI400005);
TMP876[4].name = "section";
TMP4627[4] = &TMP876[5];
TMP876[5].kind = 1;
TMP876[5].offset = offsetof(tdocumentor400007, Indexvalfilename);
TMP876[5].typ = (&NTI149);
TMP876[5].name = "indexValFilename";
TMP4627[5] = &TMP876[6];
TMP876[6].kind = 1;
TMP876[6].offset = offsetof(tdocumentor400007, Seensymbols);
TMP876[6].typ = (&NTI131014);
TMP876[6].name = "seenSymbols";
TMP876[0].len = 6; TMP876[0].kind = 2; TMP876[0].sons = &TMP4627[0];
NTI400007.node = &TMP876[0];
NTI400009.size = sizeof(tdocumentor400007*);
NTI400009.kind = 22;
NTI400009.base = (&NTI400007);
NTI400009.marker = TMP4628;
}

