/* Generated by Nimrod Compiler v0.9.5 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, i386, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing  -I/build/nimrod/src/nimrod/lib -o compiler/nimcache/docgen.o compiler/nimcache/docgen.c */
#define NIM_INTBITS 32
#include "nimbase.h"

#include <string.h>

#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tsym188833 tsym188833;
typedef struct tdocumentor341005 tdocumentor341005;
typedef struct tnode188803 tnode188803;
typedef struct ttype188837 ttype188837;
typedef struct tlineinfo163527 tlineinfo163527;
typedef struct tident167019 tident167019;
typedef struct tnodeseq188797 tnodeseq188797;
typedef struct tidobj167013 tidobj167013;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct ttypeseq188835 ttypeseq188835;
typedef struct tscope188827 tscope188827;
typedef struct TY188933 TY188933;
typedef struct tinstantiation188823 tinstantiation188823;
typedef struct tstrtable188807 tstrtable188807;
typedef struct tsymseq188805 tsymseq188805;
typedef struct tloc188817 tloc188817;
typedef struct trope145007 trope145007;
typedef struct tlib188821 tlib188821;
typedef struct trstgenerator309012 trstgenerator309012;
typedef struct trstnode297009 trstnode297009;
typedef struct tstringtable121810 tstringtable121810;
typedef struct TY309028 TY309028;
typedef struct ttocentry309008 ttocentry309008;
typedef struct tcell41090 tcell41090;
typedef struct tcellset41102 tcellset41102;
typedef struct tgcheap43016 tgcheap43016;
typedef struct tcellseq41106 tcellseq41106;
typedef struct tpagedesc41098 tpagedesc41098;
typedef struct tmemregion23410 tmemregion23410;
typedef struct tsmallchunk22638 tsmallchunk22638;
typedef struct tllchunk23404 tllchunk23404;
typedef struct tbigchunk22640 tbigchunk22640;
typedef struct tintset22615 tintset22615;
typedef struct ttrunk22611 ttrunk22611;
typedef struct tavlnode23408 tavlnode23408;
typedef struct tgcstat43014 tgcstat43014;
typedef struct tsrcgen211021 tsrcgen211021;
typedef struct trendertokseq211019 trendertokseq211019;
typedef struct trendertok211017 trendertok211017;
typedef struct TY108700 TY108700;
typedef struct tjsonnode292105 tjsonnode292105;
typedef struct TY292613 TY292613;
typedef struct TY188922 TY188922;
typedef struct tlistentry118017 tlistentry118017;
typedef struct trstnodeseq297007 trstnodeseq297007;
typedef struct tkeyvaluepairseq121808 tkeyvaluepairseq121808;
typedef struct tkeyvaluepair121806 tkeyvaluepair121806;
typedef struct tbasechunk22636 tbasechunk22636;
typedef struct tfreecell22628 tfreecell22628;
typedef struct TY292120 TY292120;
typedef struct TY292125 TY292125;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  tlineinfo163527  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  tnode188803  {
ttype188837* Typ;
tlineinfo163527 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym188833* Sym;
} S4;
struct {tident167019* Ident;
} S5;
struct {tnodeseq188797* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef N_NIMCALL_PTR(void, TY2289) (void* p, NI op);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY2289 marker;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tidobj167013  {
  TNimObject Sup;
NI Id;
};
struct  tstrtable188807  {
NI Counter;
tsymseq188805* Data;
};
struct  tloc188817  {
NU8 K;
NU8 S;
NU8 Flags;
ttype188837* T;
trope145007* R;
trope145007* Heaproot;
NI A;
};
struct  tsym188833  {
  tidobj167013 Sup;
NU8 Kind;
union {
struct {ttypeseq188835* Typeinstcache;
tscope188827* Typscope;
} S1;
struct {TY188933* Procinstcache;
tscope188827* Scope;
} S2;
struct {TY188933* Usedgenerics;
tstrtable188807 Tab;
} S3;
} kindU;
NU16 Magic;
ttype188837* Typ;
tident167019* Name;
tlineinfo163527 Info;
tsym188833* Owner;
NU32 Flags;
tnode188803* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc188817 Loc;
tlib188821* Annex;
tnode188803* Constraint;
};
typedef N_NIMCALL_PTR(NimStringDesc*, tfindfilehandler298018) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, tmsghandler298016) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
struct  ttocentry309008  {
trstnode297009* N;
NimStringDesc* Refname;
NimStringDesc* Header;
};
typedef NimStringDesc* TY309036[5];
struct  trstgenerator309012  {
  TNimObject Sup;
NU8 Target;
tstringtable121810* Config;
NI Splitafter;
TY309028* Tocpart;
NIM_BOOL Hastoc;
NimStringDesc* Theindex;
NU8 Options;
tfindfilehandler298018 Findfile;
tmsghandler298016 Msghandler;
NimStringDesc* Filename;
TY309036 Meta;
NimStringDesc* Currentsection;
};
typedef trope145007* tsections341003[25];
struct  tdocumentor341005  {
  trstgenerator309012 Sup;
trope145007* Moddesc;
NI Id;
tsections341003 Toc;
tsections341003 Section;
NimStringDesc* Indexvalfilename;
tstringtable121810* Seensymbols;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tcell41090  {
NI Refcount;
TNimType* Typ;
};
struct  tcellseq41106  {
NI Len;
NI Cap;
tcell41090** D;
};
struct  tcellset41102  {
NI Counter;
NI Max;
tpagedesc41098* Head;
tpagedesc41098** Data;
};
typedef tsmallchunk22638* TY23422[512];
typedef ttrunk22611* ttrunkbuckets22613[256];
struct  tintset22615  {
ttrunkbuckets22613 Data;
};
struct  tmemregion23410  {
NI Minlargeobj;
NI Maxlargeobj;
TY23422 Freesmallchunks;
tllchunk23404* Llmem;
NI Currmem;
NI Maxmem;
NI Freemem;
NI Lastsize;
tbigchunk22640* Freechunkslist;
tintset22615 Chunkstarts;
tavlnode23408* Root;
tavlnode23408* Deleted;
tavlnode23408* Last;
tavlnode23408* Freeavlnodes;
};
struct  tgcstat43014  {
NI Stackscans;
NI Cyclecollections;
NI Maxthreshold;
NI Maxstacksize;
NI Maxstackcells;
NI Cycletablesize;
NI64 Maxpause;
};
struct  tgcheap43016  {
void* Stackbottom;
NI Cyclethreshold;
tcellseq41106 Zct;
tcellseq41106 Decstack;
tcellset41102 Cycleroots;
tcellseq41106 Tempstack;
NI Recgclock;
tmemregion23410 Region;
tgcstat43014 Stat;
};
struct  tident167019  {
  tidobj167013 Sup;
NimStringDesc* S;
tident167019* Next;
NI H;
};
struct  trendertok211017  {
NU8 Kind;
NI16 Length;
};
struct  tsrcgen211021  {
NI Indent;
NI Linelen;
NI Pos;
NI Idx;
trendertokseq211019* Tokens;
NimStringDesc* Buf;
NI Pendingnl;
tnodeseq188797* Comstack;
NU8 Flags;
NIM_BOOL Checkanon;
};
typedef trope145007* TY145497[1];
typedef NimStringDesc* TY137892[2];
typedef trope145007* TY503234[2];
typedef NimStringDesc* TY173034[3];
typedef trope145007* TY470214[3];
typedef NimStringDesc* TY174057[10];
typedef trope145007* TY342349[10];
typedef NimStringDesc* TY342356[9];
typedef trope145007* TY342358[9];
typedef NU8 TY90161[32];
typedef NimStringDesc* TY344480[13];
typedef NimStringDesc* TY165283[4];
typedef trope145007* TY471942[4];
typedef NimStringDesc* TY165002[1];
typedef NimStringDesc* TY344659[6];
typedef trope145007* TY473698[6];
typedef NimStringDesc* TY344680[8];
typedef trope145007* TY344682[8];
struct TY108700 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct TY292613 {
NimStringDesc* Field0;
tjsonnode292105* Field1;
};
typedef TY292613 TY343459[1];
typedef TY292613 TY342393[2];
struct  ttype188837  {
  tidobj167013 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq188835* Sons;
tnode188803* N;
tsym188833* Destructor;
tsym188833* Owner;
tsym188833* Sym;
NI64 Size;
NI Align;
tloc188817 Loc;
};
struct  tscope188827  {
NI Depthlevel;
tstrtable188807 Symbols;
tnodeseq188797* Usingsyms;
tscope188827* Parent;
};
struct  tinstantiation188823  {
tsym188833* Sym;
ttypeseq188835* Concretetypes;
TY188922* Usedby;
};
struct  trope145007  {
  TNimObject Sup;
trope145007* Left;
trope145007* Right;
NI Length;
NimStringDesc* Data;
};
struct  tlistentry118017  {
  TNimObject Sup;
tlistentry118017* Prev;
tlistentry118017* Next;
};
struct  tlib188821  {
  tlistentry118017 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope145007* Name;
tnode188803* Path;
};
struct  trstnode297009  {
NU8 Kind;
NimStringDesc* Text;
NI Level;
trstnodeseq297007* Sons;
};
struct tkeyvaluepair121806 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct  tstringtable121810  {
  TNimObject Sup;
NI Counter;
tkeyvaluepairseq121808* Data;
NU8 Mode;
};
typedef NI TY22618[16];
struct  tpagedesc41098  {
tpagedesc41098* Next;
NI Key;
TY22618 Bits;
};
struct  tbasechunk22636  {
NI Prevsize;
NI Size;
NIM_BOOL Used;
};
struct  tsmallchunk22638  {
  tbasechunk22636 Sup;
tsmallchunk22638* Next;
tsmallchunk22638* Prev;
tfreecell22628* Freelist;
NI Free;
NI Acc;
NF Data;
};
struct  tllchunk23404  {
NI Size;
NI Acc;
tllchunk23404* Next;
};
struct  tbigchunk22640  {
  tbasechunk22636 Sup;
tbigchunk22640* Next;
tbigchunk22640* Prev;
NI Align;
NF Data;
};
struct  ttrunk22611  {
ttrunk22611* Next;
NI Key;
TY22618 Bits;
};
typedef tavlnode23408* TY23414[2];
struct  tavlnode23408  {
TY23414 Link;
NI Key;
NI Upperbound;
NI Level;
};
struct  tjsonnode292105  {
NU8 Kind;
union {
struct {NimStringDesc* Str;
} S1;
struct {NI64 Num;
} S2;
struct {NF Fnum;
} S3;
struct {NIM_BOOL Bval;
} S4;
struct {TY292120* Fields;
} S6;
struct {TY292125* Elems;
} S7;
} kindU;
};
struct  tfreecell22628  {
tfreecell22628* Next;
NI Zerofield;
};
struct tnodeseq188797 {
  TGenericSeq Sup;
  tnode188803* data[SEQ_DECL_SIZE];
};
struct ttypeseq188835 {
  TGenericSeq Sup;
  ttype188837* data[SEQ_DECL_SIZE];
};
struct TY188933 {
  TGenericSeq Sup;
  tinstantiation188823* data[SEQ_DECL_SIZE];
};
struct tsymseq188805 {
  TGenericSeq Sup;
  tsym188833* data[SEQ_DECL_SIZE];
};
struct TY309028 {
  TGenericSeq Sup;
  ttocentry309008 data[SEQ_DECL_SIZE];
};
struct trendertokseq211019 {
  TGenericSeq Sup;
  trendertok211017 data[SEQ_DECL_SIZE];
};
struct TY188922 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
struct trstnodeseq297007 {
  TGenericSeq Sup;
  trstnode297009* data[SEQ_DECL_SIZE];
};
struct tkeyvaluepairseq121808 {
  TGenericSeq Sup;
  tkeyvaluepair121806 data[SEQ_DECL_SIZE];
};
struct TY292120 {
  TGenericSeq Sup;
  TY292613 data[SEQ_DECL_SIZE];
};
struct TY292125 {
  TGenericSeq Sup;
  tjsonnode292105* data[SEQ_DECL_SIZE];
};
N_NIMCALL(tnode188803*, finddoccomment_341571)(tnode188803* n);
N_NIMCALL(NIM_BOOL, nsuStartsWith)(NimStringDesc* s, NimStringDesc* prefix);
static N_INLINE(NI, safelen_189320)(tnode188803* n);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, renderrsttoout_309339)(trstgenerator309012* d, trstnode297009* n, NimStringDesc** result);
N_NIMCALL(trstnode297009*, parserst_341036)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions);
N_NIMCALL(trstnode297009*, rstparse_304550)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 options, tfindfilehandler298018 findfile, tmsghandler298016 msghandler);
N_NIMCALL(NimStringDesc*, docgenfindfile_341030)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, findfile_138306)(NimStringDesc* f);
N_NIMCALL(NimStringDesc*, HEX2F_108477)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NimStringDesc*, nosgetCurrentDir)(void);
N_NIMCALL(NIM_BOOL, nosexistsFile)(NimStringDesc* filename);
N_NIMCALL(void, compilermsghandler_341018)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
N_NIMCALL(void, globalerror_165558)(tlineinfo163527 info, NU16 msg, NimStringDesc* arg);
static N_INLINE(tlineinfo163527, newlineinfo_164077)(NimStringDesc* filename, NI line, NI col);
N_NIMCALL(tlineinfo163527, newlineinfo_164069)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(NI32, fileinfoidx_163721)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, tofilename_164780)(NI32 fileidx);
static N_INLINE(NI, tolinenumber_164812)(tlineinfo163527 info);
static N_INLINE(NI, tocolumn_164818)(tlineinfo163527 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(tnode188803*, parsefile_220033)(NI32 fileidx);
N_NIMCALL(tdocumentor341005*, newdocumentor_341048)(NimStringDesc* filename, tstringtable121810* config);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP4334)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_NIMCALL(void, initrstgenerator_309042)(trstgenerator309012* g, NU8 target, tstringtable121810* config, NimStringDesc* filename, NU8 options, tfindfilehandler298018 findfile, tmsghandler298016 msghandler);
N_NIMCALL(tstringtable121810*, nstnewStringTable)(NU8 mode);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incref_46827)(tcell41090* c);
static N_INLINE(NIM_BOOL, canbecycleroot_44462)(tcell41090* c);
static N_INLINE(void, rtladdcycleroot_45235)(tcell41090* c);
N_NOINLINE(void, incl_41855)(tcellset41102* s, tcell41090* cell);
static N_INLINE(tcell41090*, usrtocell_44443)(void* usr);
static N_INLINE(void, decref_46402)(tcell41090* c);
static N_INLINE(void, rtladdzct_46002)(tcell41090* c);
N_NOINLINE(void, addzct_44418)(tcellseq41106* s, tcell41090* c);
N_NIMCALL(void, generatedoc_342457)(tdocumentor341005* d, tnode188803* n);
N_NIMCALL(void, app_145046)(trope145007** a, NimStringDesc* b);
N_NIMCALL(NimStringDesc*, gencomment_341366)(tdocumentor341005* d, tnode188803* n);
N_NIMCALL(void, documentraises_320933)(tnode188803* n);
N_NIMCALL(void, genitem_342212)(tdocumentor341005* d, tnode188803* n, tnode188803* namenode, NU8 k);
N_NIMCALL(NIM_BOOL, isvisible_341696)(tnode188803* n);
static N_INLINE(NI, len_189264)(tnode188803* n);
N_NIMCALL(NimStringDesc*, getname_341862)(tdocumentor341005* d, tnode188803* n, NI splitafter);
N_NIMCALL(NimStringDesc*, esc_309216)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NimStringDesc*, renderdefinitionname_211118)(tsym188833* s, NIM_BOOL noquotes);
static N_INLINE(tnode188803*, HEX5BHEX5D_189694)(tnode188803* n, NI i);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_NIMCALL(void, internalerror_165591)(tlineinfo163527 info, NimStringDesc* errmsg);
N_NIMCALL(trope145007*, torope_145058)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, getplaindocstring_341500)(tnode188803* n);
N_NIMCALL(trope145007*, genreccomment_341396)(tdocumentor341005* d, tnode188803* n);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
N_NIMCALL(void, inittokrender_211058)(tsrcgen211021* r, tnode188803* n, NU8 renderflags);
N_NIMCALL(void, getnexttok_211067)(tsrcgen211021* r, NU8* kind, NimStringDesc** literal);
N_NIMCALL(void, dispa_341083)(trope145007** dest, NimStringDesc* xml, NimStringDesc* tex, trope145007** args, NI argsLen0);
N_NIMCALL(void, appf_145085)(trope145007** c, NimStringDesc* frmt, trope145007** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, escape_332667)(NimStringDesc* s);
N_NIMCALL(NimStringDesc*, renderplainsymbolname_338007)(tnode188803* n);
N_NIMCALL(NimStringDesc*, complexname_342077)(NU8 k, tnode188803* n, NimStringDesc* basename);
N_NIMCALL(NimStringDesc*, renderparamtypes_340838)(tnode188803* n, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, urlencode_336002)(NimStringDesc* s);
N_NIMCALL(trope145007*, torope_145062)(NI64 i);
N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_342056)(tdocumentor341005* d, NimStringDesc* original);
N_NIMCALL(NIM_BOOL, nsthasKey)(tstringtable121810* t, NimStringDesc* key);
N_NIMCALL(void, nstPut)(tstringtable121810* t, NimStringDesc* key, NimStringDesc* val);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, getconfigvar_137311)(NimStringDesc* key);
N_NIMCALL(trope145007*, ropeformatnamedvars_341128)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope145007** varvalues, NI varvaluesLen0);
N_NIMCALL(void, app_145040)(trope145007** a, trope145007* b);
N_NIMCALL(void, internalerror_165606)(NimStringDesc* errmsg);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NI, getvaridx_341102)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NIMCALL(void, rawmessage_165386)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_70624, 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_342095)(tnode188803* n);
N_NIMCALL(void, setindexterm_309433)(trstgenerator309012* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc);
N_NIMCALL(NimStringDesc*, docstringsummary_342101)(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, TY90161 chars, NI start);
static N_INLINE(NI, sonslen_189181)(tnode188803* n);
N_NIMCALL(NIM_BOOL, checkforfalse_342398)(tnode188803* n);
N_NIMCALL(NIM_BOOL, identeq_167469)(tident167019* id, NimStringDesc* name);
static N_INLINE(tnode188803*, lastson_189189)(tnode188803* n);
N_NIMCALL(void, tracedeps_342427)(tdocumentor341005* d, tnode188803* n);
N_NIMCALL(NimStringDesc*, getmodulename_255012)(tnode188803* n);
N_NIMCALL(void, writeoutput_344719)(tdocumentor341005* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning);
N_NIMCALL(trope145007*, genoutfile_344554)(tdocumentor341005* d);
N_NIMCALL(void, rendertocentries_310056)(trstgenerator309012* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, gensection_344475)(tdocumentor341005* 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_145993)(FILE* f, trope145007* c);
N_NIMCALL(void, writerope_146407)(trope145007* head, NimStringDesc* filename, NIM_BOOL usewarning);
N_NIMCALL(NimStringDesc*, getoutfile_137323)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(void, generateindex_344700)(tdocumentor341005* d);
N_NIMCALL(void, writeindexfile_309120)(trstgenerator309012* g, NimStringDesc* outfile);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY108700* Result);
N_NIMCALL(void, commandrstaux_344764)(NimStringDesc* filename, NimStringDesc* outext);
N_NIMCALL(NimStringDesc*, nosaddFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, readfile_10440)(NimStringDesc* filename);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(tjsonnode292105*, generatejson_343449)(tdocumentor341005* d, tnode188803* n, tjsonnode292105* jarray);
N_NIMCALL(tjsonnode292105*, HEX25_292610)(TY292613* keyvals, NI keyvalsLen0);
N_NIMCALL(tjsonnode292105*, HEX25_292466)(NimStringDesc* s);
N_NIMCALL(tjsonnode292105*, genjsonitem_342370)(tdocumentor341005* d, tnode188803* n, tnode188803* namenode, NU8 k);
N_NIMCALL(NimStringDesc*, ropetostr_145075)(trope145007* p);
N_NIMCALL(NimStringDesc*, reprEnum)(NI e_75880, TNimType* typ);
N_NIMCALL(void, HEX5BHEX5DHEX3D_294036)(tjsonnode292105* obj, NimStringDesc* key, tjsonnode292105* val);
N_NIMCALL(tjsonnode292105*, newjarray_292411)(void);
N_NIMCALL(void, add_293644)(tjsonnode292105* father, tjsonnode292105* child);
N_NIMCALL(trope145007*, newrope_145135)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, pretty_295140)(tjsonnode292105* node, NI indent);
N_NIMCALL(NimStringDesc*, mergeindexes_309570)(NimStringDesc* dir);
STRING_LITERAL(TMP1986, "##", 2);
STRING_LITERAL(TMP1987, "", 0);
STRING_LITERAL(TMP2489, "\012##", 3);
STRING_LITERAL(TMP2490, "\012", 1);
STRING_LITERAL(TMP4337, "`", 1);
STRING_LITERAL(TMP4338, "getName()", 9);
STRING_LITERAL(TMP4339, "<span class=\"Comment\">$1</span>", 31);
STRING_LITERAL(TMP4340, "\\spanComment{$1}", 16);
STRING_LITERAL(TMP4341, "<span class=\"Keyword\">$1</span>", 31);
STRING_LITERAL(TMP4342, "\\spanKeyword{$1}", 16);
STRING_LITERAL(TMP4343, "<span class=\"Operator\">$1</span>", 32);
STRING_LITERAL(TMP4344, "\\spanOperator{$1}", 17);
STRING_LITERAL(TMP4345, "<span class=\"StringLit\">$1</span>", 33);
STRING_LITERAL(TMP4346, "\\spanStringLit{$1}", 18);
STRING_LITERAL(TMP4347, "<span class=\"CharLit\">$1</span>", 31);
STRING_LITERAL(TMP4348, "\\spanCharLit{$1}", 16);
STRING_LITERAL(TMP4349, "<span class=\"DecNumber\">$1</span>", 33);
STRING_LITERAL(TMP4350, "\\spanDecNumber{$1}", 18);
STRING_LITERAL(TMP4351, "<span class=\"FloatNumber\">$1</span>", 35);
STRING_LITERAL(TMP4352, "\\spanFloatNumber{$1}", 20);
STRING_LITERAL(TMP4353, "<span class=\"Identifier\">$1</span>", 34);
STRING_LITERAL(TMP4354, "\\spanIdentifier{$1}", 19);
STRING_LITERAL(TMP4355, "<span class=\"Other\">$1</span>", 29);
STRING_LITERAL(TMP4356, "\\spanOther{$1}", 14);
STRING_LITERAL(TMP4364, ",", 1);
STRING_LITERAL(TMP4365, ".m,", 3);
STRING_LITERAL(TMP4366, ".e,", 3);
STRING_LITERAL(TMP4367, ".i,", 3);
STRING_LITERAL(TMP4368, ".t,", 3);
STRING_LITERAL(TMP4369, ".c,", 3);
STRING_LITERAL(TMP4375, "_", 1);
STRING_LITERAL(TMP4376, "doc.item.seesrc", 15);
STRING_LITERAL(TMP4377, "$", 1);
STRING_LITERAL(TMP4378, "ropeFormatNamedVars", 19);
STRING_LITERAL(TMP4379, "}", 1);
STRING_LITERAL(TMP4381, "path", 4);
STRING_LITERAL(TMP4382, "line", 4);
NIM_CONST TY137892 TMP4380 = {((NimStringDesc*) &TMP4381),
((NimStringDesc*) &TMP4382)}
;
STRING_LITERAL(TMP4383, "$1", 2);
STRING_LITERAL(TMP4385, "url", 3);
NIM_CONST TY173034 TMP4384 = {((NimStringDesc*) &TMP4381),
((NimStringDesc*) &TMP4382),
((NimStringDesc*) &TMP4385)}
;
STRING_LITERAL(TMP4386, "doc.item", 8);
STRING_LITERAL(TMP4388, "name", 4);
STRING_LITERAL(TMP4389, "header", 6);
STRING_LITERAL(TMP4390, "desc", 4);
STRING_LITERAL(TMP4391, "itemID", 6);
STRING_LITERAL(TMP4392, "header_plain", 12);
STRING_LITERAL(TMP4393, "itemSym", 7);
STRING_LITERAL(TMP4394, "itemSymOrID", 11);
STRING_LITERAL(TMP4395, "itemSymEnc", 10);
STRING_LITERAL(TMP4396, "itemSymOrIDEnc", 14);
STRING_LITERAL(TMP4397, "seeSrc", 6);
NIM_CONST TY174057 TMP4387 = {((NimStringDesc*) &TMP4388),
((NimStringDesc*) &TMP4389),
((NimStringDesc*) &TMP4390),
((NimStringDesc*) &TMP4391),
((NimStringDesc*) &TMP4392),
((NimStringDesc*) &TMP4393),
((NimStringDesc*) &TMP4394),
((NimStringDesc*) &TMP4395),
((NimStringDesc*) &TMP4396),
((NimStringDesc*) &TMP4397)}
;
STRING_LITERAL(TMP4398, "doc.item.toc", 12);
NIM_CONST TY342356 TMP4399 = {((NimStringDesc*) &TMP4388),
((NimStringDesc*) &TMP4389),
((NimStringDesc*) &TMP4390),
((NimStringDesc*) &TMP4391),
((NimStringDesc*) &TMP4392),
((NimStringDesc*) &TMP4393),
((NimStringDesc*) &TMP4394),
((NimStringDesc*) &TMP4395),
((NimStringDesc*) &TMP4396)}
;
STRING_LITERAL(TMP4400, " : ", 3);
STRING_LITERAL(TMP4401, "\342\200\246", 3);
static NIM_CONST TY90161 TMP4402 = {
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(TMP4403, "false", 5);
STRING_LITERAL(TMP4404, ", ", 2);
STRING_LITERAL(TMP4405, "<a class=\"reference external\" href=\"$1.html\">$1</a>", 51);
STRING_LITERAL(TMP4410, "Imports", 7);
STRING_LITERAL(TMP4411, "Types", 5);
STRING_LITERAL(TMP4412, "Vars", 4);
STRING_LITERAL(TMP4413, "Lets", 4);
STRING_LITERAL(TMP4414, "Consts", 6);
STRING_LITERAL(TMP4415, "Procs", 5);
STRING_LITERAL(TMP4416, "Methods", 7);
STRING_LITERAL(TMP4417, "Iterators", 9);
STRING_LITERAL(TMP4418, "Converters", 10);
STRING_LITERAL(TMP4419, "Macros", 6);
STRING_LITERAL(TMP4420, "Templates", 9);
NIM_CONST TY344480 sectionnames_344479 = {((NimStringDesc*) &TMP4410),
((NimStringDesc*) &TMP4411),
((NimStringDesc*) &TMP4412),
((NimStringDesc*) &TMP4413),
((NimStringDesc*) &TMP4414),
((NimStringDesc*) &TMP4412),
((NimStringDesc*) &TMP4415),
((NimStringDesc*) &TMP4416),
((NimStringDesc*) &TMP4417),
((NimStringDesc*) &TMP4417),
((NimStringDesc*) &TMP4418),
((NimStringDesc*) &TMP4419),
((NimStringDesc*) &TMP4420)}
;
STRING_LITERAL(TMP4421, "doc.section", 11);
STRING_LITERAL(TMP4423, "sectionid", 9);
STRING_LITERAL(TMP4424, "sectionTitle", 12);
STRING_LITERAL(TMP4425, "sectionTitleID", 14);
STRING_LITERAL(TMP4426, "content", 7);
NIM_CONST TY165283 TMP4422 = {((NimStringDesc*) &TMP4423),
((NimStringDesc*) &TMP4424),
((NimStringDesc*) &TMP4425),
((NimStringDesc*) &TMP4426)}
;
STRING_LITERAL(TMP4427, "doc.section.toc", 15);
STRING_LITERAL(TMP4428, "doc.toc", 7);
NIM_CONST TY165002 TMP4429 = {((NimStringDesc*) &TMP4426)}
;
STRING_LITERAL(TMP4430, "Module ", 7);
STRING_LITERAL(TMP4431, "doc.body_toc", 12);
STRING_LITERAL(TMP4432, "doc.body_no_toc", 15);
STRING_LITERAL(TMP4434, "title", 5);
STRING_LITERAL(TMP4435, "tableofcontents", 15);
STRING_LITERAL(TMP4436, "moduledesc", 10);
STRING_LITERAL(TMP4437, "date", 4);
STRING_LITERAL(TMP4438, "time", 4);
NIM_CONST TY344659 TMP4433 = {((NimStringDesc*) &TMP4434),
((NimStringDesc*) &TMP4435),
((NimStringDesc*) &TMP4436),
((NimStringDesc*) &TMP4437),
((NimStringDesc*) &TMP4438),
((NimStringDesc*) &TMP4426)}
;
STRING_LITERAL(TMP4439, "doc.file", 8);
STRING_LITERAL(TMP4441, "author", 6);
STRING_LITERAL(TMP4442, "version", 7);
NIM_CONST TY344680 TMP4440 = {((NimStringDesc*) &TMP4434),
((NimStringDesc*) &TMP4435),
((NimStringDesc*) &TMP4436),
((NimStringDesc*) &TMP4437),
((NimStringDesc*) &TMP4438),
((NimStringDesc*) &TMP4426),
((NimStringDesc*) &TMP4441),
((NimStringDesc*) &TMP4442)}
;
STRING_LITERAL(TMP4443, "html", 4);
STRING_LITERAL(TMP4445, ".idx", 4);
STRING_LITERAL(TMP4452, "txt", 3);
STRING_LITERAL(TMP4454, "\\-", 2);
STRING_LITERAL(TMP4455, "tex", 3);
STRING_LITERAL(TMP4463, "comment", 7);
STRING_LITERAL(TMP4464, "type", 4);
STRING_LITERAL(TMP4465, "description", 11);
STRING_LITERAL(TMP4466, "code", 4);
STRING_LITERAL(TMP4484, "json", 4);
STRING_LITERAL(TMP4494, "Index", 5);
STRING_LITERAL(TMP4495, "theindex", 8);
extern NI32 gprojectmainidx_137209;
extern TNimType NTI309012; /* TRstGenerator */
TNimType NTI341005; /* TDocumentor */
extern TNimType NTI145005; /* PRope */
extern TNimType NTI106; /* int */
TNimType NTI341003; /* TSections */
extern TNimType NTI143; /* string */
extern TNimType NTI121812; /* PStringTable */
TNimType NTI341007; /* PDoc */
extern NU8 gcmd_137113;
extern tstringtable121810* gconfigvars_137203;
extern tgcheap43016 gch_43044;
extern NimStringDesc* gprojectfull_137208;
extern NimStringDesc* docseesrcurl_137118;
extern NU32 gglobaloptions_137111;
extern NimStringDesc* outfile_137117;
extern NimStringDesc* splitter_309149;
extern TNimType NTI188441; /* TSymKind */

static N_INLINE(NI, safelen_189320)(tnode188803* 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(tnode188803*, finddoccomment_341571)(tnode188803* n) {
	tnode188803* result;
	NI i_341604;
	NI HEX3Atmp_341636;
	NI LOC11;
	NI res_341638;
	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*) &TMP1986));
		LA8: ;
		if (!LOC7) goto LA9;
		result = n;
		goto BeforeRet;
	}
	LA9: ;
	i_341604 = 0;
	HEX3Atmp_341636 = 0;
	LOC11 = 0;
	LOC11 = safelen_189320(n);
	HEX3Atmp_341636 = (NI32)(LOC11 - 1);
	res_341638 = 0;
	while (1) {
		if (!(res_341638 <= HEX3Atmp_341636)) goto LA12;
		i_341604 = res_341638;
		result = finddoccomment_341571((*n).kindU.S6.Sons->data[i_341604]);
		{
			if (!!((result == NIM_NIL))) goto LA15;
			goto BeforeRet;
		}
		LA15: ;
		res_341638 += 1;
	} LA12: ;
	BeforeRet: ;
	return result;
}

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

static N_INLINE(tlineinfo163527, newlineinfo_164077)(NimStringDesc* filename, NI line, NI col) {
	tlineinfo163527 result;
	NI32 LOC1;
	memset((void*)&result, 0, sizeof(result));
	LOC1 = 0;
	LOC1 = fileinfoidx_163721(filename);
	result = newlineinfo_164069(LOC1, line, col);
	return result;
}

N_NIMCALL(void, compilermsghandler_341018)(NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg) {
	NU16 k;
	tlineinfo163527 LOC10;
	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;
	}
	LOC10 = newlineinfo_164077(filename, line, col);
	globalerror_165558(LOC10, k, arg);
}

N_NIMCALL(trstnode297009*, parserst_341036)(NimStringDesc* text, NimStringDesc* filename, NI line, NI column, NIM_BOOL* hastoc, NU8 rstoptions) {
	trstnode297009* result;
	result = 0;
	result = rstparse_304550(text, filename, line, column, hastoc, rstoptions, docgenfindfile_341030, compilermsghandler_341018);
	return result;
}

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

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

N_NIMCALL(NimStringDesc*, extractdoccomment_341643)(tsym188833* s, tdocumentor341005* d) {
	NimStringDesc* result;
	tnode188803* n;
	result = 0;
	n = finddoccomment_341571((*s).Ast);
	result = copyString(((NimStringDesc*) &TMP1987));
	{
		if (!!(n == 0)) goto LA3;
		{
			NIM_BOOL dummyhastoc;
			NimStringDesc* LOC9;
			NI LOC10;
			NI LOC11;
			trstnode297009* LOC12;
			if (!!(d == 0)) goto LA7;
			dummyhastoc = 0;
			LOC9 = 0;
			LOC9 = tofilename_164780((*n).Info.Fileindex);
			LOC10 = 0;
			LOC10 = tolinenumber_164812((*n).Info);
			LOC11 = 0;
			LOC11 = tocolumn_164818((*n).Info);
			LOC12 = 0;
			LOC12 = parserst_341036((*n).Comment, LOC9, LOC10, LOC11, &dummyhastoc, ((*d).Sup.Options | 1));
			renderrsttoout_309339(&d->Sup, LOC12, &result);
		}
		goto LA5;
		LA7: ;
		{
			NimStringDesc* LOC14;
			NimStringDesc* LOC15;
			LOC14 = 0;
			LOC14 = copyStr((*n).Comment, 2);
			LOC15 = 0;
			LOC15 = nsuReplaceStr(LOC14, ((NimStringDesc*) &TMP2489), ((NimStringDesc*) &TMP2490));
			result = nsuStrip(LOC15, NIM_TRUE, NIM_TRUE);
		}
		LA5: ;
	}
	LA3: ;
	return result;
}
N_NIMCALL(void, TMP4334)(void* p, NI op) {
	tdocumentor341005* a;
	NI LOC1;
	NI LOC2;
	NI LOC3;
	a = (tdocumentor341005*)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).Moddesc, op);
	LOC2 = 0;
	for (LOC2 = 0; LOC2 < 25; LOC2++) {
	nimGCvisit((void*)(*a).Toc[LOC2], op);
	}
	LOC3 = 0;
	for (LOC3 = 0; LOC3 < 25; LOC3++) {
	nimGCvisit((void*)(*a).Section[LOC3], op);
	}
	nimGCvisit((void*)(*a).Indexvalfilename, op);
	nimGCvisit((void*)(*a).Seensymbols, op);
}

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

static N_INLINE(void, rtladdcycleroot_45235)(tcell41090* c) {
	{
		if (!!((((NI) ((NI)((*c).Refcount & 3))) == 3))) goto LA3;
		(*c).Refcount = (NI)((NI)((*c).Refcount & -4) | 3);
		incl_41855(&gch_43044.Cycleroots, c);
	}
	LA3: ;
}

static N_INLINE(void, incref_46827)(tcell41090* c) {
	(*c).Refcount = (NI)((NU32)((*c).Refcount) + (NU32)(8));
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = canbecycleroot_44462(c);
		if (!LOC3) goto LA4;
		rtladdcycleroot_45235(c);
	}
	LA4: ;
}

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

static N_INLINE(void, rtladdzct_46002)(tcell41090* c) {
	addzct_44418(&gch_43044.Zct, c);
}

static N_INLINE(void, decref_46402)(tcell41090* c) {
	{
		(*c).Refcount -= 8;
		if (!((NU32)((*c).Refcount) < (NU32)(8))) goto LA3;
		rtladdzct_46002(c);
	}
	goto LA1;
	LA3: ;
	{
		NIM_BOOL LOC6;
		LOC6 = 0;
		LOC6 = canbecycleroot_44462(c);
		if (!LOC6) goto LA7;
		rtladdcycleroot_45235(c);
	}
	goto LA1;
	LA7: ;
	LA1: ;
}

static N_INLINE(void, asgnRef)(void** dest, void* src) {
	{
		tcell41090* LOC5;
		if (!!((src == NIM_NIL))) goto LA3;
		LOC5 = 0;
		LOC5 = usrtocell_44443(src);
		incref_46827(LOC5);
	}
	LA3: ;
	{
		tcell41090* LOC10;
		if (!!(((*dest) == NIM_NIL))) goto LA8;
		LOC10 = 0;
		LOC10 = usrtocell_44443((*dest));
		decref_46402(LOC10);
	}
	LA8: ;
	(*dest) = src;
}

N_NIMCALL(tdocumentor341005*, newdocumentor_341048)(NimStringDesc* filename, tstringtable121810* config) {
	tdocumentor341005* result;
	NU8 LOC1;
	result = 0;
	result = (tdocumentor341005*) newObj((&NTI341007), sizeof(tdocumentor341005));
	(*result).Sup.Sup.m_type = (&NTI341005);
	LOC1 = 0;
	{
		if (!!((gcmd_137113 == ((NU8) 17)))) goto LA4;
		LOC1 = ((NU8) 0);
	}
	goto LA2;
	LA4: ;
	{
		LOC1 = ((NU8) 1);
	}
	LA2: ;
	initrstgenerator_309042(&result->Sup, LOC1, gconfigvars_137203, filename, 4, docgenfindfile_341030, compilermsghandler_341018);
	asgnRef((void**) &(*result).Seensymbols, nstnewStringTable(((NU8) 1)));
	(*result).Id = 100;
	return result;
}

N_NIMCALL(NimStringDesc*, gencomment_341366)(tdocumentor341005* d, tnode188803* n) {
	NimStringDesc* result;
	NIM_BOOL dummyhastoc;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP1987));
	dummyhastoc = 0;
	{
		NIM_BOOL LOC3;
		NimStringDesc* LOC7;
		NI LOC8;
		NI LOC9;
		trstnode297009* LOC10;
		LOC3 = 0;
		LOC3 = !(((*n).Comment == NIM_NIL));
		if (!(LOC3)) goto LA4;
		LOC3 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP1986));
		LA4: ;
		if (!LOC3) goto LA5;
		LOC7 = 0;
		LOC7 = tofilename_164780((*n).Info.Fileindex);
		LOC8 = 0;
		LOC8 = tolinenumber_164812((*n).Info);
		LOC9 = 0;
		LOC9 = tocolumn_164818((*n).Info);
		LOC10 = 0;
		LOC10 = parserst_341036((*n).Comment, LOC7, LOC8, LOC9, &dummyhastoc, ((*d).Sup.Options | 1));
		renderrsttoout_309339(&d->Sup, LOC10, &result);
	}
	LA5: ;
	return result;
}

static N_INLINE(NI, len_189264)(tnode188803* 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_341696)(tnode188803* n) {
	NIM_BOOL result;
	result = 0;
	result = NIM_FALSE;
	{
		if (!((*n).Kind == ((NU8) 31))) goto LA3;
		{
			NIM_BOOL LOC7;
			NI LOC8;
			tident167019* v;
			NIM_BOOL LOC12;
			LOC7 = 0;
			LOC8 = 0;
			LOC8 = len_189264(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 == 74);
			if (LOC12) goto LA13;
			LOC12 = ((*v).Sup.Id == 75);
			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_341696((*n).kindU.S6.Sons->data[0]);
	}
	goto LA1;
	LA18: ;
	LA1: ;
	return result;
}

static N_INLINE(tnode188803*, HEX5BHEX5D_189694)(tnode188803* n, NI i) {
	tnode188803* 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_341862)(tdocumentor341005* d, tnode188803* n, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 31):
	{
		result = getname_341862(d, (*n).kindU.S6.Sons->data[1], splitafter);
	}
	break;
	case ((NU8) 43):
	{
		result = getname_341862(d, (*n).kindU.S6.Sons->data[0], splitafter);
	}
	break;
	case ((NU8) 3):
	{
		NimStringDesc* LOC4;
		LOC4 = 0;
		LOC4 = renderdefinitionname_211118((*n).kindU.S4.Sym, NIM_FALSE);
		result = esc_309216((*d).Sup.Target, LOC4, splitafter);
	}
	break;
	case ((NU8) 2):
	{
		result = esc_309216((*d).Sup.Target, (*(*n).kindU.S5.Ident).S, splitafter);
	}
	break;
	case ((NU8) 53):
	{
		NI i_341945;
		NI HEX3Atmp_341946;
		NI LOC7;
		NI res_341948;
		NimStringDesc* LOC11;
		result = esc_309216((*d).Sup.Target, ((NimStringDesc*) &TMP4337), -1);
		i_341945 = 0;
		HEX3Atmp_341946 = 0;
		LOC7 = 0;
		LOC7 = len_189264(n);
		HEX3Atmp_341946 = LOC7 - 1;
		res_341948 = 0;
		while (1) {
			tnode188803* LOC9;
			NimStringDesc* LOC10;
			if (!(res_341948 <= HEX3Atmp_341946)) goto LA8;
			i_341945 = res_341948;
			LOC9 = 0;
			LOC9 = HEX5BHEX5D_189694(n, i_341945);
			LOC10 = 0;
			LOC10 = getname_341862(d, LOC9, splitafter);
			result = resizeString(result, LOC10->Sup.len + 0);
appendString(result, LOC10);
			res_341948 += 1;
		} LA8: ;
		LOC11 = 0;
		LOC11 = esc_309216((*d).Sup.Target, ((NimStringDesc*) &TMP4337), -1);
		result = resizeString(result, LOC11->Sup.len + 0);
appendString(result, LOC11);
	}
	break;
	default:
	{
		internalerror_165591((*n).Info, ((NimStringDesc*) &TMP4338));
		result = copyString(((NimStringDesc*) &TMP1987));
	}
	break;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, getplaindocstring_341500)(tnode188803* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP1987));
	{
		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*) &TMP1986));
		LA8: ;
		if (!LOC7) goto LA9;
		result = copyString((*n).Comment);
	}
	LA9: ;
	{
		if (!(result->Sup.len < 1)) goto LA13;
		{
			NI i_341548;
			NI HEX3Atmp_341564;
			NI LOC19;
			NI res_341566;
			if (!!(((*n).Kind >= ((NU8) 1) && (*n).Kind <= ((NU8) 23)))) goto LA17;
			i_341548 = 0;
			HEX3Atmp_341564 = 0;
			LOC19 = 0;
			LOC19 = len_189264(n);
			HEX3Atmp_341564 = (NI32)(LOC19 - 1);
			res_341566 = 0;
			while (1) {
				if (!(res_341566 <= HEX3Atmp_341564)) goto LA20;
				i_341548 = res_341566;
				result = getplaindocstring_341500((*n).kindU.S6.Sons->data[i_341548]);
				{
					if (!(0 < result->Sup.len)) goto LA23;
					goto BeforeRet;
				}
				LA23: ;
				res_341566 += 1;
			} LA20: ;
		}
		LA17: ;
	}
	LA13: ;
	BeforeRet: ;
	return result;
}

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

N_NIMCALL(trope145007*, genreccomment_341396)(tdocumentor341005* d, tnode188803* n) {
	trope145007* result;
	NimStringDesc* LOC5;
	result = 0;
	{
		if (!(n == NIM_NIL)) goto LA3;
		result = NIM_NIL;
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = gencomment_341366(d, n);
	result = torope_145058(LOC5);
	{
		if (!(result == NIM_NIL)) goto LA8;
		{
			NI i_341461;
			NI HEX3Atmp_341493;
			NI LOC14;
			NI res_341495;
			if (!!(((*n).Kind >= ((NU8) 1) && (*n).Kind <= ((NU8) 23)))) goto LA12;
			i_341461 = 0;
			HEX3Atmp_341493 = 0;
			LOC14 = 0;
			LOC14 = len_189264(n);
			HEX3Atmp_341493 = (NI32)(LOC14 - 1);
			res_341495 = 0;
			while (1) {
				if (!(res_341495 <= HEX3Atmp_341493)) goto LA15;
				i_341461 = res_341495;
				result = genreccomment_341396(d, (*n).kindU.S6.Sons->data[i_341461]);
				{
					if (!!((result == NIM_NIL))) goto LA18;
					goto BeforeRet;
				}
				LA18: ;
				res_341495 += 1;
			} LA15: ;
		}
		LA12: ;
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC21;
		LOC21 = 0;
		LOC21 = (*n).Comment; (*n).Comment = copyStringRC1(NIM_NIL);
		if (LOC21) nimGCunrefNoCycle(LOC21);
	}
	LA6: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, dispa_341083)(trope145007** dest, NimStringDesc* xml, NimStringDesc* tex, trope145007** args, NI argsLen0) {
	{
		if (!!((gcmd_137113 == ((NU8) 17)))) goto LA3;
		appf_145085(dest, xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		appf_145085(dest, tex, args, argsLen0);
	}
	LA1: ;
}

N_NIMCALL(NimStringDesc*, complexname_342077)(NU8 k, tnode188803* n, NimStringDesc* basename) {
	NimStringDesc* result;
	result = 0;
	result = copyString(basename);
	switch (k) {
	case ((NU8) 12):
	{
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TMP4364));
	}
	break;
	case ((NU8) 17):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4365));
	}
	break;
	case ((NU8) 13):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4366));
	}
	break;
	case ((NU8) 14):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4367));
	}
	break;
	case ((NU8) 18):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4368));
	}
	break;
	case ((NU8) 16):
	{
		result = resizeString(result, 3);
appendString(result, ((NimStringDesc*) &TMP4369));
	}
	break;
	default:
	{
	}
	break;
	}
	{
		NIM_BOOL LOC10;
		NI LOC11;
		tnode188803* LOC13;
		tnode188803* LOC16;
		NimStringDesc* LOC17;
		LOC10 = 0;
		LOC11 = 0;
		LOC11 = len_189264(n);
		LOC10 = (3 < LOC11);
		if (!(LOC10)) goto LA12;
		LOC13 = 0;
		LOC13 = HEX5BHEX5D_189694(n, 3);
		LOC10 = ((*LOC13).Kind == ((NU8) 76));
		LA12: ;
		if (!LOC10) goto LA14;
		LOC16 = 0;
		LOC16 = HEX5BHEX5D_189694(n, 3);
		LOC17 = 0;
		LOC17 = renderparamtypes_340838(LOC16, ((NimStringDesc*) &TMP4364));
		result = resizeString(result, LOC17->Sup.len + 0);
appendString(result, LOC17);
	}
	LA14: ;
	return result;
}

N_NIMCALL(NimStringDesc*, newuniqueplainsymbol_342056)(tdocumentor341005* 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*) &TMP1987));
		goto BeforeRet;
	}
	LA4: ;
	count = 2;
	while (1) {
		NimStringDesc* LOC7;
		NimStringDesc* LOC8;
		LOC7 = 0;
		LOC8 = 0;
		LOC8 = nimIntToStr(count);
		LOC7 = rawNewString(original->Sup.len + LOC8->Sup.len + 1);
appendString(LOC7, original);
appendString(LOC7, ((NimStringDesc*) &TMP4375));
appendString(LOC7, LOC8);
		result = LOC7;
		{
			NIM_BOOL LOC11;
			LOC11 = 0;
			LOC11 = nsthasKey((*d).Seensymbols, result);
			if (!!(LOC11)) goto LA12;
			nstPut((*d).Seensymbols, result, ((NimStringDesc*) &TMP1987));
			goto LA6;
		}
		LA12: ;
		count += 1;
	} LA6: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI, getvaridx_341102)(NimStringDesc** varnames, NI varnamesLen0, NimStringDesc* id) {
	NI result;
	NI i_341120;
	NI HEX3Atmp_341121;
	NI res_341123;
	result = 0;
	i_341120 = 0;
	HEX3Atmp_341121 = 0;
	HEX3Atmp_341121 = (varnamesLen0-1);
	res_341123 = 0;
	while (1) {
		if (!(res_341123 <= HEX3Atmp_341121)) goto LA1;
		i_341120 = res_341123;
		{
			NI LOC4;
			LOC4 = 0;
			LOC4 = nsuCmpIgnoreStyle(varnames[i_341120], id);
			if (!(LOC4 == 0)) goto LA5;
			result = i_341120;
			goto BeforeRet;
		}
		LA5: ;
		res_341123 += 1;
	} LA1: ;
	result = -1;
	BeforeRet: ;
	return result;
}

N_NIMCALL(trope145007*, ropeformatnamedvars_341128)(NimStringDesc* frmt, NimStringDesc** varnames, NI varnamesLen0, trope145007** varvalues, NI varvaluesLen0) {
	trope145007* 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 LA1;
		{
			if (!((NU8)(frmt->data[i]) == (NU8)(36))) goto LA4;
			i += 1;
			switch (((NU8)(frmt->data[i]))) {
			case 35:
			{
				app_145040(&result, varvalues[num]);
				num += 1;
				i += 1;
			}
			break;
			case 36:
			{
				app_145046(&result, ((NimStringDesc*) &TMP4377));
				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 LOC12;
						LOC12 = 0;
						LOC12 = ((NI32)((NI32)(l + 0) - 1) < i);
						if (LOC12) goto LA13;
						LOC12 = !((((NU8)(frmt->data[i])) >= ((NU8)(48)) && ((NU8)(frmt->data[i])) <= ((NU8)(57))));
						LA13: ;
						if (!LOC12) goto LA14;
						goto LA9;
					}
					LA14: ;
				} LA9: ;
				{
					if (!((NI32)((varvaluesLen0-1) + 1) < j)) goto LA18;
					internalerror_165606(((NimStringDesc*) &TMP4378));
				}
				LA18: ;
				num = j;
				app_145040(&result, varvalues[(NI32)(j - 1)]);
			}
			break;
			case 65 ... 90:
			case 97 ... 122:
			case 128 ... 255:
			{
				NimStringDesc* id;
				NI idx;
				id = copyString(((NimStringDesc*) &TMP1987));
				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 LA24;
						goto LA21;
					}
					LA24: ;
				} LA21: ;
				idx = getvaridx_341102(varnames, varnamesLen0, id);
				{
					if (!(0 <= idx)) goto LA28;
					app_145040(&result, varvalues[idx]);
				}
				goto LA26;
				LA28: ;
				{
					rawmessage_165386(((NU16) 152), id);
				}
				LA26: ;
			}
			break;
			case 123:
			{
				NimStringDesc* id;
				NI idx;
				id = copyString(((NimStringDesc*) &TMP1987));
				i += 1;
				while (1) {
					if (!!(((NU8)(frmt->data[i]) == (NU8)(125)))) goto LA32;
					{
						if (!((NU8)(frmt->data[i]) == (NU8)(0))) goto LA35;
						rawmessage_165386(((NU16) 23), ((NimStringDesc*) &TMP4379));
					}
					LA35: ;
					id = addChar(id, frmt->data[i]);
					i += 1;
				} LA32: ;
				i += 1;
				idx = getvaridx_341102(varnames, varnamesLen0, id);
				{
					if (!(0 <= idx)) goto LA39;
					app_145040(&result, varvalues[idx]);
				}
				goto LA37;
				LA39: ;
				{
					rawmessage_165386(((NU16) 152), id);
				}
				LA37: ;
			}
			break;
			default:
			{
				internalerror_165606(((NimStringDesc*) &TMP4378));
			}
			break;
			}
		}
		LA4: ;
		start = i;
		while (1) {
			if (!(i < l)) goto LA43;
			{
				if (!!(((NU8)(frmt->data[i]) == (NU8)(36)))) goto LA46;
				i += 1;
			}
			goto LA44;
			LA46: ;
			{
				goto LA43;
			}
			LA44: ;
		} LA43: ;
		{
			NimStringDesc* LOC53;
			if (!(start <= (NI32)(i - 1))) goto LA51;
			LOC53 = 0;
			LOC53 = copyStrLast(frmt, start, (NI32)(i - 1));
			app_145046(&result, LOC53);
		}
		LA51: ;
	} LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, iscallable_342095)(tnode188803* 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_342101)(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*) &TMP4401));
	}
	LA4: ;
	{
		if (!(pos < 100)) goto LA8;
		goto BeforeRet;
	}
	LA8: ;
	pos = nsuFindCharSet(result, TMP4402, 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*) &TMP4401));
	}
	LA14: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, genitem_342212)(tdocumentor341005* d, tnode188803* n, tnode188803* namenode, NU8 k) {
	NimStringDesc* name;
	trope145007* namerope;
	NimStringDesc* plaindocstring;
	trope145007* result;
	NimStringDesc* literal;
	NimStringDesc* plainname;
	NU8 kind;
	trope145007* comm;
	tsrcgen211021 r;
	trope145007* plainnamerope;
	NimStringDesc* LOC40;
	NimStringDesc* LOC41;
	NimStringDesc* cleanplainsymbol;
	NimStringDesc* complexsymbol;
	trope145007* plainsymbolrope;
	trope145007* plainsymbolencrope;
	NimStringDesc* LOC42;
	trope145007* itemidrope;
	NimStringDesc* symbolorid;
	trope145007* symboloridrope;
	trope145007* symboloridencrope;
	NimStringDesc* LOC43;
	trope145007* seesrcrope;
	NimStringDesc* docitemseesrc;
	NimStringDesc* LOC57;
	TY342349 LOC58;
	trope145007* LOC59;
	NimStringDesc* LOC60;
	TY342358 LOC61;
	NimStringDesc* LOC62;
	trope145007* LOC63;
	NimStringDesc* linktitle;
	NimStringDesc* LOC64;
	NimStringDesc* LOC65;
	NimStringDesc* LOC66;
	NimStringDesc* LOC77;
	NimStringDesc* LOC78;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_341696(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_341862(d, namenode, -1);
	namerope = torope_145058(name);
	plaindocstring = getplaindocstring_341500(n);
	result = NIM_NIL;
	literal = copyString(((NimStringDesc*) &TMP1987));
	plainname = copyString(((NimStringDesc*) &TMP1987));
	kind = ((NU8) 1);
	comm = genreccomment_341396(d, n);
	memset((void*)&r, 0, sizeof(r));
	inittokrender_211058(&r, n, 94);
	while (1) {
		getnexttok_211067(&r, &kind, &literal);
		{
			if (!(kind == ((NU8) 1))) goto LA9;
			goto LA6;
		}
		LA9: ;
		plainname = resizeString(plainname, literal->Sup.len + 0);
appendString(plainname, literal);
	} LA6: ;
	inittokrender_211058(&r, n, 14);
	while (1) {
		getnexttok_211067(&r, &kind, &literal);
		switch (kind) {
		case ((NU8) 1):
		{
			goto LA11;
		}
		break;
		case ((NU8) 111):
		{
			TY145497 LOC14;
			NimStringDesc* LOC15;
			memset((void*)LOC14, 0, sizeof(LOC14));
			LOC15 = 0;
			LOC15 = esc_309216((*d).Sup.Target, literal, -1);
			LOC14[0] = torope_145058(LOC15);
			dispa_341083(&result, ((NimStringDesc*) &TMP4339), ((NimStringDesc*) &TMP4340), LOC14, 1);
		}
		break;
		case ((NU8) 3) ... ((NU8) 70):
		{
			TY145497 LOC17;
			memset((void*)LOC17, 0, sizeof(LOC17));
			LOC17[0] = torope_145058(literal);
			dispa_341083(&result, ((NimStringDesc*) &TMP4341), ((NimStringDesc*) &TMP4342), LOC17, 1);
		}
		break;
		case ((NU8) 110):
		{
			TY145497 LOC19;
			NimStringDesc* LOC20;
			memset((void*)LOC19, 0, sizeof(LOC19));
			LOC20 = 0;
			LOC20 = esc_309216((*d).Sup.Target, literal, -1);
			LOC19[0] = torope_145058(LOC20);
			dispa_341083(&result, ((NimStringDesc*) &TMP4343), ((NimStringDesc*) &TMP4344), LOC19, 1);
		}
		break;
		case ((NU8) 85) ... ((NU8) 87):
		{
			TY145497 LOC22;
			NimStringDesc* LOC23;
			memset((void*)LOC22, 0, sizeof(LOC22));
			LOC23 = 0;
			LOC23 = esc_309216((*d).Sup.Target, literal, -1);
			LOC22[0] = torope_145058(LOC23);
			dispa_341083(&result, ((NimStringDesc*) &TMP4345), ((NimStringDesc*) &TMP4346), LOC22, 1);
		}
		break;
		case ((NU8) 90):
		{
			TY145497 LOC25;
			NimStringDesc* LOC26;
			memset((void*)LOC25, 0, sizeof(LOC25));
			LOC26 = 0;
			LOC26 = esc_309216((*d).Sup.Target, literal, -1);
			LOC25[0] = torope_145058(LOC26);
			dispa_341083(&result, ((NimStringDesc*) &TMP4347), ((NimStringDesc*) &TMP4348), LOC25, 1);
		}
		break;
		case ((NU8) 71) ... ((NU8) 80):
		{
			TY145497 LOC28;
			NimStringDesc* LOC29;
			memset((void*)LOC28, 0, sizeof(LOC28));
			LOC29 = 0;
			LOC29 = esc_309216((*d).Sup.Target, literal, -1);
			LOC28[0] = torope_145058(LOC29);
			dispa_341083(&result, ((NimStringDesc*) &TMP4349), ((NimStringDesc*) &TMP4350), LOC28, 1);
		}
		break;
		case ((NU8) 81) ... ((NU8) 84):
		{
			TY145497 LOC31;
			NimStringDesc* LOC32;
			memset((void*)LOC31, 0, sizeof(LOC31));
			LOC32 = 0;
			LOC32 = esc_309216((*d).Sup.Target, literal, -1);
			LOC31[0] = torope_145058(LOC32);
			dispa_341083(&result, ((NimStringDesc*) &TMP4351), ((NimStringDesc*) &TMP4352), LOC31, 1);
		}
		break;
		case ((NU8) 2):
		{
			TY145497 LOC34;
			NimStringDesc* LOC35;
			memset((void*)LOC34, 0, sizeof(LOC34));
			LOC35 = 0;
			LOC35 = esc_309216((*d).Sup.Target, literal, -1);
			LOC34[0] = torope_145058(LOC35);
			dispa_341083(&result, ((NimStringDesc*) &TMP4353), ((NimStringDesc*) &TMP4354), LOC34, 1);
		}
		break;
		case ((NU8) 113):
		case ((NU8) 0):
		{
			app_145046(&result, literal);
		}
		break;
		case ((NU8) 91):
		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) 107):
		case ((NU8) 108):
		case ((NU8) 109):
		case ((NU8) 112):
		case ((NU8) 106):
		case ((NU8) 88):
		case ((NU8) 89):
		case ((NU8) 114):
		case ((NU8) 115):
		case ((NU8) 116):
		{
			TY145497 LOC38;
			NimStringDesc* LOC39;
			memset((void*)LOC38, 0, sizeof(LOC38));
			LOC39 = 0;
			LOC39 = esc_309216((*d).Sup.Target, literal, -1);
			LOC38[0] = torope_145058(LOC39);
			dispa_341083(&result, ((NimStringDesc*) &TMP4355), ((NimStringDesc*) &TMP4356), LOC38, 1);
		}
		break;
		}
	} LA11: ;
	(*d).Id += 1;
	LOC40 = 0;
	LOC40 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
	LOC41 = 0;
	LOC41 = escape_332667(LOC40);
	plainnamerope = torope_145058(LOC41);
	cleanplainsymbol = renderplainsymbolname_338007(namenode);
	complexsymbol = complexname_342077(k, n, cleanplainsymbol);
	plainsymbolrope = torope_145058(cleanplainsymbol);
	LOC42 = 0;
	LOC42 = urlencode_336002(cleanplainsymbol);
	plainsymbolencrope = torope_145058(LOC42);
	itemidrope = torope_145062(((NI64) ((*d).Id)));
	symbolorid = newuniqueplainsymbol_342056(d, complexsymbol);
	symboloridrope = torope_145058(symbolorid);
	LOC43 = 0;
	LOC43 = urlencode_336002(symbolorid);
	symboloridencrope = torope_145058(LOC43);
	seesrcrope = NIM_NIL;
	docitemseesrc = getconfigvar_137311(((NimStringDesc*) &TMP4376));
	{
		NIM_BOOL LOC46;
		trope145007* urlrope;
		TY503234 LOC50;
		NimStringDesc* LOC51;
		NimStringDesc* LOC52;
		TY145497 LOC53;
		TY470214 LOC54;
		NimStringDesc* LOC55;
		NimStringDesc* LOC56;
		LOC46 = 0;
		LOC46 = (0 < docitemseesrc->Sup.len);
		if (!(LOC46)) goto LA47;
		LOC46 = (0 < docseesrcurl_137118->Sup.len);
		LA47: ;
		if (!LOC46) goto LA48;
		memset((void*)LOC50, 0, sizeof(LOC50));
		LOC51 = 0;
		LOC51 = tofilename_164780((*n).Info.Fileindex);
		LOC50[0] = torope_145058(LOC51);
		LOC52 = 0;
		LOC52 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC50[1] = torope_145058(LOC52);
		urlrope = ropeformatnamedvars_341128(docseesrcurl_137118, TMP4380, 2, LOC50, 2);
		memset((void*)LOC53, 0, sizeof(LOC53));
		memset((void*)LOC54, 0, sizeof(LOC54));
		LOC55 = 0;
		LOC55 = tofilename_164780((*n).Info.Fileindex);
		LOC54[0] = torope_145058(LOC55);
		LOC56 = 0;
		LOC56 = nimIntToStr(((NI) ((*n).Info.Line)));
		LOC54[1] = torope_145058(LOC56);
		LOC54[2] = urlrope;
		LOC53[0] = ropeformatnamedvars_341128(docitemseesrc, TMP4384, 3, LOC54, 3);
		dispa_341083(&seesrcrope, ((NimStringDesc*) &TMP4383), ((NimStringDesc*) &TMP1987), LOC53, 1);
	}
	LA48: ;
	LOC57 = 0;
	LOC57 = getconfigvar_137311(((NimStringDesc*) &TMP4386));
	memset((void*)LOC58, 0, sizeof(LOC58));
	LOC58[0] = namerope;
	LOC58[1] = result;
	LOC58[2] = comm;
	LOC58[3] = itemidrope;
	LOC58[4] = plainnamerope;
	LOC58[5] = plainsymbolrope;
	LOC58[6] = symboloridrope;
	LOC58[7] = plainsymbolencrope;
	LOC58[8] = symboloridencrope;
	LOC58[9] = seesrcrope;
	LOC59 = 0;
	LOC59 = ropeformatnamedvars_341128(LOC57, TMP4387, 10, LOC58, 10);
	app_145040(&(*d).Section[(k)- 0], LOC59);
	LOC60 = 0;
	LOC60 = getconfigvar_137311(((NimStringDesc*) &TMP4398));
	memset((void*)LOC61, 0, sizeof(LOC61));
	LOC62 = 0;
	LOC62 = getname_341862(d, namenode, (*d).Sup.Splitafter);
	LOC61[0] = torope_145058(LOC62);
	LOC61[1] = result;
	LOC61[2] = comm;
	LOC61[3] = itemidrope;
	LOC61[4] = plainnamerope;
	LOC61[5] = plainsymbolrope;
	LOC61[6] = symboloridrope;
	LOC61[7] = plainsymbolencrope;
	LOC61[8] = symboloridencrope;
	LOC63 = 0;
	LOC63 = ropeformatnamedvars_341128(LOC60, TMP4399, 9, LOC61, 9);
	app_145040(&(*d).Toc[(k)- 0], LOC63);
	LOC64 = 0;
	LOC65 = 0;
	LOC65 = nosextractFilename((*d).Sup.Filename);
	LOC66 = 0;
	LOC66 = noschangeFileExt(LOC65, ((NimStringDesc*) &TMP1987));
	LOC64 = rawNewString(LOC66->Sup.len + 3);
appendString(LOC64, LOC66);
appendString(LOC64, ((NimStringDesc*) &TMP4400));
	linktitle = LOC64;
	{
		NIM_BOOL LOC69;
		NimStringDesc* LOC72;
		NimStringDesc* LOC73;
		LOC69 = 0;
		LOC69 = iscallable_342095(n);
		if (!LOC69) goto LA70;
		LOC72 = 0;
		LOC72 = nsuStrip(plainname, NIM_TRUE, NIM_TRUE);
		LOC73 = 0;
		LOC73 = escape_332667(LOC72);
		linktitle = resizeString(linktitle, LOC73->Sup.len + 0);
appendString(linktitle, LOC73);
	}
	goto LA67;
	LA70: ;
	{
		NimStringDesc* LOC75;
		NimStringDesc* LOC76;
		LOC75 = 0;
		LOC75 = nsuStrip(complexsymbol, NIM_TRUE, NIM_TRUE);
		LOC76 = 0;
		LOC76 = escape_332667(LOC75);
		linktitle = resizeString(linktitle, LOC76->Sup.len + 0);
appendString(linktitle, LOC76);
	}
	LA67: ;
	LOC77 = 0;
	LOC77 = docstringsummary_342101(plaindocstring);
	LOC78 = 0;
	LOC78 = escape_332667(LOC77);
	setindexterm_309433(&d->Sup, symbolorid, name, linktitle, LOC78);
	BeforeRet: ;
}

static N_INLINE(NI, sonslen_189181)(tnode188803* 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_342398)(tnode188803* n) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = ((*n).Kind == ((NU8) 2));
	if (!(LOC1)) goto LA2;
	LOC1 = identeq_167469((*n).kindU.S5.Ident, ((NimStringDesc*) &TMP4403));
	LA2: ;
	result = LOC1;
	return result;
}

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

N_NIMCALL(void, tracedeps_342427)(tdocumentor341005* d, tnode188803* n) {
	TY145497 LOC5;
	NimStringDesc* LOC6;
	{
		if (!!(((*d).Section[(((NU8) 6))- 0] == NIM_NIL))) goto LA3;
		app_145046(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4404));
	}
	LA3: ;
	memset((void*)LOC5, 0, sizeof(LOC5));
	LOC6 = 0;
	LOC6 = getmodulename_255012(n);
	LOC5[0] = torope_145058(LOC6);
	dispa_341083(&(*d).Section[(((NU8) 6))- 0], ((NimStringDesc*) &TMP4405), ((NimStringDesc*) &TMP4383), LOC5, 1);
}

N_NIMCALL(void, generatedoc_342457)(tdocumentor341005* d, tnode188803* n) {
	switch ((*n).Kind) {
	case ((NU8) 124):
	{
		NimStringDesc* LOC2;
		LOC2 = 0;
		LOC2 = gencomment_341366(d, n);
		app_145046(&(*d).Moddesc, LOC2);
	}
	break;
	case ((NU8) 79):
	{
		documentraises_320933(n);
		genitem_342212(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_320933(n);
		genitem_342212(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_320933(n);
		genitem_342212(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		genitem_342212(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		genitem_342212(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_320933(n);
		genitem_342212(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_343227;
		NI HEX3Atmp_343432;
		NI LOC10;
		NI res_343434;
		i_343227 = 0;
		HEX3Atmp_343432 = 0;
		LOC10 = 0;
		LOC10 = sonslen_189181(n);
		HEX3Atmp_343432 = (NI32)(LOC10 - 1);
		res_343434 = 0;
		while (1) {
			if (!(res_343434 <= HEX3Atmp_343432)) goto LA11;
			i_343227 = res_343434;
			{
				if (!!(((*(*n).kindU.S6.Sons->data[i_343227]).Kind == ((NU8) 124)))) goto LA14;
				genitem_342212(d, (*n).kindU.S6.Sons->data[i_343227], (*(*n).kindU.S6.Sons->data[i_343227]).kindU.S6.Sons->data[0], ((NU8) 7) + ((NI) ((NI32)(((NI) ((*n).Kind)) - 98))));
			}
			LA14: ;
			res_343434 += 1;
		} LA11: ;
	}
	break;
	case ((NU8) 114):
	{
		NI i_343336;
		NI HEX3Atmp_343436;
		NI LOC17;
		NI res_343438;
		i_343336 = 0;
		HEX3Atmp_343436 = 0;
		LOC17 = 0;
		LOC17 = sonslen_189181(n);
		HEX3Atmp_343436 = (NI32)(LOC17 - 1);
		res_343438 = 0;
		while (1) {
			if (!(res_343438 <= HEX3Atmp_343436)) goto LA18;
			i_343336 = res_343438;
			generatedoc_342457(d, (*n).kindU.S6.Sons->data[i_343336]);
			res_343438 += 1;
		} LA18: ;
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC22;
			tnode188803* LOC25;
			LOC22 = 0;
			LOC22 = checkforfalse_342398((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			if (!!(LOC22)) goto LA23;
			LOC25 = 0;
			LOC25 = lastson_189189((*n).kindU.S6.Sons->data[0]);
			generatedoc_342457(d, LOC25);
		}
		LA23: ;
	}
	break;
	case ((NU8) 115):
	{
		NI i_343403;
		NI HEX3Atmp_343440;
		NI LOC27;
		NI res_343442;
		i_343403 = 0;
		HEX3Atmp_343440 = 0;
		LOC27 = 0;
		LOC27 = sonslen_189181(n);
		HEX3Atmp_343440 = (NI32)(LOC27 - 1);
		res_343442 = 0;
		while (1) {
			if (!(res_343442 <= HEX3Atmp_343440)) goto LA28;
			i_343403 = res_343442;
			tracedeps_342427(d, (*n).kindU.S6.Sons->data[i_343403]);
			res_343442 += 1;
		} LA28: ;
	}
	break;
	case ((NU8) 119):
	case ((NU8) 116):
	{
		tracedeps_342427(d, (*n).kindU.S6.Sons->data[0]);
	}
	break;
	default:
	{
	}
	break;
	}
}

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

N_NIMCALL(void, gensection_344475)(tdocumentor341005* d, NU8 kind) {
	trope145007* title;
	NimStringDesc* LOC5;
	TY471942 LOC6;
	NimStringDesc* LOC7;
	TY471942 LOC8;
	{
		if (!((*d).Section[(kind)- 0] == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	title = torope_145058(sectionnames_344479[(kind)- 6]);
	LOC5 = 0;
	LOC5 = getconfigvar_137311(((NimStringDesc*) &TMP4421));
	memset((void*)LOC6, 0, sizeof(LOC6));
	LOC6[0] = torope_145062(((NI64) (kind)));
	LOC6[1] = title;
	LOC6[2] = torope_145062(((NI64) ((NI32)(((NI) (kind)) + 50))));
	LOC6[3] = (*d).Section[(kind)- 0];
	asgnRefNoCycle((void**) &(*d).Section[(kind)- 0], ropeformatnamedvars_341128(LOC5, TMP4422, 4, LOC6, 4));
	LOC7 = 0;
	LOC7 = getconfigvar_137311(((NimStringDesc*) &TMP4427));
	memset((void*)LOC8, 0, sizeof(LOC8));
	LOC8[0] = torope_145062(((NI64) (kind)));
	LOC8[1] = title;
	LOC8[2] = torope_145062(((NI64) ((NI32)(((NI) (kind)) + 50))));
	LOC8[3] = (*d).Toc[(kind)- 0];
	asgnRefNoCycle((void**) &(*d).Toc[(kind)- 0], ropeformatnamedvars_341128(LOC7, TMP4422, 4, LOC8, 4));
	BeforeRet: ;
}

N_NIMCALL(trope145007*, genoutfile_344554)(tdocumentor341005* d) {
	trope145007* result;
	trope145007* code;
	trope145007* content;
	NimStringDesc* title;
	NI j;
	NimStringDesc* tmp;
	trope145007* toc;
	NU8 i_344611;
	NU8 res_344689;
	NU8 i_344652;
	NU8 res_344694;
	NimStringDesc* bodyname;
	NimStringDesc* LOC22;
	TY473698 LOC23;
	NimStringDesc* LOC24;
	NimStringDesc* LOC25;
	result = 0;
	code = 0;
	content = 0;
	title = copyString(((NimStringDesc*) &TMP1987));
	j = 0;
	tmp = copyString(((NimStringDesc*) &TMP1987));
	rendertocentries_310056(&d->Sup, &j, 1, &tmp);
	toc = torope_145058(tmp);
	i_344611 = 0;
	res_344689 = ((NU8) 0);
	while (1) {
		if (!(res_344689 <= ((NU8) 24))) goto LA1;
		i_344611 = res_344689;
		gensection_344475(d, i_344611);
		app_145040(&toc, (*d).Toc[(i_344611)- 0]);
		res_344689 += 1;
	} LA1: ;
	{
		NimStringDesc* LOC6;
		TY145497 LOC7;
		if (!!((toc == NIM_NIL))) goto LA4;
		LOC6 = 0;
		LOC6 = getconfigvar_137311(((NimStringDesc*) &TMP4428));
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = toc;
		toc = ropeformatnamedvars_341128(LOC6, TMP4429, 1, LOC7, 1);
	}
	LA4: ;
	i_344652 = 0;
	res_344694 = ((NU8) 0);
	while (1) {
		if (!(res_344694 <= ((NU8) 24))) goto LA8;
		i_344652 = res_344694;
		app_145040(&code, (*d).Section[(i_344652)- 0]);
		res_344694 += 1;
	} LA8: ;
	{
		if (!!(((*d).Sup.Meta[(((NU8) 1))- 0]->Sup.len == 0))) goto LA11;
		title = copyString((*d).Sup.Meta[(((NU8) 1))- 0]);
	}
	goto LA9;
	LA11: ;
	{
		NimStringDesc* LOC14;
		NimStringDesc* LOC15;
		NimStringDesc* LOC16;
		LOC14 = 0;
		LOC15 = 0;
		LOC15 = noschangeFileExt((*d).Sup.Filename, ((NimStringDesc*) &TMP1987));
		LOC16 = 0;
		LOC16 = nosextractFilename(LOC15);
		LOC14 = rawNewString(LOC16->Sup.len + 7);
appendString(LOC14, ((NimStringDesc*) &TMP4430));
appendString(LOC14, LOC16);
		title = LOC14;
	}
	LA9: ;
	{
		if (!(*d).Sup.Hastoc) goto LA19;
		bodyname = copyString(((NimStringDesc*) &TMP4431));
	}
	goto LA17;
	LA19: ;
	{
		bodyname = copyString(((NimStringDesc*) &TMP4432));
	}
	LA17: ;
	LOC22 = 0;
	LOC22 = getconfigvar_137311(bodyname);
	memset((void*)LOC23, 0, sizeof(LOC23));
	LOC23[0] = torope_145058(title);
	LOC23[1] = toc;
	LOC23[2] = (*d).Moddesc;
	LOC24 = 0;
	LOC24 = ntgetDateStr();
	LOC23[3] = torope_145058(LOC24);
	LOC25 = 0;
	LOC25 = ntgetClockStr();
	LOC23[4] = torope_145058(LOC25);
	LOC23[5] = code;
	content = ropeformatnamedvars_341128(LOC22, TMP4433, 6, LOC23, 6);
	{
		NimStringDesc* LOC30;
		TY344682 LOC31;
		NimStringDesc* LOC32;
		NimStringDesc* LOC33;
		if (!!(((gglobaloptions_137111 &(1<<((((NU8) 4))&31)))!=0))) goto LA28;
		LOC30 = 0;
		LOC30 = getconfigvar_137311(((NimStringDesc*) &TMP4439));
		memset((void*)LOC31, 0, sizeof(LOC31));
		LOC31[0] = torope_145058(title);
		LOC31[1] = toc;
		LOC31[2] = (*d).Moddesc;
		LOC32 = 0;
		LOC32 = ntgetDateStr();
		LOC31[3] = torope_145058(LOC32);
		LOC33 = 0;
		LOC33 = ntgetClockStr();
		LOC31[4] = torope_145058(LOC33);
		LOC31[5] = content;
		LOC31[6] = torope_145058((*d).Sup.Meta[(((NU8) 3))- 0]);
		LOC31[7] = torope_145058((*d).Sup.Meta[(((NU8) 4))- 0]);
		code = ropeformatnamedvars_341128(LOC30, TMP4440, 8, LOC31, 8);
	}
	goto LA26;
	LA28: ;
	{
		code = content;
	}
	LA26: ;
	result = code;
	return result;
}

N_NIMCALL(void, writeoutput_344719)(tdocumentor341005* d, NimStringDesc* filename, NimStringDesc* outext, NIM_BOOL usewarning) {
	trope145007* content;
	content = genoutfile_344554(d);
	{
		if (!((gglobaloptions_137111 &(1<<((((NU8) 22))&31)))!=0)) goto LA3;
		writerope_145993(stdout, content);
	}
	goto LA1;
	LA3: ;
	{
		NimStringDesc* LOC6;
		LOC6 = 0;
		LOC6 = getoutfile_137323(filename, outext);
		writerope_146407(content, LOC6, usewarning);
	}
	LA1: ;
}

N_NIMCALL(void, generateindex_344700)(tdocumentor341005* d) {
	{
		NimStringDesc* LOC5;
		TY108700 LOC6;
		TY108700 LOC7;
		NimStringDesc* LOC8;
		if (!((gglobaloptions_137111 &(1<<((((NU8) 30))&31)))!=0)) goto LA3;
		LOC5 = 0;
		memset((void*)&LOC6, 0, sizeof(LOC6));
		nossplitFile(outfile_137117, &LOC6);
		memset((void*)&LOC7, 0, sizeof(LOC7));
		nossplitFile((*d).Sup.Filename, &LOC7);
		LOC8 = 0;
		LOC8 = HEX2F_108477(LOC6.Field0, LOC7.Field1);
		LOC5 = rawNewString(LOC8->Sup.len + 4);
appendString(LOC5, LOC8);
appendString(LOC5, ((NimStringDesc*) &TMP4445));
		writeindexfile_309120(&d->Sup, LOC5);
	}
	LA3: ;
}

N_NIMCALL(void, commanddoc_344741)(void) {
	tnode188803* ast;
	tdocumentor341005* d;
	ast = parsefile_220033(gprojectmainidx_137209);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_341048(gprojectfull_137208, gconfigvars_137203);
	(*d).Sup.Hastoc = NIM_TRUE;
	generatedoc_342457(d, ast);
	writeoutput_344719(d, gprojectfull_137208, ((NimStringDesc*) &TMP4443), NIM_FALSE);
	generateindex_344700(d);
	BeforeRet: ;
}

N_NIMCALL(void, commandrstaux_344764)(NimStringDesc* filename, NimStringDesc* outext) {
	NimStringDesc* filen;
	tdocumentor341005* d;
	trstnode297009* rst;
	NimStringDesc* LOC1;
	NimStringDesc* moddesc;
	filen = nosaddFileExt(filename, ((NimStringDesc*) &TMP4452));
	d = newdocumentor_341048(filen, gconfigvars_137203);
	LOC1 = 0;
	LOC1 = readfile_10440(filen);
	rst = parserst_341036(LOC1, filen, 0, 1, &(*d).Sup.Hastoc, 4);
	moddesc = rawNewString(30000);
	renderrsttoout_309339(&d->Sup, rst, &moddesc);
	asgnRefNoCycle((void**) &(*d).Moddesc, torope_145058(moddesc));
	writeoutput_344719(d, filename, outext, NIM_FALSE);
	generateindex_344700(d);
}

N_NIMCALL(void, commandrst2html_344779)(void) {
	commandrstaux_344764(gprojectfull_137208, ((NimStringDesc*) &TMP4443));
}

N_NIMCALL(void, commandrst2tex_344783)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_309149; splitter_309149 = copyStringRC1(((NimStringDesc*) &TMP4454));
	if (LOC1) nimGCunrefNoCycle(LOC1);
	commandrstaux_344764(gprojectfull_137208, ((NimStringDesc*) &TMP4455));
}

N_NIMCALL(tjsonnode292105*, genjsonitem_342370)(tdocumentor341005* d, tnode188803* n, tnode188803* namenode, NU8 k) {
	tjsonnode292105* result;
	NimStringDesc* name;
	NimStringDesc* comm;
	trope145007* LOC6;
	tsrcgen211021 r;
	TY342393 LOC7;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = isvisible_341696(namenode);
		if (!!(LOC3)) goto LA4;
		goto BeforeRet;
	}
	LA4: ;
	name = getname_341862(d, namenode, -1);
	LOC6 = 0;
	LOC6 = genreccomment_341396(d, n);
	comm = ropetostr_145075(LOC6);
	memset((void*)&r, 0, sizeof(r));
	inittokrender_211058(&r, n, 14);
	memset((void*)LOC7, 0, sizeof(LOC7));
	LOC7[0].Field0 = copyString(((NimStringDesc*) &TMP4388));
	LOC7[0].Field1 = HEX25_292466(name);
	LOC7[1].Field0 = copyString(((NimStringDesc*) &TMP4464));
	LOC7[1].Field1 = HEX25_292466(reprEnum(k, (&NTI188441)));
	result = HEX25_292610(LOC7, 2);
	{
		NIM_BOOL LOC10;
		tjsonnode292105* 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_292466(comm);
		HEX5BHEX5DHEX3D_294036(result, ((NimStringDesc*) &TMP4465), LOC14);
	}
	LA12: ;
	{
		tjsonnode292105* LOC19;
		if (!!((r.Buf == NIM_NIL))) goto LA17;
		LOC19 = 0;
		LOC19 = HEX25_292466(r.Buf);
		HEX5BHEX5DHEX3D_294036(result, ((NimStringDesc*) &TMP4466), LOC19);
	}
	LA17: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(tjsonnode292105*, generatejson_343449)(tdocumentor341005* d, tnode188803* n, tjsonnode292105* jarray) {
	tjsonnode292105* result;
	result = 0;
	switch ((*n).Kind) {
	case ((NU8) 124):
	{
		{
			NIM_BOOL LOC4;
			NimStringDesc* stripped;
			NimStringDesc* LOC8;
			TY343459 LOC9;
			LOC4 = 0;
			LOC4 = !(((*n).Comment == NIM_NIL));
			if (!(LOC4)) goto LA5;
			LOC4 = nsuStartsWith((*n).Comment, ((NimStringDesc*) &TMP1986));
			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*) &TMP4463));
			LOC9[0].Field1 = HEX25_292466(stripped);
			result = HEX25_292610(LOC9, 1);
		}
		LA6: ;
	}
	break;
	case ((NU8) 79):
	{
		documentraises_320933(n);
		result = genjsonitem_342370(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 12));
	}
	break;
	case ((NU8) 80):
	{
		documentraises_320933(n);
		result = genjsonitem_342370(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 13));
	}
	break;
	case ((NU8) 84):
	{
		documentraises_320933(n);
		result = genjsonitem_342370(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 14));
	}
	break;
	case ((NU8) 82):
	{
		result = genjsonitem_342370(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 17));
	}
	break;
	case ((NU8) 83):
	{
		result = genjsonitem_342370(d, n, (*n).kindU.S6.Sons->data[0], ((NU8) 18));
	}
	break;
	case ((NU8) 81):
	{
		documentraises_320933(n);
		result = genjsonitem_342370(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_344227;
		NI HEX3Atmp_344463;
		NI LOC17;
		NI res_344465;
		i_344227 = 0;
		HEX3Atmp_344463 = 0;
		LOC17 = 0;
		LOC17 = sonslen_189181(n);
		HEX3Atmp_344463 = (NI32)(LOC17 - 1);
		res_344465 = 0;
		while (1) {
			if (!(res_344465 <= HEX3Atmp_344463)) goto LA18;
			i_344227 = res_344465;
			{
				if (!!(((*(*n).kindU.S6.Sons->data[i_344227]).Kind == ((NU8) 124)))) goto LA21;
				result = genjsonitem_342370(d, (*n).kindU.S6.Sons->data[i_344227], (*(*n).kindU.S6.Sons->data[i_344227]).kindU.S6.Sons->data[0], ((NU8) 7) + ((NI) ((NI32)(((NI) ((*n).Kind)) - 98))));
			}
			LA21: ;
			res_344465 += 1;
		} LA18: ;
	}
	break;
	case ((NU8) 114):
	{
		tjsonnode292105* elem;
		NI i_344354;
		NI HEX3Atmp_344467;
		NI LOC28;
		NI res_344469;
		elem = jarray;
		{
			if (!(elem == NIM_NIL)) goto LA26;
			elem = newjarray_292411();
		}
		LA26: ;
		i_344354 = 0;
		HEX3Atmp_344467 = 0;
		LOC28 = 0;
		LOC28 = sonslen_189181(n);
		HEX3Atmp_344467 = (NI32)(LOC28 - 1);
		res_344469 = 0;
		while (1) {
			tjsonnode292105* r;
			if (!(res_344469 <= HEX3Atmp_344467)) goto LA29;
			i_344354 = res_344469;
			r = generatejson_343449(d, (*n).kindU.S6.Sons->data[i_344354], elem);
			{
				if (!!((r == NIM_NIL))) goto LA32;
				add_293644(elem, r);
				{
					if (!(result == NIM_NIL)) goto LA36;
					result = elem;
				}
				LA36: ;
			}
			LA32: ;
			res_344469 += 1;
		} LA29: ;
	}
	break;
	case ((NU8) 93):
	{
		{
			NIM_BOOL LOC41;
			NIM_BOOL LOC42;
			tnode188803* LOC46;
			tjsonnode292105* LOC47;
			LOC41 = 0;
			LOC42 = 0;
			LOC42 = checkforfalse_342398((*(*n).kindU.S6.Sons->data[0]).kindU.S6.Sons->data[0]);
			LOC41 = !(LOC42);
			if (!(LOC41)) goto LA43;
			LOC41 = !((jarray == NIM_NIL));
			LA43: ;
			if (!LOC41) goto LA44;
			LOC46 = 0;
			LOC46 = lastson_189189((*n).kindU.S6.Sons->data[0]);
			LOC47 = 0;
			LOC47 = generatejson_343449(d, LOC46, jarray);
		}
		LA44: ;
	}
	break;
	default:
	{
	}
	break;
	}
	return result;
}

N_NIMCALL(void, commandjson_344787)(void) {
	tnode188803* ast;
	tdocumentor341005* d;
	tjsonnode292105* json;
	trope145007* content;
	NimStringDesc* LOC5;
	ast = parsefile_220033(gprojectmainidx_137209);
	{
		if (!(ast == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	d = newdocumentor_341048(gprojectfull_137208, gconfigvars_137203);
	(*d).Sup.Hastoc = NIM_TRUE;
	json = generatejson_343449(d, ast, NIM_NIL);
	LOC5 = 0;
	LOC5 = pretty_295140(json, 2);
	content = newrope_145135(LOC5);
	{
		if (!((gglobaloptions_137111 &(1<<((((NU8) 22))&31)))!=0)) goto LA8;
		writerope_145993(stdout, content);
	}
	goto LA6;
	LA8: ;
	{
		NimStringDesc* LOC11;
		NimStringDesc* LOC12;
		LOC11 = 0;
		LOC11 = getoutfile_137323(gprojectfull_137208, ((NimStringDesc*) &TMP4484));
		printf("%s\012", (LOC11)->data);
		LOC12 = 0;
		LOC12 = getoutfile_137323(gprojectfull_137208, ((NimStringDesc*) &TMP4484));
		writerope_146407(content, LOC12, NIM_FALSE);
	}
	LA6: ;
	BeforeRet: ;
}

N_NIMCALL(void, commandbuildindex_344825)(void) {
	trope145007* content;
	NimStringDesc* LOC1;
	trope145007* code;
	NimStringDesc* LOC2;
	TY344682 LOC3;
	NimStringDesc* LOC4;
	NimStringDesc* LOC5;
	NimStringDesc* LOC6;
	LOC1 = 0;
	LOC1 = mergeindexes_309570(gprojectfull_137208);
	content = torope_145058(LOC1);
	LOC2 = 0;
	LOC2 = getconfigvar_137311(((NimStringDesc*) &TMP4439));
	memset((void*)LOC3, 0, sizeof(LOC3));
	LOC3[0] = torope_145058(((NimStringDesc*) &TMP4494));
	LOC3[1] = NIM_NIL;
	LOC3[2] = NIM_NIL;
	LOC4 = 0;
	LOC4 = ntgetDateStr();
	LOC3[3] = torope_145058(LOC4);
	LOC5 = 0;
	LOC5 = ntgetClockStr();
	LOC3[4] = torope_145058(LOC5);
	LOC3[5] = content;
	LOC3[6] = NIM_NIL;
	LOC3[7] = NIM_NIL;
	code = ropeformatnamedvars_341128(LOC2, TMP4440, 8, LOC3, 8);
	LOC6 = 0;
	LOC6 = getoutfile_137323(((NimStringDesc*) &TMP4495), ((NimStringDesc*) &TMP4443));
	writerope_146407(code, LOC6, NIM_FALSE);
}
N_NOINLINE(void, docgenInit)(void) {
}

N_NOINLINE(void, docgenDatInit)(void) {
static TNimNode* TMP4333[6];
static TNimNode TMP860[7];
NTI341005.size = sizeof(tdocumentor341005);
NTI341005.kind = 17;
NTI341005.base = (&NTI309012);
TMP4333[0] = &TMP860[1];
TMP860[1].kind = 1;
TMP860[1].offset = offsetof(tdocumentor341005, Moddesc);
TMP860[1].typ = (&NTI145005);
TMP860[1].name = "modDesc";
TMP4333[1] = &TMP860[2];
TMP860[2].kind = 1;
TMP860[2].offset = offsetof(tdocumentor341005, Id);
TMP860[2].typ = (&NTI106);
TMP860[2].name = "id";
TMP4333[2] = &TMP860[3];
NTI341003.size = sizeof(tsections341003);
NTI341003.kind = 16;
NTI341003.base = (&NTI145005);
NTI341003.flags = 2;
TMP860[3].kind = 1;
TMP860[3].offset = offsetof(tdocumentor341005, Toc);
TMP860[3].typ = (&NTI341003);
TMP860[3].name = "toc";
TMP4333[3] = &TMP860[4];
TMP860[4].kind = 1;
TMP860[4].offset = offsetof(tdocumentor341005, Section);
TMP860[4].typ = (&NTI341003);
TMP860[4].name = "section";
TMP4333[4] = &TMP860[5];
TMP860[5].kind = 1;
TMP860[5].offset = offsetof(tdocumentor341005, Indexvalfilename);
TMP860[5].typ = (&NTI143);
TMP860[5].name = "indexValFilename";
TMP4333[5] = &TMP860[6];
TMP860[6].kind = 1;
TMP860[6].offset = offsetof(tdocumentor341005, Seensymbols);
TMP860[6].typ = (&NTI121812);
TMP860[6].name = "seenSymbols";
TMP860[0].len = 6; TMP860[0].kind = 2; TMP860[0].sons = &TMP4333[0];
NTI341005.node = &TMP860[0];
NTI341007.size = sizeof(tdocumentor341005*);
NTI341007.kind = 22;
NTI341007.base = (&NTI341005);
NTI341007.marker = TMP4334;
}

