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

#include <string.h>

#include <dirent.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <time.h>

#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tcell46347 Tcell46347;
typedef struct TNimType TNimType;
typedef struct Tcellseq46363 Tcellseq46363;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46359 Tcellset46359;
typedef struct Tpagedesc46355 Tpagedesc46355;
typedef struct Tmemregion28210 Tmemregion28210;
typedef struct Tsmallchunk27440 Tsmallchunk27440;
typedef struct Tllchunk28204 Tllchunk28204;
typedef struct Tbigchunk27442 Tbigchunk27442;
typedef struct Tintset27417 Tintset27417;
typedef struct Ttrunk27413 Ttrunk27413;
typedef struct Tavlnode28208 Tavlnode28208;
typedef struct Tgcstat48214 Tgcstat48214;
typedef struct Trstgenerator311016 Trstgenerator311016;
typedef struct Trstnode296011 Trstnode296011;
typedef struct Trstnodeseq296009 Trstnodeseq296009;
typedef struct TNimObject TNimObject;
typedef struct TNimNode TNimNode;
typedef struct Stringtableobj134012 Stringtableobj134012;
typedef struct TY311034 TY311034;
typedef struct Table311052 Table311052;
typedef struct Keyvaluepairseq311055 Keyvaluepairseq311055;
typedef struct Ttocentry311012 Ttocentry311012;
typedef struct Codeblockparams311020 Codeblockparams311020;
typedef struct Keyvaluepair134008 Keyvaluepair134008;
typedef struct Tgeneraltokenizer305023 Tgeneraltokenizer305023;
typedef struct TY119589 TY119589;
typedef struct TY314699 TY314699;
typedef struct TY122008 TY122008;
typedef struct TY314702 TY314702;
typedef struct Tindexentry312396 Tindexentry312396;
typedef struct Table312409 Table312409;
typedef struct Keyvaluepairseq312412 Keyvaluepairseq312412;
typedef struct Keyvaluepair312415 Keyvaluepair312415;
typedef struct TY313066 TY313066;
typedef struct TY313067 TY313067;
typedef struct Slice85772 Slice85772;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Keyvaluepairseq134010 Keyvaluepairseq134010;
typedef struct Keyvaluepair311058 Keyvaluepair311058;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tcell46347  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46363  {
NI len;
NI cap;
Tcell46347** d;
};
struct  Tcellset46359  {
NI counter;
NI max;
Tpagedesc46355* head;
Tpagedesc46355** data;
};
typedef Tsmallchunk27440* TY28222[512];
typedef Ttrunk27413* Ttrunkbuckets27415[256];
struct  Tintset27417  {
Ttrunkbuckets27415 data;
};
struct  Tmemregion28210  {
NI minlargeobj;
NI maxlargeobj;
TY28222 freesmallchunks;
Tllchunk28204* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Tbigchunk27442* freechunkslist;
Tintset27417 chunkstarts;
Tavlnode28208* root;
Tavlnode28208* deleted;
Tavlnode28208* last;
Tavlnode28208* freeavlnodes;
};
struct  Tgcstat48214  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Tgcheap48216  {
void* stackbottom;
NI cyclethreshold;
Tcellseq46363 zct;
Tcellseq46363 decstack;
Tcellset46359 cycleroots;
Tcellseq46363 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  Trstnode296011  {
NU8 kind;
NimStringDesc* text;
NI level;
Trstnodeseq296009* sons;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
typedef N_NIMCALL_PTR(NimStringDesc*, Tfindfilehandler297023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, Tmsghandler297021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
typedef NimStringDesc* TY311042[5];
struct  Table311052  {
Keyvaluepairseq311055* data;
NI counter;
};
struct  Trstgenerator311016  {
  TNimObject Sup;
NU8 target;
Stringtableobj134012* config;
NI splitafter;
TY311034* tocpart;
NIM_BOOL hastoc;
NimStringDesc* theindex;
NU8 options;
Tfindfilehandler297023 findfile;
Tmsghandler297021 msghandler;
NimStringDesc* filename;
TY311042 meta;
NimStringDesc* currentsection;
Table311052 seenindexterms;
};
struct  Ttocentry311012  {
Trstnode296011* n;
NimStringDesc* refname;
NimStringDesc* header;
};
typedef NimStringDesc* TY164825[4];
typedef NimStringDesc* TY164566[1];
typedef NimStringDesc* TY154965[2];
typedef NU8 TY178407[32];
struct  Codeblockparams311020  {
NIM_BOOL numberlines;
NI startline;
NimStringDesc* langstr;
NU8 lang;
};
struct Keyvaluepair134008 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
typedef NimStringDesc* TY218714[1];
struct  Tgeneraltokenizer305023  {
  TNimObject Sup;
NU8 kind;
NI start;
NI length;
NCSTRING buf;
NI pos;
NU8 state;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NimStringDesc* TY305082[33];
struct TY119589 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  Tindexentry312396  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
struct  Table312409  {
Keyvaluepairseq312412* data;
NI counter;
};
struct TY314699 {
TY122008* Field0;
TY314702* Field1;
Table312409 Field2;
};
typedef NIM_CHAR TY107377[256];
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (NimStringDesc* x_315310, NimStringDesc* y_315312, void* ClEnv);
void* ClEnv;
} TY315308;
typedef N_CLOSURE_PTR(NI, TMP4923) (NimStringDesc* x_315297, NimStringDesc* y_315299, void* ClEnv);
struct Keyvaluepair312415 {
NI Field0;
Tindexentry312396 Field1;
TY314702* Field2;
};
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Tindexentry312396* x_313696, Tindexentry312396* y_313698, void* ClEnv);
void* ClEnv;
} TY313694;
typedef N_CLOSURE_PTR(NI, TMP4927) (Tindexentry312396* x_314527, Tindexentry312396* y_314529, void* ClEnv);
typedef N_CLOSURE_PTR(NI, TMP4937) (Tindexentry312396* x_313683, Tindexentry312396* y_313685, void* ClEnv);
struct TY313067 {
NI Field0;
NimStringDesc* Field1;
};
struct  Slice85772  {
NI a;
NI b;
};
typedef NimStringDesc* TY176061[3];
typedef NI TY27420[8];
struct  Tpagedesc46355  {
Tpagedesc46355* next;
NI key;
TY27420 bits;
};
struct  Tbasechunk27438  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Tsmallchunk27440  {
  Tbasechunk27438 Sup;
Tsmallchunk27440* next;
Tsmallchunk27440* prev;
Tfreecell27430* freelist;
NI free;
NI acc;
NF data;
};
struct  Tllchunk28204  {
NI size;
NI acc;
Tllchunk28204* next;
};
struct  Tbigchunk27442  {
  Tbasechunk27438 Sup;
Tbigchunk27442* next;
Tbigchunk27442* prev;
NI align;
NF data;
};
struct  Ttrunk27413  {
Ttrunk27413* next;
NI key;
TY27420 bits;
};
typedef Tavlnode28208* TY28214[2];
struct  Tavlnode28208  {
TY28214 link;
NI key;
NI upperbound;
NI level;
};
struct  Stringtableobj134012  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq134010* data;
NU8 mode;
};
struct Keyvaluepair311058 {
NI Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct TY311034 {
  TGenericSeq Sup;
  Ttocentry311012 data[SEQ_DECL_SIZE];
};
struct Trstnodeseq296009 {
  TGenericSeq Sup;
  Trstnode296011* data[SEQ_DECL_SIZE];
};
struct TY122008 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct TY314702 {
  TGenericSeq Sup;
  Tindexentry312396 data[SEQ_DECL_SIZE];
};
struct TY313066 {
  TGenericSeq Sup;
  TY313067 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq311055 {
  TGenericSeq Sup;
  Keyvaluepair311058 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq312412 {
  TGenericSeq Sup;
  Keyvaluepair312415 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq134010 {
  TGenericSeq Sup;
  Keyvaluepair134008 data[SEQ_DECL_SIZE];
};
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Tcell46347*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46347* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46363* s, Tcell46347* c);
N_NIMCALL(void, renderaux_311734)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(NI, len_296084)(Trstnode296011* n);
N_NIMCALL(void, renderrsttoout_311724)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(void, renderheadline_316861)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, rstnodetorefname_297061)(Trstnode296011* n);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(TGenericSeq*, setLengthSeq)(TGenericSeq* seq, NI elemsize, NI newlen);
static N_INLINE(void, asgnRefNoCycle)(void** dest, void* src);
N_NIMCALL(void, dispa_311689)(NU8 target, NimStringDesc** dest, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0);
N_NIMCALL(void, nsuAddf)(NimStringDesc** s, NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(NimStringDesc*, nimCharToStr)(NIM_CHAR x);
N_NIMCALL(void, setindexterm_311855)(Trstgenerator311016* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc);
N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, noschangeFileExt)(NimStringDesc* filename, NimStringDesc* ext);
N_NIMCALL(NimStringDesc*, nosextractFilename)(NimStringDesc* path);
N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, quoteindexcolumn_311835)(NimStringDesc* text);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(void, insert_87401)(NimStringDesc** x, NimStringDesc* item, NI i);
N_NIMCALL(NimStringDesc*, striptochtml_316841)(NimStringDesc* s);
N_NIMCALL(NI, nsuFindChar)(NimStringDesc* s, NIM_CHAR sub, NI start);
N_NIMCALL(void, nsuDelete)(NimStringDesc** s, NI first, NI last);
N_NIMCALL(NimStringDesc*, nsuRepeatChar)(NIM_CHAR c, NI count);
N_NIMCALL(void, renderoverline_317045)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(void, renderaux_311776)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result);
N_NIMCALL(void, renderfield_318716)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, addnodes_297067)(Trstnode296011* n);
N_NIMCALL(NimStringDesc*, esc_311553)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NI, nextsplitpoint_311506)(NimStringDesc* s, NI start);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(void, escchar_311494)(NU8 target, NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addxmlchar_311456)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addtexchar_311478)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, nsuStrip)(NimStringDesc* s, NIM_BOOL leading, NIM_BOOL trailing);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NOINLINE(void, raiseassert_86357)(NimStringDesc* msg);
N_NIMCALL(NimStringDesc*, texcolumns_318676)(Trstnode296011* n);
N_NIMCALL(Trstnode296011*, lastson_296147)(Trstnode296011* n);
N_NIMCALL(void, renderimage_317213)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, getfieldvalue_297073)(Trstnode296011* n, NimStringDesc* fieldname);
N_NIMCALL(NIM_BOOL, allcharsinset_98459)(NimStringDesc* s, TY178407 theset);
N_NIMCALL(NimStringDesc*, dispf_311666)(NU8 target, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getargument_297080)(Trstnode296011* n);
N_NIMCALL(void, rendercodeblock_318233)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(void, parsecodeblockparams_317508)(Trstgenerator311016* d, Trstnode296011* n, Codeblockparams311020* Result);
N_NIMCALL(void, init_311078)(Codeblockparams311020* p);
N_NIMCALL(void, parsecodeblockfield_317493)(Trstgenerator311016* d, Trstnode296011* n, Codeblockparams311020* params);
N_NIMCALL(NimStringDesc*, nsuToLowerStr)(NimStringDesc* s);
N_NIMCALL(NI, npuParseInt)(NimStringDesc* s, NI* number, NI start);
N_NIMCALL(NimStringDesc*, getfieldvalue_300310)(Trstnode296011* n);
N_NIMCALL(NU8, getsourcelanguage_305093)(NimStringDesc* name);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, buildlineshtmltable_318035)(Codeblockparams311020* params, NimStringDesc* code, Keyvaluepair134008* Result);
N_NIMCALL(NI, nsuCountLines)(NimStringDesc* s);
N_NIMCALL(void, initgeneraltokenizer_305289)(Tgeneraltokenizer305023* g, NimStringDesc* buf);
N_NIMCALL(void, getnexttoken_307766)(Tgeneraltokenizer305023* g, NU8 lang);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_76243, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(void, deinitgeneraltokenizer_305300)(Tgeneraltokenizer305023* g);
N_NIMCALL(void, rendercontainer_318657)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(void, renderindexterm_312066)(Trstgenerator311016* d, Trstnode296011* n_312069, NimStringDesc** result);
N_NIMCALL(NIM_BOOL, haskey_312074)(Table311052 t, NimStringDesc* key);
N_NIMCALL(void, HEX5BHEX5DHEX3D_312148)(Table311052* t, NimStringDesc* key, NI val);
N_NIMCALL(NI, HEX5BHEX5D_312117)(Table311052 t, NimStringDesc* key);
N_NIMCALL(void, rendersmiley_317479)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, nstGet)(Stringtableobj134012* t, NimStringDesc* key);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP4762)(void* p, NI op);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY119589* Result);
N_NIMCALL(void, inittable_311116)(NI initialsize, Table311052* Result);
N_NIMCALL(NI, nsuParseInt)(NimStringDesc* s);
N_NIMCALL(void, rendertocentry_317162)(Trstgenerator311016* d, Ttocentry311012* e, NimStringDesc** result);
N_NIMCALL(void, rendertocentries_317176)(Trstgenerator311016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, writefile_13437)(NimStringDesc* filename, NimStringDesc* content);
N_NIMCALL(void, readindexdir_314696)(NimStringDesc* dir, TY314699* Result);
N_NIMCALL(void, inittable_314724)(NI initialsize, Table312409* Result);
N_NIMCALL(void, TMP4915)(void* p, NI op);
N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_NIMCALL(NimStringDesc*, HEX2F_119292)(NimStringDesc* head, NimStringDesc* tail);
N_NIMCALL(NIM_BOOL, nsuEndsWith)(NimStringDesc* s, NimStringDesc* suffix);
N_NIMCALL(FILE*, open_13217)(NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_BOOL, readline_13481)(FILE* f, NimStringDesc** line);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(NIM_BOOL, isdocumentationtitle_312971)(NimStringDesc* hyperlink);
N_NIMCALL(TY122008*, nsuSplitChar)(NimStringDesc* s, NIM_CHAR sep);
N_NIMCALL(NimStringDesc*, unquoteindexcolumn_311845)(NimStringDesc* text);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(NI, len_315060)(Table312409 t);
N_NIMCALL(void, HEX5BHEX5DHEX3D_315072)(Table312409* t, Tindexentry312396* key, TY314702* val);
static N_INLINE(NI, HEX21HEX26_131025)(NI h, NI val);
N_NIMCALL(NI, hash_131839)(NimStringDesc* x);
static N_INLINE(NimStringDesc*, or_311713)(NimStringDesc* x, NimStringDesc* y);
static N_INLINE(NI, HEX21HEX24_131054)(NI h);
N_NIMCALL(void, sort_315301)(NimStringDesc** a, NI aLen0, TY315308 cmp, NU8 order);
N_NIMCALL(NI, cmp_4717)(NimStringDesc* x, NimStringDesc* y);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_81204, TNimType* mt);
N_NIMCALL(NimStringDesc*, generatedocumentationjumps_314392)(Table312409 docs);
static N_INLINE(NIM_BOOL, isfilled_156211)(NI hcode);
N_NIMCALL(void, sort_313687)(Tindexentry312396* a, NI aLen0, TY313694 cmp, NU8 order);
N_NIMCALL(NI, cmp_312430)(Tindexentry312396* a, Tindexentry312396* b);
N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen0, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, generatemodulejumps_314631)(TY122008* modules);
N_NIMCALL(NimStringDesc*, generatedocumentationindex_313431)(Table312409 docs);
N_NIMCALL(NimStringDesc*, generatedocumentationtoc_313060)(TY314702* entries);
N_NIMCALL(void, TMP4939)(void* p, NI op);
N_NIMCALL(void, striptoclevel_312981)(NimStringDesc* s, TY313067* Result);
static N_INLINE(NimStringDesc*, HEX5BHEX5D_85765)(NimStringDesc* s, Slice85772 x);
static N_INLINE(Slice85772, HEX2EHEX2E_105273)(NI a, NI b);
N_NIMCALL(NimStringDesc*, indenttolevel_313048)(NI* level, NI newlevel);
N_NIMCALL(NimStringDesc*, nsuRepeatStr)(NimStringDesc* s, NI n);
N_NIMCALL(TY314702*, HEX5BHEX5D_314282)(Table312409 t, Tindexentry312396* key);
N_NIMCALL(void, sortindex_312818)(Tindexentry312396* a, NI aLen0);
N_NIMCALL(void, HEX3CHEX2D_312807)(Tindexentry312396* a, Tindexentry312396* b);
N_NIMCALL(NimStringDesc*, generatesymbolindex_312895)(TY314702* symbols);
STRING_LITERAL(TMP898, "<wbr />", 7);
STRING_LITERAL(TMP2093, "", 0);
STRING_LITERAL(TMP2095, "-", 1);
STRING_LITERAL(TMP2096, "\012<h$1><a class=\"toc-backref\" id=\"$2\" href=\"#$2\">$3</a></h$1>", 60);
STRING_LITERAL(TMP2097, "\\rsth$4{$3}\\label{$2}\012", 22);
STRING_LITERAL(TMP2098, "\012<h$1 id=\"$2\">$3</h$1>", 22);
STRING_LITERAL(TMP2099, "html", 4);
STRING_LITERAL(TMP2100, "\\", 1);
STRING_LITERAL(TMP2101, "\\\\", 2);
STRING_LITERAL(TMP2102, "\012", 1);
STRING_LITERAL(TMP2103, "\\n", 2);
STRING_LITERAL(TMP2104, "\011", 1);
STRING_LITERAL(TMP2105, "\\t", 2);
STRING_LITERAL(TMP2106, "<h$1 id=\"$2\"><center>$3</center></h$1>", 38);
STRING_LITERAL(TMP2107, "\\rstov$4{$3}\\label{$2}\012", 23);
STRING_LITERAL(TMP2108, "<hr />\012", 7);
STRING_LITERAL(TMP2109, "\\hrule\012", 7);
STRING_LITERAL(TMP2110, "<p>$1</p>\012", 10);
STRING_LITERAL(TMP2111, "$1\012\012", 4);
STRING_LITERAL(TMP2112, "<ul class=\"simple\">$1</ul>\012", 27);
STRING_LITERAL(TMP2113, "\\begin{itemize}$1\\end{itemize}\012", 31);
STRING_LITERAL(TMP2114, "<li>$1</li>\012", 12);
STRING_LITERAL(TMP2115, "\\item $1\012", 9);
STRING_LITERAL(TMP2116, "<ol class=\"simple\">$1</ol>\012", 27);
STRING_LITERAL(TMP2117, "\\begin{enumerate}$1\\end{enumerate}\012", 35);
STRING_LITERAL(TMP2118, "<dl class=\"docutils\">$1</dl>\012", 29);
STRING_LITERAL(TMP2119, "\\begin{description}$1\\end{description}\012", 39);
STRING_LITERAL(TMP2120, "<dt>$1</dt>\012", 12);
STRING_LITERAL(TMP2121, "\\item[$1] ", 10);
STRING_LITERAL(TMP2122, "<dd>$1</dd>\012", 12);
STRING_LITERAL(TMP2123, "$1\012", 3);
STRING_LITERAL(TMP2124, "<table class=\"docinfo\" frame=\"void\" rules=\"none\"><col class=\"do"
"cinfo-name\" /><col class=\"docinfo-content\" /><tbody valign=\"top\""
">$1</tbody></table>", 146);
STRING_LITERAL(TMP2125, " ", 1);
STRING_LITERAL(TMP2126, "&amp;", 5);
STRING_LITERAL(TMP2127, "&lt;", 4);
STRING_LITERAL(TMP2128, "&gt;", 4);
STRING_LITERAL(TMP2129, "&quot;", 6);
STRING_LITERAL(TMP2130, "\\_", 2);
STRING_LITERAL(TMP2131, "\\symbol{123}", 12);
STRING_LITERAL(TMP2132, "\\symbol{125}", 12);
STRING_LITERAL(TMP2133, "\\symbol{91}", 11);
STRING_LITERAL(TMP2134, "\\symbol{93}", 11);
STRING_LITERAL(TMP2135, "\\symbol{92}", 11);
STRING_LITERAL(TMP2136, "\\$", 2);
STRING_LITERAL(TMP2137, "\\&", 2);
STRING_LITERAL(TMP2138, "\\#", 2);
STRING_LITERAL(TMP2139, "\\%", 2);
STRING_LITERAL(TMP2140, "\\symbol{126}", 12);
STRING_LITERAL(TMP2141, "\\symbol{64}", 11);
STRING_LITERAL(TMP2142, "\\symbol{94}", 11);
STRING_LITERAL(TMP2143, "\\symbol{96}", 11);
STRING_LITERAL(TMP2144, "author", 6);
STRING_LITERAL(TMP2145, "authors", 7);
STRING_LITERAL(TMP2146, "version", 7);
STRING_LITERAL(TMP2147, "<tr>$1</tr>\012", 12);
STRING_LITERAL(TMP2148, "$1", 2);
STRING_LITERAL(TMP2149, "<th class=\"docinfo-name\">$1:</th>", 33);
STRING_LITERAL(TMP2150, "\\item[$1:]", 10);
STRING_LITERAL(TMP2151, "<td>$1</td>", 11);
STRING_LITERAL(TMP2152, " $1\012", 4);
STRING_LITERAL(TMP2153, "<table frame=\"void\">$1</table>", 30);
STRING_LITERAL(TMP2154, "\\begin{description}\012$1\\end{description}\012", 40);
STRING_LITERAL(TMP2155, "<th align=\"left\">$1</th>", 24);
STRING_LITERAL(TMP2156, "\\item[$1]", 9);
STRING_LITERAL(TMP2157, "<td align=\"left\">$1</td>\012", 25);
STRING_LITERAL(TMP2159, "false renderRstToOut", 20);
STRING_LITERAL(TMP2160, "<pre>$1</pre>\012", 14);
STRING_LITERAL(TMP2161, "\\begin{rstpre}\012$1\012\\end{rstpre}\012", 31);
STRING_LITERAL(TMP2162, "<p>$1</p>", 9);
STRING_LITERAL(TMP2163, "$1<br />", 8);
STRING_LITERAL(TMP2164, "$1\\\\\012", 5);
STRING_LITERAL(TMP2165, "<blockquote><p>$1</p></blockquote>\012", 35);
STRING_LITERAL(TMP2166, "\\begin{quote}$1\\end{quote}\012", 27);
STRING_LITERAL(TMP2167, "<table border=\"1\" class=\"docutils\">$1</table>", 45);
STRING_LITERAL(TMP2168, "\\begin{table}\\begin{rsttab}{", 28);
STRING_LITERAL(TMP2169, "|X", 2);
STRING_LITERAL(TMP2170, "|}\012\\hline\012$1\\end{rsttab}\\end{table}", 35);
STRING_LITERAL(TMP2171, " & ", 3);
STRING_LITERAL(TMP2172, "\\\\\012\\hline\012", 10);
STRING_LITERAL(TMP2173, "<tr>", 4);
STRING_LITERAL(TMP2174, "</tr>\012", 6);
STRING_LITERAL(TMP2175, "<th>$1</th>", 11);
STRING_LITERAL(TMP2176, "\\textbf{$1}", 11);
STRING_LITERAL(TMP2177, "<a class=\"reference external\" href=\"#$2\">$1</a>", 47);
STRING_LITERAL(TMP2178, "$1\\ref{$2}", 10);
STRING_LITERAL(TMP2179, "<a class=\"reference external\" href=\"$1\">$1</a>", 46);
STRING_LITERAL(TMP2180, "\\href{$1}{$1}", 13);
STRING_LITERAL(TMP2181, "<a class=\"reference external\" href=\"$2\">$1</a>", 46);
STRING_LITERAL(TMP2182, "\\href{$2}{$1}", 13);
STRING_LITERAL(TMP2184, "scale", 5);
static NIM_CONST TY178407 TMP2185 = {
0x00, 0x3E, 0x00, 0x00, 0x21, 0x80, 0xFF, 0x07,
0xFE, 0xFF, 0xFF, 0x97, 0xFE, 0xFF, 0xFF, 0x07,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
;
STRING_LITERAL(TMP2186, " scale=\"$1\"", 11);
STRING_LITERAL(TMP2187, " scale=$1", 9);
STRING_LITERAL(TMP2188, "height", 6);
STRING_LITERAL(TMP2189, " height=\"$1\"", 12);
STRING_LITERAL(TMP2190, " height=$1", 10);
STRING_LITERAL(TMP2191, "width", 5);
STRING_LITERAL(TMP2192, " width=\"$1\"", 11);
STRING_LITERAL(TMP2193, " width=$1", 9);
STRING_LITERAL(TMP2194, "alt", 3);
STRING_LITERAL(TMP2195, " alt=\"$1\"", 9);
STRING_LITERAL(TMP2196, "align", 5);
STRING_LITERAL(TMP2197, " align=\"$1\"", 11);
STRING_LITERAL(TMP2198, "[$1]", 4);
STRING_LITERAL(TMP2199, "<img src=\"$1\"$2 />", 18);
STRING_LITERAL(TMP2200, "\\includegraphics$2{$1}", 22);
STRING_LITERAL(TMP2201, "number-lines", 12);
STRING_LITERAL(TMP2202, "file", 4);
STRING_LITERAL(TMP2203, "default-language", 16);
STRING_LITERAL(TMP2212, "<pre>", 5);
STRING_LITERAL(TMP2213, "</pre>", 6);
NIM_CONST Keyvaluepair134008 TMP2211 = {((NimStringDesc*) &TMP2212),
((NimStringDesc*) &TMP2213)}
;
STRING_LITERAL(TMP2214, "<table class=\"line-nums-table\"><tbody><tr><td class=\"blob-line-"
"nums\"><pre>", 74);
STRING_LITERAL(TMP2215, "</pre></td><td><pre>", 20);
STRING_LITERAL(TMP2216, "</pre></td></tr></tbody></table>", 32);
STRING_LITERAL(TMP2217, "\\begin{rstpre}\012", 15);
STRING_LITERAL(TMP2379, "<span class=\"$2\">$1</span>", 26);
STRING_LITERAL(TMP2380, "\\span$2{$1}", 11);
extern NIM_CONST TY305082 tokenclasstostr_305081;
STRING_LITERAL(TMP2414, "\012\\end{rstpre}\012", 14);
STRING_LITERAL(TMP2415, "<div>$1</div>", 13);
STRING_LITERAL(TMP2416, "<div class=\"$1\">$2</div>", 24);
STRING_LITERAL(TMP2417, "$2", 2);
STRING_LITERAL(TMP2418, "|$1|", 4);
STRING_LITERAL(TMP2419, "<sub>$1</sub>", 13);
STRING_LITERAL(TMP2420, "\\rstsub{$1}", 11);
STRING_LITERAL(TMP2421, "<sup>$1</sup>", 13);
STRING_LITERAL(TMP2422, "\\rstsup{$1}", 11);
STRING_LITERAL(TMP2423, "<em>$1</em>", 11);
STRING_LITERAL(TMP2424, "\\emph{$1}", 9);
STRING_LITERAL(TMP2425, "<strong>$1</strong>", 19);
STRING_LITERAL(TMP2426, "<strong><em>$1</em></strong>", 28);
STRING_LITERAL(TMP2427, "\\textbf{emph{$1}}", 17);
STRING_LITERAL(TMP2428, "<cite>$1</cite>", 15);
STRING_LITERAL(TMP2431, "<span id=\"$1\">$2</span>", 23);
STRING_LITERAL(TMP2432, "$2\\label{$1}", 12);
STRING_LITERAL(TMP2433, "<tt class=\"docutils literal\"><span class=\"pre\">$1</span></tt>", 61);
STRING_LITERAL(TMP2434, "\\texttt{$1}", 11);
STRING_LITERAL(TMP2435, "<img src=\"$1\" width=\"15\"\012        height=\"17\" hspace=\"2\" vspace="
"\"2\" class=\"smiley\" />", 84);
STRING_LITERAL(TMP2436, "\\includegraphics{$1}", 20);
STRING_LITERAL(TMP2437, "doc.smiley_format", 17);
STRING_LITERAL(TMP4766, ".nim", 4);
STRING_LITERAL(TMP4767, "Module ", 7);
STRING_LITERAL(TMP4768, "split.item.toc", 14);
STRING_LITERAL(TMP4843, "<li><a class=\"reference\" id=\"$1_toc\" href=\"#$1\">$2</a></li>\012", 60);
STRING_LITERAL(TMP4844, "\\item\\label{$1_toc} $2\\ref{$1}\012", 31);
STRING_LITERAL(TMP4845, "<ul class=\"simple\">$1</ul>", 26);
STRING_LITERAL(TMP4846, "\\begin{enumerate}$1\\end{enumerate}", 34);
STRING_LITERAL(TMP4917, ".", 1);
STRING_LITERAL(TMP4918, "..", 2);
STRING_LITERAL(TMP4919, ".idx", 4);
STRING_LITERAL(TMP4920, "doc_toc_", 8);
STRING_LITERAL(TMP4924, "Documents: ", 11);
STRING_LITERAL(TMP4928, "<a href=\"", 9);
STRING_LITERAL(TMP4929, "\">", 2);
STRING_LITERAL(TMP4930, "</a>", 4);
STRING_LITERAL(TMP4931, ", ", 2);
STRING_LITERAL(TMP4932, ".<br>", 5);
STRING_LITERAL(TMP4933, "<p />", 5);
STRING_LITERAL(TMP4934, "Modules: ", 9);
STRING_LITERAL(TMP4935, ".html\">", 7);
STRING_LITERAL(TMP4936, "<h2>Documentation files</h2>\012", 29);
STRING_LITERAL(TMP4940, "<ul>\012", 5);
STRING_LITERAL(TMP4941, "<ul>", 4);
STRING_LITERAL(TMP4942, "</ul>", 5);
STRING_LITERAL(TMP4943, "<li><a href=\"", 13);
STRING_LITERAL(TMP4944, "</a>\012", 5);
STRING_LITERAL(TMP4945, "</ul>\012", 6);
STRING_LITERAL(TMP4946, "<ul><li><a href=\"", 17);
STRING_LITERAL(TMP4947, "<h2>API symbols</h2>\012", 21);
STRING_LITERAL(TMP4948, "<dt><a name=\"$2\" href=\"#$2\"><span>$1:</span></a></dt><ul class="
"\"simple\"><dd>\012", 77);
STRING_LITERAL(TMP4949, "<li><a class=\"reference external\"\012          title=\"$3\" href=\"$1"
"\">$2</a></li>\012          ", 87);
STRING_LITERAL(TMP4950, "<li><a class=\"reference external\" href=\"$1\">$2</a></li>\012       "
"   ", 66);
STRING_LITERAL(TMP4951, "</ul></dd>\012", 11);
NimStringDesc* splitter_311489;
extern Tgcheap48216 gch_48244;
extern TNimType NTI305023; /* TGeneralTokenizer */
extern TNimType NTI3411; /* RootObj */
TNimType NTI311016; /* TRstGenerator */
TNimType NTI311010; /* TOutputTarget */
extern TNimType NTI134014; /* StringTableRef */
extern TNimType NTI108; /* int */
TNimType NTI311012; /* TTocEntry */
extern TNimType NTI296007; /* PRstNode */
extern TNimType NTI149; /* string */
TNimType NTI311034; /* seq[TTocEntry] */
extern TNimType NTI138; /* bool */
extern TNimType NTI297015; /* TRstParseOptions */
extern TNimType NTI297023; /* TFindFileHandler */
extern TNimType NTI297021; /* TMsgHandler */
TNimType NTI311042; /* array[TMetaEnum, string] */
extern TNimType NTI311052; /* Table */
extern TNimType NTI122008; /* seq[string] */
TNimType NTI312396; /* TIndexEntry */
TNimType NTI314702; /* seq[TIndexEntry] */
extern TNimType NTI312412; /* KeyValuePairSeq */
TNimType NTI313067; /* tuple[level: int, text: string] */
TNimType NTI313066; /* seq[tuple[level: int, text: string]] */

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

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

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

N_NIMCALL(void, renderaux_311734)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	{
		NI i_311752;
		NI HEX3Atmp_311754;
		NI LOC2;
		NI res_311757;
		i_311752 = 0;
		HEX3Atmp_311754 = 0;
		LOC2 = 0;
		LOC2 = len_296084(n);
		HEX3Atmp_311754 = (NI)(LOC2 - ((NI) 1));
		res_311757 = ((NI) 0);
		{
			while (1) {
				if (!(res_311757 <= HEX3Atmp_311754)) goto LA4;
				i_311752 = res_311757;
				renderrsttoout_311724(d, (*n).sons->data[i_311752], result);
				res_311757 += ((NI) 1);
			} LA4: ;
		}
	}
}

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

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

N_NIMCALL(void, dispa_311689)(NU8 target, NimStringDesc** dest, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0) {
	{
		if (!!((target == ((NU8) 1)))) goto LA3;
		nsuAddf(dest, xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		nsuAddf(dest, tex, args, argsLen0);
	}
	LA1: ;
}

static N_INLINE(void, appendChar)(NimStringDesc* dest, NIM_CHAR c) {
	(*dest).data[((*dest).Sup.len)- 0] = c;
	(*dest).data[((NI)((*dest).Sup.len + ((NI) 1)))- 0] = 0;
	(*dest).Sup.len += ((NI) 1);
}

N_NIMCALL(NimStringDesc*, quoteindexcolumn_311835)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2100), ((NimStringDesc*) &TMP2101));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2102), ((NimStringDesc*) &TMP2103));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2104), ((NimStringDesc*) &TMP2105));
	return result;
}

N_NIMCALL(void, setindexterm_311855)(Trstgenerator311016* d, NimStringDesc* id, NimStringDesc* term, NimStringDesc* linktitle, NimStringDesc* linkdesc) {
	NimStringDesc* entry;
	NIM_BOOL istitle;
	NimStringDesc* htmlfile;
	NimStringDesc* LOC1;
	entry = copyString(term);
	istitle = NIM_FALSE;
	entry = addChar(entry, 9);
	LOC1 = 0;
	LOC1 = nosextractFilename((*d).filename);
	htmlfile = noschangeFileExt(LOC1, ((NimStringDesc*) &TMP2099));
	entry = resizeString(entry, htmlfile->Sup.len + 0);
appendString(entry, htmlfile);
	{
		if (!(((NI) 0) < (id ? id->Sup.len : 0))) goto LA4;
		entry = addChar(entry, 35);
		entry = resizeString(entry, id->Sup.len + 0);
appendString(entry, id);
	}
	goto LA2;
	LA4: ;
	{
		istitle = NIM_TRUE;
	}
	LA2: ;
	{
		NIM_BOOL LOC9;
		NimStringDesc* LOC13;
		NimStringDesc* LOC14;
		NimStringDesc* LOC15;
		NimStringDesc* LOC16;
		LOC9 = 0;
		LOC9 = (((NI) 0) < (linktitle ? linktitle->Sup.len : 0));
		if (LOC9) goto LA10;
		LOC9 = (((NI) 0) < (linkdesc ? linkdesc->Sup.len : 0));
		LA10: ;
		if (!LOC9) goto LA11;
		LOC13 = 0;
		LOC14 = 0;
		LOC14 = quoteindexcolumn_311835(linktitle);
		LOC13 = rawNewString(LOC14->Sup.len + 1);
appendChar(LOC13, 9);
appendString(LOC13, LOC14);
		entry = resizeString(entry, LOC13->Sup.len + 0);
appendString(entry, LOC13);
		LOC15 = 0;
		LOC16 = 0;
		LOC16 = quoteindexcolumn_311835(linkdesc);
		LOC15 = rawNewString(LOC16->Sup.len + 1);
appendChar(LOC15, 9);
appendString(LOC15, LOC16);
		entry = resizeString(entry, LOC15->Sup.len + 0);
appendString(entry, LOC15);
	}
	LA11: ;
	entry = resizeString(entry, 1);
appendString(entry, ((NimStringDesc*) &TMP2102));
	{
		if (!istitle) goto LA19;
		insert_87401((&(*d).theindex), entry, ((NI) 0));
	}
	goto LA17;
	LA19: ;
	{
		(*d).theindex = resizeString((*d).theindex, entry->Sup.len + 0);
appendString((*d).theindex, entry);
	}
	LA17: ;
}

N_NIMCALL(NimStringDesc*, striptochtml_316841)(NimStringDesc* s) {
	NimStringDesc* result;
	NI first;
{	result = 0;
	result = copyString(s);
	first = nsuFindChar(result, 60, ((NI) 0));
	{
		while (1) {
			NI last;
			if (!(((NI) 0) <= first)) goto LA2;
			last = nsuFindChar(result, 62, ((NI) (first)));
			{
				if (!(last < ((NI) 0))) goto LA5;
				goto BeforeRet;
			}
			LA5: ;
			nsuDelete((&result), first, last);
			first = nsuFindChar(result, 60, ((NI) (first)));
		} LA2: ;
	}
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, renderheadline_316861)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* sectionprefix;
	NimStringDesc* refname;
	NimStringDesc* LOC14;
	NimStringDesc* LOC15;
	NimStringDesc* LOC25;
	NimStringDesc* LOC26;
	NimStringDesc* LOC27;
	tmp = copyString(((NimStringDesc*) &TMP2093));
	{
		NI i_316880;
		NI HEX3Atmp_317006;
		NI LOC2;
		NI res_317009;
		i_316880 = 0;
		HEX3Atmp_317006 = 0;
		LOC2 = 0;
		LOC2 = len_296084(n);
		HEX3Atmp_317006 = (NI)(LOC2 - ((NI) 1));
		res_317009 = ((NI) 0);
		{
			while (1) {
				if (!(res_317009 <= HEX3Atmp_317006)) goto LA4;
				i_316880 = res_317009;
				renderrsttoout_311724(d, (*n).sons->data[i_316880], (&tmp));
				res_317009 += ((NI) 1);
			} LA4: ;
		}
	}
	unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
	sectionprefix = copyString(((NimStringDesc*) &TMP2093));
	{
		NI i_316894;
		NI HEX3Atmp_317014;
		NI res_317017;
		i_316894 = 0;
		HEX3Atmp_317014 = 0;
		HEX3Atmp_317014 = ((*d).tocpart ? ((*d).tocpart->Sup.len-1) : -1);
		res_317017 = HEX3Atmp_317014;
		{
			while (1) {
				Trstnode296011* n2;
				if (!(((NI) 0) <= res_317017)) goto LA7;
				i_316894 = res_317017;
				n2 = (*d).tocpart->data[i_316894].n;
				{
					NimStringDesc* LOC12;
					NimStringDesc* LOC13;
					if (!((*n2).level < (*n).level)) goto LA10;
					LOC12 = 0;
					LOC13 = 0;
					LOC13 = rstnodetorefname_297061(n2);
					LOC12 = rawNewString(LOC13->Sup.len + 1);
appendString(LOC12, LOC13);
appendString(LOC12, ((NimStringDesc*) &TMP2095));
					sectionprefix = LOC12;
					goto LA5;
				}
				LA10: ;
				res_317017 -= ((NI) 1);
			} LA7: ;
		}
	} LA5: ;
	LOC14 = 0;
	LOC15 = 0;
	LOC15 = rstnodetorefname_297061(n);
	LOC14 = rawNewString(sectionprefix->Sup.len + LOC15->Sup.len + 0);
appendString(LOC14, sectionprefix);
appendString(LOC14, LOC15);
	refname = LOC14;
	{
		NI length;
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		TY164825 LOC22;
		if (!(*d).hastoc) goto LA18;
		length = ((*d).tocpart ? (*d).tocpart->Sup.len : 0);
		(*d).tocpart = (TY311034*) setLengthSeq(&((*d).tocpart)->Sup, sizeof(Ttocentry311012), ((NI) ((NI)(length + ((NI) 1)))));
		LOC20 = 0;
		LOC20 = (*d).tocpart->data[length].refname; (*d).tocpart->data[length].refname = copyStringRC1(refname);
		if (LOC20) nimGCunrefNoCycle(LOC20);
		asgnRefNoCycle((void**) (&(*d).tocpart->data[length].n), n);
		LOC21 = 0;
		LOC21 = (*d).tocpart->data[length].header; (*d).tocpart->data[length].header = copyStringRC1(tmp);
		if (LOC21) nimGCunrefNoCycle(LOC21);
		memset((void*)LOC22, 0, sizeof(LOC22));
		LOC22[0] = nimIntToStr((*n).level);
		LOC22[1] = copyString((*d).tocpart->data[length].refname);
		LOC22[2] = copyString(tmp);
		LOC22[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2096), ((NimStringDesc*) &TMP2097), LOC22, 4);
	}
	goto LA16;
	LA18: ;
	{
		TY164825 LOC24;
		memset((void*)LOC24, 0, sizeof(LOC24));
		LOC24[0] = nimIntToStr((*n).level);
		LOC24[1] = copyString(refname);
		LOC24[2] = copyString(tmp);
		LOC24[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2098), ((NimStringDesc*) &TMP2097), LOC24, 4);
	}
	LA16: ;
	LOC25 = 0;
	LOC25 = striptochtml_316841(tmp);
	LOC26 = 0;
	LOC27 = 0;
	LOC27 = nsuRepeatChar(32, ((NI) (((((NI) 0) >= (*n).level) ? ((NI) 0) : (*n).level))));
	LOC26 = rawNewString(LOC27->Sup.len + tmp->Sup.len + 0);
appendString(LOC26, LOC27);
appendString(LOC26, tmp);
	setindexterm_311855(d, refname, LOC25, LOC26, ((NimStringDesc*) &TMP2093));
}

N_NIMCALL(void, renderoverline_317045)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	{
		if (!(((*d).meta[(((NU8) 1))- 0] ? (*d).meta[(((NU8) 1))- 0]->Sup.len : 0) == ((NI) 0))) goto LA3;
		{
			NI i_317063;
			NI HEX3Atmp_317106;
			NI LOC6;
			NI res_317109;
			i_317063 = 0;
			HEX3Atmp_317106 = 0;
			LOC6 = 0;
			LOC6 = len_296084(n);
			HEX3Atmp_317106 = (NI)(LOC6 - ((NI) 1));
			res_317109 = ((NI) 0);
			{
				while (1) {
					if (!(res_317109 <= HEX3Atmp_317106)) goto LA8;
					i_317063 = res_317109;
					renderrsttoout_311724(d, (*n).sons->data[i_317063], (&(*d).meta[(((NU8) 1))- 0]));
					res_317109 += ((NI) 1);
				} LA8: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString((*d).meta[(((NU8) 1))- 0]));
	}
	goto LA1;
	LA3: ;
	{
		if (!(((*d).meta[(((NU8) 2))- 0] ? (*d).meta[(((NU8) 2))- 0]->Sup.len : 0) == ((NI) 0))) goto LA10;
		{
			NI i_317077;
			NI HEX3Atmp_317114;
			NI LOC13;
			NI res_317117;
			i_317077 = 0;
			HEX3Atmp_317114 = 0;
			LOC13 = 0;
			LOC13 = len_296084(n);
			HEX3Atmp_317114 = (NI)(LOC13 - ((NI) 1));
			res_317117 = ((NI) 0);
			{
				while (1) {
					if (!(res_317117 <= HEX3Atmp_317114)) goto LA15;
					i_317077 = res_317117;
					renderrsttoout_311724(d, (*n).sons->data[i_317077], (&(*d).meta[(((NU8) 2))- 0]));
					res_317117 += ((NI) 1);
				} LA15: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString((*d).meta[(((NU8) 2))- 0]));
	}
	goto LA1;
	LA10: ;
	{
		NimStringDesc* tmp;
		TY164825 LOC21;
		tmp = copyString(((NimStringDesc*) &TMP2093));
		{
			NI i_317092;
			NI HEX3Atmp_317122;
			NI LOC18;
			NI res_317125;
			i_317092 = 0;
			HEX3Atmp_317122 = 0;
			LOC18 = 0;
			LOC18 = len_296084(n);
			HEX3Atmp_317122 = (NI)(LOC18 - ((NI) 1));
			res_317125 = ((NI) 0);
			{
				while (1) {
					if (!(res_317125 <= HEX3Atmp_317122)) goto LA20;
					i_317092 = res_317125;
					renderrsttoout_311724(d, (*n).sons->data[i_317092], (&tmp));
					res_317125 += ((NI) 1);
				} LA20: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nimIntToStr((*n).level);
		LOC21[1] = rstnodetorefname_297061(n);
		LOC21[2] = copyString(tmp);
		LOC21[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2106), ((NimStringDesc*) &TMP2107), LOC21, 4);
	}
	LA1: ;
}

N_NIMCALL(void, renderaux_311776)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2093));
	{
		NI i_311797;
		NI HEX3Atmp_311813;
		NI LOC2;
		NI res_311816;
		i_311797 = 0;
		HEX3Atmp_311813 = 0;
		LOC2 = 0;
		LOC2 = len_296084(n);
		HEX3Atmp_311813 = (NI)(LOC2 - ((NI) 1));
		res_311816 = ((NI) 0);
		{
			while (1) {
				if (!(res_311816 <= HEX3Atmp_311813)) goto LA4;
				i_311797 = res_311816;
				renderrsttoout_311724(d, (*n).sons->data[i_311797], (&tmp));
				res_311816 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		TY164566 LOC9;
		if (!!(((*d).target == ((NU8) 1)))) goto LA7;
		memset((void*)LOC9, 0, sizeof(LOC9));
		LOC9[0] = copyString(tmp);
		nsuAddf(result, frmta, LOC9, 1);
	}
	goto LA5;
	LA7: ;
	{
		TY164566 LOC11;
		memset((void*)LOC11, 0, sizeof(LOC11));
		LOC11[0] = copyString(tmp);
		nsuAddf(result, frmtb, LOC11, 1);
	}
	LA5: ;
}

N_NIMCALL(NI, nextsplitpoint_311506)(NimStringDesc* s, NI start) {
	NI result;
{	result = 0;
	result = start;
	{
		while (1) {
			if (!(result < (NI)((s ? s->Sup.len : 0) + ((NI) 0)))) goto LA2;
			switch (((NU8)(s->data[result]))) {
			case 95:
			{
				goto BeforeRet;
			}
			break;
			case 97 ... 122:
			{
				{
					if (!((NI)(result + ((NI) 1)) < (NI)((s ? s->Sup.len : 0) + ((NI) 0)))) goto LA7;
					{
						if (!(((NU8)(s->data[(NI)(result + ((NI) 1))])) >= ((NU8)(65)) && ((NU8)(s->data[(NI)(result + ((NI) 1))])) <= ((NU8)(90)))) goto LA11;
						goto BeforeRet;
					}
					LA11: ;
				}
				LA7: ;
			}
			break;
			default:
			{
			}
			break;
			}
			result += ((NI) 1);
		} LA2: ;
	}
	result -= ((NI) 1);
	}BeforeRet: ;
	return result;
}

static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b) {
	NIM_BOOL result;
	NIM_BOOL LOC11;
	int LOC13;
{	result = 0;
	{
		if (!(a == b)) goto LA3;
		result = NIM_TRUE;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		LOC7 = 0;
		LOC7 = (a == NIM_NIL);
		if (LOC7) goto LA8;
		LOC7 = (b == NIM_NIL);
		LA8: ;
		if (!LOC7) goto LA9;
		result = NIM_FALSE;
		goto BeforeRet;
	}
	LA9: ;
	LOC11 = 0;
	LOC11 = ((*a).Sup.len == (*b).Sup.len);
	if (!(LOC11)) goto LA12;
	LOC13 = 0;
	LOC13 = memcmp(((NCSTRING) ((*a).data)), ((NCSTRING) ((*b).data)), (*a).Sup.len);
	LOC11 = (LOC13 == ((NI32) 0));
	LA12: ;
	result = LOC11;
	goto BeforeRet;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, addxmlchar_311456)(NimStringDesc** dest, NIM_CHAR c) {
	switch (((NU8)(c))) {
	case 38:
	{
		(*dest) = resizeString((*dest), 5);
appendString((*dest), ((NimStringDesc*) &TMP2126));
	}
	break;
	case 60:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2127));
	}
	break;
	case 62:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2128));
	}
	break;
	case 34:
	{
		(*dest) = resizeString((*dest), 6);
appendString((*dest), ((NimStringDesc*) &TMP2129));
	}
	break;
	default:
	{
		(*dest) = addChar((*dest), c);
	}
	break;
	}
}

N_NIMCALL(void, addtexchar_311478)(NimStringDesc** dest, NIM_CHAR c) {
	switch (((NU8)(c))) {
	case 95:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2130));
	}
	break;
	case 123:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2131));
	}
	break;
	case 125:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2132));
	}
	break;
	case 91:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2133));
	}
	break;
	case 93:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2134));
	}
	break;
	case 92:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2135));
	}
	break;
	case 36:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2136));
	}
	break;
	case 38:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2137));
	}
	break;
	case 35:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2138));
	}
	break;
	case 37:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2139));
	}
	break;
	case 126:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2140));
	}
	break;
	case 64:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2141));
	}
	break;
	case 94:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2142));
	}
	break;
	case 96:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2143));
	}
	break;
	default:
	{
		(*dest) = addChar((*dest), c);
	}
	break;
	}
}

static N_INLINE(void, escchar_311494)(NU8 target, NimStringDesc** dest, NIM_CHAR c) {
	switch (target) {
	case ((NU8) 0):
	{
		addxmlchar_311456(dest, c);
	}
	break;
	case ((NU8) 1):
	{
		addtexchar_311478(dest, c);
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, esc_311553)(NU8 target, NimStringDesc* s, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2093));
	{
		NI partlen;
		NI j;
		if (!(((NI) 0) <= splitafter)) goto LA3;
		partlen = ((NI) 0);
		j = ((NI) 0);
		{
			while (1) {
				NI k;
				if (!(j < (s ? s->Sup.len : 0))) goto LA6;
				k = nextsplitpoint_311506(s, j);
				{
					NIM_BOOL LOC9;
					LOC9 = 0;
					LOC9 = !(eqStrings(splitter_311489, ((NimStringDesc*) &TMP2125)));
					if (LOC9) goto LA10;
					LOC9 = (splitafter < (NI)((NI)((NI)(partlen + k) - j) + ((NI) 1)));
					LA10: ;
					if (!LOC9) goto LA11;
					partlen = ((NI) 0);
					result = resizeString(result, splitter_311489->Sup.len + 0);
appendString(result, splitter_311489);
				}
				LA11: ;
				{
					NI i_311574;
					NI res_311603;
					i_311574 = 0;
					res_311603 = j;
					{
						while (1) {
							if (!(res_311603 <= k)) goto LA15;
							i_311574 = res_311603;
							escchar_311494(target, (&result), s->data[i_311574]);
							res_311603 += ((NI) 1);
						} LA15: ;
					}
				}
				partlen += (NI)((NI)(k - j) + ((NI) 1));
				j = (NI)(k + ((NI) 1));
			} LA6: ;
		}
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_311597;
			NI HEX3Atmp_311608;
			NI res_311611;
			i_311597 = 0;
			HEX3Atmp_311608 = 0;
			HEX3Atmp_311608 = (NI)((s ? s->Sup.len : 0) - ((NI) 1));
			res_311611 = ((NI) 0);
			{
				while (1) {
					if (!(res_311611 <= HEX3Atmp_311608)) goto LA19;
					i_311597 = res_311611;
					escchar_311494(target, (&result), s->data[i_311597]);
					res_311611 += ((NI) 1);
				} LA19: ;
			}
		}
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, renderfield_318716)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	NIM_BOOL b;
	b = NIM_FALSE;
	{
		NimStringDesc* fieldname;
		NimStringDesc* fieldval;
		NimStringDesc* LOC5;
		NimStringDesc* LOC6;
		if (!((*d).target == ((NU8) 1))) goto LA3;
		fieldname = addnodes_297067((*n).sons->data[((NI) 0)]);
		LOC5 = 0;
		LOC5 = addnodes_297067((*n).sons->data[((NI) 1)]);
		LOC6 = 0;
		LOC6 = nsuStrip(LOC5, NIM_TRUE, NIM_TRUE);
		fieldval = esc_311553((*d).target, LOC6, ((NI) -1));
		{
			NIM_BOOL LOC9;
			NI LOC10;
			NI LOC12;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2144));
			LOC9 = (LOC10 == ((NI) 0));
			if (LOC9) goto LA11;
			LOC12 = 0;
			LOC12 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2145));
			LOC9 = (LOC12 == ((NI) 0));
			LA11: ;
			if (!LOC9) goto LA13;
			{
				if (!(((*d).meta[(((NU8) 3))- 0] ? (*d).meta[(((NU8) 3))- 0]->Sup.len : 0) == ((NI) 0))) goto LA17;
				unsureAsgnRef((void**) (&(*d).meta[(((NU8) 3))- 0]), copyString(fieldval));
				b = NIM_TRUE;
			}
			LA17: ;
		}
		goto LA7;
		LA13: ;
		{
			NI LOC20;
			LOC20 = 0;
			LOC20 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2146));
			if (!(LOC20 == ((NI) 0))) goto LA21;
			{
				if (!(((*d).meta[(((NU8) 4))- 0] ? (*d).meta[(((NU8) 4))- 0]->Sup.len : 0) == ((NI) 0))) goto LA25;
				unsureAsgnRef((void**) (&(*d).meta[(((NU8) 4))- 0]), copyString(fieldval));
				b = NIM_TRUE;
			}
			LA25: ;
		}
		goto LA7;
		LA21: ;
		LA7: ;
	}
	LA3: ;
	{
		if (!!(b)) goto LA29;
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2147), ((NimStringDesc*) &TMP2148), result);
	}
	LA29: ;
}

N_NIMCALL(NimStringDesc*, texcolumns_318676)(Trstnode296011* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2093));
	{
		NI i_318692;
		NI HEX3Atmp_318694;
		NI res_318697;
		i_318692 = 0;
		HEX3Atmp_318694 = 0;
		HEX3Atmp_318694 = len_296084(n);
		res_318697 = ((NI) 1);
		{
			while (1) {
				if (!(res_318697 <= HEX3Atmp_318694)) goto LA3;
				i_318692 = res_318697;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP2169));
				res_318697 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(NimStringDesc*, dispf_311666)(NU8 target, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0) {
	NimStringDesc* result;
	result = 0;
	{
		if (!!((target == ((NU8) 1)))) goto LA3;
		result = nsuFormatOpenArray(xml, args, argsLen0);
	}
	goto LA1;
	LA3: ;
	{
		result = nsuFormatOpenArray(tex, args, argsLen0);
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, renderimage_317213)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	NimStringDesc* options;
	NimStringDesc* s;
	NimStringDesc* arg;
	options = copyString(((NimStringDesc*) &TMP2093));
	s = getfieldvalue_297073(n, ((NimStringDesc*) &TMP2184));
	{
		NIM_BOOL LOC3;
		TY164566 LOC7;
		LOC3 = 0;
		LOC3 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = allcharsinset_98459(s, TMP2185);
		LA4: ;
		if (!LOC3) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_311689((*d).target, (&options), ((NimStringDesc*) &TMP2186), ((NimStringDesc*) &TMP2187), LOC7, 1);
	}
	LA5: ;
	s = getfieldvalue_297073(n, ((NimStringDesc*) &TMP2188));
	{
		NIM_BOOL LOC10;
		TY164566 LOC14;
		LOC10 = 0;
		LOC10 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC10)) goto LA11;
		LOC10 = allcharsinset_98459(s, TMP2185);
		LA11: ;
		if (!LOC10) goto LA12;
		memset((void*)LOC14, 0, sizeof(LOC14));
		LOC14[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_311689((*d).target, (&options), ((NimStringDesc*) &TMP2189), ((NimStringDesc*) &TMP2190), LOC14, 1);
	}
	LA12: ;
	s = getfieldvalue_297073(n, ((NimStringDesc*) &TMP2191));
	{
		NIM_BOOL LOC17;
		TY164566 LOC21;
		LOC17 = 0;
		LOC17 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC17)) goto LA18;
		LOC17 = allcharsinset_98459(s, TMP2185);
		LA18: ;
		if (!LOC17) goto LA19;
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_311689((*d).target, (&options), ((NimStringDesc*) &TMP2192), ((NimStringDesc*) &TMP2193), LOC21, 1);
	}
	LA19: ;
	s = getfieldvalue_297073(n, ((NimStringDesc*) &TMP2194));
	{
		NIM_BOOL LOC24;
		TY164566 LOC28;
		LOC24 = 0;
		LOC24 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC24)) goto LA25;
		LOC24 = allcharsinset_98459(s, TMP2185);
		LA25: ;
		if (!LOC24) goto LA26;
		memset((void*)LOC28, 0, sizeof(LOC28));
		LOC28[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_311689((*d).target, (&options), ((NimStringDesc*) &TMP2195), ((NimStringDesc*) &TMP2093), LOC28, 1);
	}
	LA26: ;
	s = getfieldvalue_297073(n, ((NimStringDesc*) &TMP2196));
	{
		NIM_BOOL LOC31;
		TY164566 LOC35;
		LOC31 = 0;
		LOC31 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC31)) goto LA32;
		LOC31 = allcharsinset_98459(s, TMP2185);
		LA32: ;
		if (!LOC31) goto LA33;
		memset((void*)LOC35, 0, sizeof(LOC35));
		LOC35[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_311689((*d).target, (&options), ((NimStringDesc*) &TMP2197), ((NimStringDesc*) &TMP2093), LOC35, 1);
	}
	LA33: ;
	{
		TY164566 LOC40;
		if (!(((NI) 0) < (options ? options->Sup.len : 0))) goto LA38;
		memset((void*)LOC40, 0, sizeof(LOC40));
		LOC40[0] = copyString(options);
		options = dispf_311666((*d).target, ((NimStringDesc*) &TMP2148), ((NimStringDesc*) &TMP2198), LOC40, 1);
	}
	LA38: ;
	arg = getargument_297080(n);
	{
		NIM_BOOL LOC43;
		TY154965 LOC47;
		LOC43 = 0;
		LOC43 = (((NI) 0) < (arg ? arg->Sup.len : 0));
		if (!(LOC43)) goto LA44;
		LOC43 = allcharsinset_98459(arg, TMP2185);
		LA44: ;
		if (!LOC43) goto LA45;
		memset((void*)LOC47, 0, sizeof(LOC47));
		LOC47[0] = copyString(arg);
		LOC47[1] = copyString(options);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2199), ((NimStringDesc*) &TMP2200), LOC47, 2);
	}
	LA45: ;
	{
		NI LOC50;
		LOC50 = 0;
		LOC50 = len_296084(n);
		if (!(((NI) 3) <= LOC50)) goto LA51;
		renderrsttoout_311724(d, (*n).sons->data[((NI) 2)], result);
	}
	LA51: ;
}

N_NIMCALL(void, init_311078)(Codeblockparams311020* p) {
	(*p).startline = ((NI) 1);
	(*p).lang = ((NU8) 0);
	unsureAsgnRef((void**) (&(*p).langstr), copyString(((NimStringDesc*) &TMP2093)));
}

N_NIMCALL(void, parsecodeblockfield_317493)(Trstgenerator311016* d, Trstnode296011* n, Codeblockparams311020* params) {
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	LOC1 = 0;
	LOC1 = getargument_297080(n);
	LOC2 = 0;
	LOC2 = nsuToLowerStr(LOC1);
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2201))) goto LA3;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2202))) goto LA4;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2203))) goto LA5;
	goto LA6;
	LA3: ;
	{
		NI number;
		(*params).numberlines = NIM_TRUE;
		number = 0;
		{
			NimStringDesc* LOC11;
			NI LOC12;
			LOC11 = 0;
			LOC11 = getfieldvalue_300310(n);
			LOC12 = 0;
			LOC12 = npuParseInt(LOC11, (&number), ((NI) 0));
			if (!(((NI) 0) < LOC12)) goto LA13;
			(*params).startline = number;
		}
		LA13: ;
	}
	goto LA7;
	LA4: ;
	{
	}
	goto LA7;
	LA5: ;
	{
		NimStringDesc* LOC17;
		LOC17 = 0;
		LOC17 = getfieldvalue_300310(n);
		unsureAsgnRef((void**) (&(*params).langstr), nsuStrip(LOC17, NIM_TRUE, NIM_TRUE));
		(*params).lang = getsourcelanguage_305093((*params).langstr);
	}
	goto LA7;
	LA6: ;
	{
		NimStringDesc* LOC19;
		LOC19 = 0;
		LOC19 = getargument_297080(n);
		(*d).msghandler((*d).filename, ((NI) 1), ((NI) 0), ((NU8) 9), LOC19);
	}
	LA7: ;
}

N_NIMCALL(void, parsecodeblockparams_317508)(Trstgenerator311016* d, Trstnode296011* n, Codeblockparams311020* Result) {
	NimStringDesc* LOC12;
{	init_311078(Result);
	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((*n).sons->data[((NI) 1)] == 0)) goto LA7;
		{
			Trstnode296011* son_318011;
			Trstnodeseq296009* HEX3Atmp_318014;
			NI i_318017;
			NI L_318019;
			son_318011 = 0;
			HEX3Atmp_318014 = 0;
			HEX3Atmp_318014 = (*(*n).sons->data[((NI) 1)]).sons;
			i_318017 = ((NI) 0);
			L_318019 = (HEX3Atmp_318014 ? HEX3Atmp_318014->Sup.len : 0);
			{
				while (1) {
					if (!(i_318017 < L_318019)) goto LA11;
					son_318011 = HEX3Atmp_318014->data[i_318017];
					parsecodeblockfield_317493(d, son_318011, Result);
					i_318017 += ((NI) 1);
				} LA11: ;
			}
		}
	}
	LA7: ;
	LOC12 = 0;
	LOC12 = getargument_297080(n);
	unsureAsgnRef((void**) (&(*Result).langstr), nsuStrip(LOC12, NIM_TRUE, NIM_TRUE));
	{
		if (!!((((*Result).langstr) && ((*Result).langstr)->Sup.len == 0))) goto LA15;
		(*Result).lang = getsourcelanguage_305093((*Result).langstr);
	}
	LA15: ;
	}BeforeRet: ;
}

N_NIMCALL(void, buildlineshtmltable_318035)(Codeblockparams311020* params, NimStringDesc* code, Keyvaluepair134008* Result) {
	NI codelines;
	NimStringDesc* LOC5;
	NI LOC6;
	NI line;
{	{
		if (!!((*params).numberlines)) goto LA3;
		unsureAsgnRef((void**) (&(*Result).Field0), copyString(TMP2211.Field0));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(TMP2211.Field1));
		goto BeforeRet;
	}
	LA3: ;
	LOC5 = 0;
	LOC5 = nsuStrip(code, NIM_TRUE, NIM_TRUE);
	LOC6 = 0;
	LOC6 = nsuCountLines(LOC5);
	codelines = (NI)(((NI) 1) + LOC6);
	unsureAsgnRef((void**) (&(*Result).Field0), copyString(((NimStringDesc*) &TMP2214)));
	line = (*params).startline;
	{
		while (1) {
			NimStringDesc* LOC9;
			NimStringDesc* LOC10;
			if (!(((NI) 0) < codelines)) goto LA8;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = nimIntToStr(line);
			LOC9 = rawNewString(LOC10->Sup.len + 1);
appendString(LOC9, LOC10);
appendString(LOC9, ((NimStringDesc*) &TMP2102));
			(*Result).Field0 = resizeString((*Result).Field0, LOC9->Sup.len + 0);
appendString((*Result).Field0, LOC9);
			line += ((NI) 1);
			codelines -= ((NI) 1);
		} LA8: ;
	}
	(*Result).Field0 = resizeString((*Result).Field0, 20);
appendString((*Result).Field0, ((NimStringDesc*) &TMP2215));
	unsureAsgnRef((void**) (&(*Result).Field1), copyString(((NimStringDesc*) &TMP2216)));
	}BeforeRet: ;
}

N_NIMCALL(void, rendercodeblock_318233)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	Codeblockparams311020 params;
	Trstnode296011* m;
	Keyvaluepair134008 LOC5;
	NimStringDesc* blockstart;
	NimStringDesc* blockend;
	TY218714 LOC6;
	TY218714 LOC27;
{	{
		if (!((*n).sons->data[((NI) 2)] == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	memset((void*)(&params), 0, sizeof(params));
	chckNil((void*)(&params));
	memset((void*)(&params), 0, sizeof(params));
	parsecodeblockparams_317508(d, n, (&params));
	m = (*(*n).sons->data[((NI) 2)]).sons->data[((NI) 0)];
	memset((void*)(&LOC5), 0, sizeof(LOC5));
	buildlineshtmltable_318035((&params), (*m).text, (&LOC5));
	blockstart = 0;
	blockstart = LOC5.Field0;
	blockend = 0;
	blockend = LOC5.Field1;
	memset((void*)LOC6, 0, sizeof(LOC6));
	dispa_311689((*d).target, result, blockstart, ((NimStringDesc*) &TMP2217), LOC6, 0);
	{
		if (!(params.lang == ((NU8) 0))) goto LA9;
		{
			if (!(((NI) 0) < (params.langstr ? params.langstr->Sup.len : 0))) goto LA13;
			(*d).msghandler((*d).filename, ((NI) 1), ((NI) 0), ((NU8) 8), params.langstr);
		}
		LA13: ;
		{
			NIM_CHAR letter_318615;
			NimStringDesc* HEX3Atmp_318627;
			NI i_318630;
			NI L_318632;
			letter_318615 = 0;
			HEX3Atmp_318627 = 0;
			HEX3Atmp_318627 = (*m).text;
			i_318630 = ((NI) 0);
			L_318632 = (HEX3Atmp_318627 ? HEX3Atmp_318627->Sup.len : 0);
			{
				while (1) {
					if (!(i_318630 < L_318632)) goto LA17;
					letter_318615 = HEX3Atmp_318627->data[i_318630];
					escchar_311494((*d).target, result, letter_318615);
					i_318630 += ((NI) 1);
				} LA17: ;
			}
		}
	}
	goto LA7;
	LA9: ;
	{
		Tgeneraltokenizer305023 g;
		memset((void*)(&g), 0, sizeof(g));
		g.Sup.m_type = (&NTI305023);
		initgeneraltokenizer_305289((&g), (*m).text);
		{
			while (1) {
				getnexttoken_307766((&g), params.lang);
				switch (g.kind) {
				case ((NU8) 0):
				{
					goto LA19;
				}
				break;
				case ((NU8) 1):
				case ((NU8) 2):
				{
					NimStringDesc* LOC23;
					LOC23 = 0;
					LOC23 = copyStrLast((*m).text, g.start, (NI)((NI)(g.length + g.start) - ((NI) 1)));
					(*result) = resizeString((*result), LOC23->Sup.len + 0);
appendString((*result), LOC23);
				}
				break;
				default:
				{
					TY154965 LOC25;
					NimStringDesc* LOC26;
					memset((void*)LOC25, 0, sizeof(LOC25));
					LOC26 = 0;
					LOC26 = copyStrLast((*m).text, g.start, (NI)((NI)(g.length + g.start) - ((NI) 1)));
					LOC25[0] = esc_311553((*d).target, LOC26, ((NI) -1));
					LOC25[1] = copyString(tokenclasstostr_305081[(g.kind)- 0]);
					dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2379), ((NimStringDesc*) &TMP2380), LOC25, 2);
				}
				break;
				}
			}
		} LA19: ;
		deinitgeneraltokenizer_305300((&g));
	}
	LA7: ;
	memset((void*)LOC27, 0, sizeof(LOC27));
	dispa_311689((*d).target, result, blockend, ((NimStringDesc*) &TMP2414), LOC27, 0);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercontainer_318657)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* arg;
	NimStringDesc* LOC1;
	tmp = copyString(((NimStringDesc*) &TMP2093));
	renderrsttoout_311724(d, (*n).sons->data[((NI) 2)], (&tmp));
	LOC1 = 0;
	LOC1 = getargument_297080(n);
	arg = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE);
	{
		TY164566 LOC6;
		if (!((arg) && (arg)->Sup.len == 0)) goto LA4;
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = copyString(tmp);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2415), ((NimStringDesc*) &TMP2148), LOC6, 1);
	}
	goto LA2;
	LA4: ;
	{
		TY154965 LOC8;
		memset((void*)LOC8, 0, sizeof(LOC8));
		LOC8[0] = copyString(arg);
		LOC8[1] = copyString(tmp);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2416), ((NimStringDesc*) &TMP2417), LOC8, 2);
	}
	LA2: ;
}

N_NIMCALL(void, renderindexterm_312066)(Trstgenerator311016* d, Trstnode296011* n_312069, NimStringDesc** result) {
	NimStringDesc* refname;
	NimStringDesc* id;
	NimStringDesc* LOC8;
	NI LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* term;
	TY154965 LOC11;
	refname = rstnodetorefname_297061(n_312069);
	{
		NIM_BOOL LOC3;
		NI LOC6;
		LOC3 = 0;
		LOC3 = haskey_312074((*d).seenindexterms, refname);
		if (!LOC3) goto LA4;
		LOC6 = 0;
		LOC6 = HEX5BHEX5D_312117((*d).seenindexterms, refname);
		HEX5BHEX5DHEX3D_312148((&(*d).seenindexterms), refname, (NI)(LOC6 + ((NI) 1)));
	}
	goto LA1;
	LA4: ;
	{
		HEX5BHEX5DHEX3D_312148((&(*d).seenindexterms), refname, ((NI) 1));
	}
	LA1: ;
	LOC8 = 0;
	LOC9 = 0;
	LOC9 = HEX5BHEX5D_312117((*d).seenindexterms, refname);
	LOC10 = 0;
	LOC10 = nimIntToStr(LOC9);
	LOC8 = rawNewString(refname->Sup.len + LOC10->Sup.len + 1);
appendString(LOC8, refname);
appendChar(LOC8, 95);
appendString(LOC8, LOC10);
	id = LOC8;
	term = copyString(((NimStringDesc*) &TMP2093));
	renderaux_311734(d, n_312069, (&term));
	setindexterm_311855(d, id, term, (*d).currentsection, ((NimStringDesc*) &TMP2093));
	memset((void*)LOC11, 0, sizeof(LOC11));
	LOC11[0] = copyString(id);
	LOC11[1] = copyString(term);
	dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2431), ((NimStringDesc*) &TMP2432), LOC11, 2);
}

N_NIMCALL(void, rendersmiley_317479)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
	TY164566 LOC1;
	NimStringDesc* LOC2;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC2 = 0;
	LOC2 = nstGet((*d).config, ((NimStringDesc*) &TMP2437));
	LOC1[0] = nsuFormatSingleElem(LOC2, (*n).text);
	dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2435), ((NimStringDesc*) &TMP2436), LOC1, 1);
}

N_NIMCALL(void, renderrsttoout_311724)(Trstgenerator311016* d, Trstnode296011* n, NimStringDesc** result) {
{	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 0):
	{
		renderaux_311734(d, n, result);
	}
	break;
	case ((NU8) 1):
	{
		renderheadline_316861(d, n, result);
	}
	break;
	case ((NU8) 2):
	{
		renderoverline_317045(d, n, result);
	}
	break;
	case ((NU8) 3):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2108), ((NimStringDesc*) &TMP2109), result);
	}
	break;
	case ((NU8) 4):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2110), ((NimStringDesc*) &TMP2111), result);
	}
	break;
	case ((NU8) 5):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2112), ((NimStringDesc*) &TMP2113), result);
	}
	break;
	case ((NU8) 6):
	case ((NU8) 8):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2114), ((NimStringDesc*) &TMP2115), result);
	}
	break;
	case ((NU8) 7):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2116), ((NimStringDesc*) &TMP2117), result);
	}
	break;
	case ((NU8) 9):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2118), ((NimStringDesc*) &TMP2119), result);
	}
	break;
	case ((NU8) 10):
	{
		renderaux_311734(d, n, result);
	}
	break;
	case ((NU8) 11):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2120), ((NimStringDesc*) &TMP2121), result);
	}
	break;
	case ((NU8) 12):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2122), ((NimStringDesc*) &TMP2123), result);
	}
	break;
	case ((NU8) 13):
	{
		NimStringDesc* tmp;
		tmp = copyString(((NimStringDesc*) &TMP2093));
		{
			NI i_318771;
			NI HEX3Atmp_318833;
			NI LOC19;
			NI res_318836;
			i_318771 = 0;
			HEX3Atmp_318833 = 0;
			LOC19 = 0;
			LOC19 = len_296084(n);
			HEX3Atmp_318833 = (NI)(LOC19 - ((NI) 1));
			res_318836 = ((NI) 0);
			{
				while (1) {
					if (!(res_318836 <= HEX3Atmp_318833)) goto LA21;
					i_318771 = res_318836;
					renderrsttoout_311724(d, (*n).sons->data[i_318771], (&tmp));
					res_318836 += ((NI) 1);
				} LA21: ;
			}
		}
		{
			TY164566 LOC26;
			if (!!(((tmp ? tmp->Sup.len : 0) == ((NI) 0)))) goto LA24;
			memset((void*)LOC26, 0, sizeof(LOC26));
			LOC26[0] = copyString(tmp);
			dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2124), ((NimStringDesc*) &TMP2119), LOC26, 1);
		}
		LA24: ;
	}
	break;
	case ((NU8) 14):
	{
		renderfield_318716(d, n, result);
	}
	break;
	case ((NU8) 15):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2149), ((NimStringDesc*) &TMP2150), result);
	}
	break;
	case ((NU8) 16):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2151), ((NimStringDesc*) &TMP2152), result);
	}
	break;
	case ((NU8) 51):
	{
		renderrsttoout_311724(d, (*n).sons->data[((NI) 2)], result);
	}
	break;
	case ((NU8) 17):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2153), ((NimStringDesc*) &TMP2154), result);
	}
	break;
	case ((NU8) 18):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2147), ((NimStringDesc*) &TMP2148), result);
	}
	break;
	case ((NU8) 19):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2155), ((NimStringDesc*) &TMP2156), result);
	}
	break;
	case ((NU8) 23):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2157), ((NimStringDesc*) &TMP2152), result);
	}
	break;
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		{
			if (!NIM_TRUE) goto LA38;
			raiseassert_86357(((NimStringDesc*) &TMP2159));
		}
		LA38: ;
	}
	break;
	case ((NU8) 24):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2160), ((NimStringDesc*) &TMP2161), result);
	}
	break;
	case ((NU8) 25):
	{
		{
			if (!NIM_TRUE) goto LA44;
			raiseassert_86357(((NimStringDesc*) &TMP2159));
		}
		LA44: ;
	}
	break;
	case ((NU8) 26):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2162), ((NimStringDesc*) &TMP2111), result);
	}
	break;
	case ((NU8) 27):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2163), ((NimStringDesc*) &TMP2164), result);
	}
	break;
	case ((NU8) 28):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2165), ((NimStringDesc*) &TMP2166), result);
	}
	break;
	case ((NU8) 29):
	case ((NU8) 30):
	{
		NimStringDesc* LOC50;
		NimStringDesc* LOC51;
		LOC50 = 0;
		LOC51 = 0;
		LOC51 = texcolumns_318676(n);
		LOC50 = rawNewString(LOC51->Sup.len + 63);
appendString(LOC50, ((NimStringDesc*) &TMP2168));
appendString(LOC50, LOC51);
appendString(LOC50, ((NimStringDesc*) &TMP2170));
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2167), LOC50, result);
	}
	break;
	case ((NU8) 31):
	{
		{
			NI LOC55;
			LOC55 = 0;
			LOC55 = len_296084(n);
			if (!(((NI) 1) <= LOC55)) goto LA56;
			{
				if (!((*d).target == ((NU8) 1))) goto LA60;
				renderrsttoout_311724(d, (*n).sons->data[((NI) 0)], result);
				{
					NI i_318796;
					NI HEX3Atmp_318841;
					NI LOC63;
					NI res_318844;
					i_318796 = 0;
					HEX3Atmp_318841 = 0;
					LOC63 = 0;
					LOC63 = len_296084(n);
					HEX3Atmp_318841 = (NI)(LOC63 - ((NI) 1));
					res_318844 = ((NI) 1);
					{
						while (1) {
							if (!(res_318844 <= HEX3Atmp_318841)) goto LA65;
							i_318796 = res_318844;
							(*result) = resizeString((*result), 3);
appendString((*result), ((NimStringDesc*) &TMP2171));
							renderrsttoout_311724(d, (*n).sons->data[i_318796], result);
							res_318844 += ((NI) 1);
						} LA65: ;
					}
				}
				(*result) = resizeString((*result), 10);
appendString((*result), ((NimStringDesc*) &TMP2172));
			}
			goto LA58;
			LA60: ;
			{
				(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP2173));
				renderaux_311734(d, n, result);
				(*result) = resizeString((*result), 6);
appendString((*result), ((NimStringDesc*) &TMP2174));
			}
			LA58: ;
		}
		LA56: ;
	}
	break;
	case ((NU8) 33):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2151), ((NimStringDesc*) &TMP2148), result);
	}
	break;
	case ((NU8) 32):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2175), ((NimStringDesc*) &TMP2176), result);
	}
	break;
	case ((NU8) 34):
	{
		{
			if (!NIM_TRUE) goto LA72;
			raiseassert_86357(((NimStringDesc*) &TMP2159));
		}
		LA72: ;
	}
	break;
	case ((NU8) 35):
	{
		{
			if (!NIM_TRUE) goto LA77;
			raiseassert_86357(((NimStringDesc*) &TMP2159));
		}
		LA77: ;
	}
	break;
	case ((NU8) 36):
	{
		{
			if (!NIM_TRUE) goto LA82;
			raiseassert_86357(((NimStringDesc*) &TMP2159));
		}
		LA82: ;
	}
	break;
	case ((NU8) 39):
	{
		NimStringDesc* tmp;
		TY154965 LOC85;
		tmp = copyString(((NimStringDesc*) &TMP2093));
		renderaux_311734(d, n, (&tmp));
		memset((void*)LOC85, 0, sizeof(LOC85));
		LOC85[0] = copyString(tmp);
		LOC85[1] = rstnodetorefname_297061(n);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2177), ((NimStringDesc*) &TMP2178), LOC85, 2);
	}
	break;
	case ((NU8) 37):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2179), ((NimStringDesc*) &TMP2180), result);
	}
	break;
	case ((NU8) 38):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY154965 LOC88;
		tmp0 = copyString(((NimStringDesc*) &TMP2093));
		tmp1 = copyString(((NimStringDesc*) &TMP2093));
		renderrsttoout_311724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_311724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC88, 0, sizeof(LOC88));
		LOC88[0] = copyString(tmp0);
		LOC88[1] = copyString(tmp1);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2181), ((NimStringDesc*) &TMP2182), LOC88, 2);
	}
	break;
	case ((NU8) 41):
	case ((NU8) 42):
	{
		renderaux_311734(d, n, result);
	}
	break;
	case ((NU8) 48):
	{
		{
			Trstnode296011* LOC95;
			NimStringDesc* LOC96;
			if (!!(((*d).target == ((NU8) 1)))) goto LA93;
			LOC95 = 0;
			LOC95 = lastson_296147(n);
			LOC96 = 0;
			LOC96 = addnodes_297067(LOC95);
			(*result) = resizeString((*result), LOC96->Sup.len + 0);
appendString((*result), LOC96);
		}
		LA93: ;
	}
	break;
	case ((NU8) 49):
	{
		{
			Trstnode296011* LOC102;
			NimStringDesc* LOC103;
			if (!((*d).target == ((NU8) 1))) goto LA100;
			LOC102 = 0;
			LOC102 = lastson_296147(n);
			LOC103 = 0;
			LOC103 = addnodes_297067(LOC102);
			(*result) = resizeString((*result), LOC103->Sup.len + 0);
appendString((*result), LOC103);
		}
		LA100: ;
	}
	break;
	case ((NU8) 45):
	case ((NU8) 46):
	{
		renderimage_317213(d, n, result);
	}
	break;
	case ((NU8) 47):
	{
		rendercodeblock_318233(d, n, result);
	}
	break;
	case ((NU8) 50):
	{
		rendercontainer_318657(d, n, result);
	}
	break;
	case ((NU8) 62):
	case ((NU8) 52):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2418), ((NimStringDesc*) &TMP2418), result);
	}
	break;
	case ((NU8) 40):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2093), ((NimStringDesc*) &TMP2093), result);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY154965 LOC110;
		tmp0 = copyString(((NimStringDesc*) &TMP2093));
		tmp1 = copyString(((NimStringDesc*) &TMP2093));
		renderrsttoout_311724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_311724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC110, 0, sizeof(LOC110));
		LOC110[0] = copyString(tmp0);
		LOC110[1] = copyString(tmp1);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP2379), ((NimStringDesc*) &TMP2380), LOC110, 2);
	}
	break;
	case ((NU8) 54):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2419), ((NimStringDesc*) &TMP2420), result);
	}
	break;
	case ((NU8) 55):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2421), ((NimStringDesc*) &TMP2422), result);
	}
	break;
	case ((NU8) 57):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2423), ((NimStringDesc*) &TMP2424), result);
	}
	break;
	case ((NU8) 58):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2425), ((NimStringDesc*) &TMP2176), result);
	}
	break;
	case ((NU8) 59):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2426), ((NimStringDesc*) &TMP2427), result);
	}
	break;
	case ((NU8) 60):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2428), ((NimStringDesc*) &TMP2424), result);
	}
	break;
	case ((NU8) 56):
	{
		renderindexterm_312066(d, n, result);
	}
	break;
	case ((NU8) 61):
	{
		renderaux_311776(d, n, ((NimStringDesc*) &TMP2433), ((NimStringDesc*) &TMP2434), result);
	}
	break;
	case ((NU8) 63):
	{
		rendersmiley_317479(d, n, result);
	}
	break;
	case ((NU8) 64):
	{
		NimStringDesc* LOC121;
		LOC121 = 0;
		LOC121 = esc_311553((*d).target, (*n).text, ((NI) -1));
		(*result) = resizeString((*result), LOC121->Sup.len + 0);
appendString((*result), LOC121);
	}
	break;
	case ((NU8) 44):
	{
		(*d).hastoc = NIM_TRUE;
	}
	break;
	case ((NU8) 43):
	{
		unsureAsgnRef((void**) (&(*d).meta[(((NU8) 1))- 0]), copyString(((NimStringDesc*) &TMP2093)));
		renderrsttoout_311724(d, (*n).sons->data[((NI) 0)], (&(*d).meta[(((NU8) 1))- 0]));
	}
	break;
	}
	}BeforeRet: ;
}
N_NIMCALL(void, TMP4762)(void* p, NI op) {
	TY311034* a;
	NI LOC1;
	a = (TY311034*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].n, op);
	nimGCvisit((void*)a->data[LOC1].refname, op);
	nimGCvisit((void*)a->data[LOC1].header, op);
	}
}

N_NIMCALL(void, initrstgenerator_311088)(Trstgenerator311016* g, NU8 target, Stringtableobj134012* config, NimStringDesc* filename, NU8 options, Tfindfilehandler297023 findfile, Tmsghandler297021 msghandler) {
	TY119589 fileparts;
	NimStringDesc* s;
	unsureAsgnRef((void**) (&(*g).config), config);
	(*g).target = target;
	unsureAsgnRef((void**) (&(*g).tocpart), (TY311034*) newSeq((&NTI311034), 0));
	unsureAsgnRef((void**) (&(*g).filename), copyString(filename));
	(*g).splitafter = ((NI) 20);
	unsureAsgnRef((void**) (&(*g).theindex), copyString(((NimStringDesc*) &TMP2093)));
	(*g).options = options;
	(*g).findfile = findfile;
	unsureAsgnRef((void**) (&(*g).currentsection), copyString(((NimStringDesc*) &TMP2093)));
	memset((void*)(&fileparts), 0, sizeof(fileparts));
	chckNil((void*)(&fileparts));
	memset((void*)(&fileparts), 0, sizeof(fileparts));
	nossplitFile(filename, (&fileparts));
	{
		NimStringDesc* LOC5;
		if (!eqStrings(fileparts.Field2, ((NimStringDesc*) &TMP4766))) goto LA3;
		LOC5 = 0;
		LOC5 = rawNewString(fileparts.Field1->Sup.len + 7);
appendString(LOC5, ((NimStringDesc*) &TMP4767));
appendString(LOC5, fileparts.Field1);
		unsureAsgnRef((void**) (&(*g).currentsection), LOC5);
	}
	LA3: ;
	inittable_311116(((NI) 64), (&(*g).seenindexterms));
	(*g).msghandler = msghandler;
	s = nstGet(config, ((NimStringDesc*) &TMP4768));
	{
		if (!!(((s) && (s)->Sup.len == 0))) goto LA8;
		(*g).splitafter = nsuParseInt(s);
	}
	LA8: ;
	{
		NU8 i_311423;
		NI res_311427;
		i_311423 = 0;
		res_311427 = ((NI) 0);
		{
			while (1) {
				if (!(res_311427 <= ((NI) 4))) goto LA12;
				i_311423 = ((NU8) (res_311427));
				unsureAsgnRef((void**) (&(*g).meta[(i_311423)- 0]), copyString(((NimStringDesc*) &TMP2093)));
				res_311427 += ((NI) 1);
			} LA12: ;
		}
	}
}

N_NIMCALL(void, rendertocentry_317162)(Trstgenerator311016* d, Ttocentry311012* e, NimStringDesc** result) {
	TY154965 LOC1;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString((*e).refname);
	LOC1[1] = copyString((*e).header);
	dispa_311689((*d).target, result, ((NimStringDesc*) &TMP4843), ((NimStringDesc*) &TMP4844), LOC1, 2);
}

N_NIMCALL(void, rendertocentries_317176)(Trstgenerator311016* d, NI* j, NI lvl, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2093));
	{
		while (1) {
			NI a;
			if (!((*j) <= ((*d).tocpart ? ((*d).tocpart->Sup.len-1) : -1))) goto LA2;
			a = ((*(*d).tocpart->data[(*j)].n).level > 0? ((*(*d).tocpart->data[(*j)].n).level) : -((*(*d).tocpart->data[(*j)].n).level));
			{
				if (!(a == lvl)) goto LA5;
				rendertocentry_317162(d, (&(*d).tocpart->data[(*j)]), (&tmp));
				(*j) += ((NI) 1);
			}
			goto LA3;
			LA5: ;
			{
				if (!(lvl < a)) goto LA8;
				rendertocentries_317176(d, j, a, (&tmp));
			}
			goto LA3;
			LA8: ;
			{
				goto LA1;
			}
			LA3: ;
		} LA2: ;
	} LA1: ;
	{
		TY164566 LOC15;
		if (!(((NI) 1) < lvl)) goto LA13;
		memset((void*)LOC15, 0, sizeof(LOC15));
		LOC15[0] = copyString(tmp);
		dispa_311689((*d).target, result, ((NimStringDesc*) &TMP4845), ((NimStringDesc*) &TMP4846), LOC15, 1);
	}
	goto LA11;
	LA13: ;
	{
		(*result) = resizeString((*result), tmp->Sup.len + 0);
appendString((*result), tmp);
	}
	LA11: ;
}

N_NIMCALL(void, writeindexfile_311445)(Trstgenerator311016* g, NimStringDesc* outfile) {
	{
		if (!(((NI) 0) < ((*g).theindex ? (*g).theindex->Sup.len : 0))) goto LA3;
		writefile_13437(outfile, (*g).theindex);
	}
	LA3: ;
}
N_NIMCALL(void, TMP4915)(void* p, NI op) {
	TY314702* a;
	NI LOC1;
	a = (TY314702*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].keyword, op);
	nimGCvisit((void*)a->data[LOC1].link, op);
	nimGCvisit((void*)a->data[LOC1].linktitle, op);
	nimGCvisit((void*)a->data[LOC1].linkdesc, op);
	}
}

N_NIMCALL(NIM_BOOL, isdocumentationtitle_312971)(NimStringDesc* hyperlink) {
	NIM_BOOL result;
	NI LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuFindChar(hyperlink, 35, ((NI) 0));
	result = (LOC1 < ((NI) 0));
	return result;
}

N_NIMCALL(NimStringDesc*, unquoteindexcolumn_311845)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2105), ((NimStringDesc*) &TMP2104));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2103), ((NimStringDesc*) &TMP2102));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2101), ((NimStringDesc*) &TMP2100));
	return result;
}

static N_INLINE(NI, HEX21HEX26_131025)(NI h, NI val) {
	NI result;
	result = 0;
	result = (NI)((NU64)(h) + (NU64)(val));
	result = (NI)((NU64)(result) + (NU64)((NI)((NU64)(result) << (NU64)(((NI) 10)))));
	result = (NI)(result ^ (NI)((NU64)(result) >> (NU64)(((NI) 6))));
	return result;
}

static N_INLINE(NimStringDesc*, or_311713)(NimStringDesc* x, NimStringDesc* y) {
	NimStringDesc* result;
	result = 0;
	{
		if (!x == 0) goto LA3;
		result = copyString(y);
	}
	goto LA1;
	LA3: ;
	{
		result = copyString(x);
	}
	LA1: ;
	return result;
}

static N_INLINE(NI, HEX21HEX24_131054)(NI h) {
	NI result;
	result = 0;
	result = (NI)((NU64)(h) + (NU64)((NI)((NU64)(h) << (NU64)(((NI) 3)))));
	result = (NI)(result ^ (NI)((NU64)(result) >> (NU64)(((NI) 11))));
	result = (NI)((NU64)(result) + (NU64)((NI)((NU64)(result) << (NU64)(((NI) 15)))));
	return result;
}

N_NIMCALL(NI, hash_312441)(Tindexentry312396* x) {
	NI result;
	NI LOC1;
	NI LOC2;
	NimStringDesc* LOC3;
	NI LOC4;
	NimStringDesc* LOC5;
	NI LOC6;
	result = 0;
	LOC1 = 0;
	LOC1 = hash_131839((*x).keyword);
	LOC2 = 0;
	LOC2 = hash_131839((*x).link);
	result = HEX21HEX26_131025(LOC1, LOC2);
	LOC3 = 0;
	LOC3 = or_311713((*x).linktitle, ((NimStringDesc*) &TMP2093));
	LOC4 = 0;
	LOC4 = hash_131839(LOC3);
	result = HEX21HEX26_131025(result, LOC4);
	LOC5 = 0;
	LOC5 = or_311713((*x).linkdesc, ((NimStringDesc*) &TMP2093));
	LOC6 = 0;
	LOC6 = hash_131839(LOC5);
	result = HEX21HEX26_131025(result, LOC6);
	result = HEX21HEX24_131054(result);
	return result;
}

N_NIMCALL(void, readindexdir_314696)(NimStringDesc* dir, TY314699* Result) {
	NI L;
	TY315308 LOC90;
	unsureAsgnRef((void**) (&(*Result).Field0), (TY122008*) newSeq((&NTI122008), 0));
	inittable_314724(((NI) 32), (&(*Result).Field2));
	unsureAsgnRef((void**) (&(*Result).Field1), (TY314702*) newSeq((&NTI314702), ((NI) 15000)));
	(*Result).Field1 = (TY314702*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Tindexentry312396), ((NI) 0));
	L = ((NI) 0);
	{
		NU8 kind_314836;
		NimStringDesc* path_314837;
		DIR* d_316692;
		kind_314836 = 0;
		path_314837 = 0;
		d_316692 = opendir(dir->data);
		{
			int LOC89;
			if (!!((d_316692 == NIM_NIL))) goto LA4;
			{
				while (1) {
					struct dirent* x_316694;
					NimStringDesc* y_316696;
					x_316694 = readdir(d_316692);
					{
						if (!(x_316694 == NIM_NIL)) goto LA10;
						goto LA6;
					}
					LA10: ;
					y_316696 = cstrToNimstr(((NCSTRING) ((*x_316694).d_name)));
					{
						NIM_BOOL LOC14;
						struct stat s_316698;
						NU8 k_316700;
						LOC14 = 0;
						LOC14 = !(eqStrings(y_316696, ((NimStringDesc*) &TMP4917)));
						if (!(LOC14)) goto LA15;
						LOC14 = !(eqStrings(y_316696, ((NimStringDesc*) &TMP4918)));
						LA15: ;
						if (!LOC14) goto LA16;
						memset((void*)(&s_316698), 0, sizeof(s_316698));
						y_316696 = HEX2F_119292(dir, y_316696);
						k_316700 = ((NU8) 0);
						{
							int LOC20;
							LOC20 = 0;
							LOC20 = lstat(y_316696->data, (&s_316698));
							if (!(LOC20 < ((NI32) 0))) goto LA21;
							goto LA6;
						}
						LA21: ;
						{
							NIM_BOOL LOC25;
							LOC25 = 0;
							LOC25 = S_ISDIR(s_316698.st_mode);
							if (!LOC25) goto LA26;
							k_316700 = ((NU8) 2);
						}
						LA26: ;
						{
							NIM_BOOL LOC30;
							LOC30 = 0;
							LOC30 = S_ISLNK(s_316698.st_mode);
							if (!LOC30) goto LA31;
							k_316700 = (NU8)(k_316700 + ((NI) 1));
						}
						LA31: ;
						kind_314836 = k_316700;
						path_314837 = y_316696;
						{
							NIM_BOOL LOC35;
							TY314702* fileentries;
							Tindexentry312396 title;
							NI F;
							LOC35 = 0;
							LOC35 = (kind_314836 == ((NU8) 0));
							if (!(LOC35)) goto LA36;
							LOC35 = nsuEndsWith(path_314837, ((NimStringDesc*) &TMP4919));
							LA36: ;
							if (!LOC35) goto LA37;
							fileentries = 0;
							memset((void*)(&title), 0, sizeof(title));
							F = ((NI) 0);
							fileentries = (TY314702*) newSeq((&NTI314702), ((NI) 500));
							fileentries = (TY314702*) setLengthSeq(&(fileentries)->Sup, sizeof(Tindexentry312396), ((NI) 0));
							{
								NimStringDesc* line_314872;
								FILE* f_316677;
								NimStringDesc* res_316679;
								line_314872 = 0;
								f_316677 = open_13217(path_314837, ((NU8) 0), ((NI) 8000));
								res_316679 = rawNewString(((NI) 80));
								{
									while (1) {
										NIM_BOOL LOC42;
										LOC42 = 0;
										LOC42 = readline_13481(f_316677, (&res_316679));
										if (!LOC42) goto LA41;
										line_314872 = res_316679;
										{
											NI s;
											s = nsuFindChar(line_314872, 9, ((NI) 0));
											{
												if (!(s < ((NI) 0))) goto LA46;
												goto LA43;
											}
											LA46: ;
											fileentries = (TY314702*) setLengthSeq(&(fileentries)->Sup, sizeof(Tindexentry312396), ((NI) ((NI)(F + ((NI) 1)))));
											asgnRefNoCycle((void**) (&fileentries->data[F].keyword), copyStrLast(line_314872, ((NI) 0), (NI)(s - ((NI) 1))));
											asgnRefNoCycle((void**) (&fileentries->data[F].link), copyStr(line_314872, (NI)(s + ((NI) 1))));
											{
												NIM_BOOL LOC50;
												LOC50 = 0;
												LOC50 = title.keyword == 0;
												if (!(LOC50)) goto LA51;
												LOC50 = isdocumentationtitle_312971(fileentries->data[F].link);
												LA51: ;
												if (!LOC50) goto LA52;
												title.keyword = copyString(fileentries->data[F].keyword);
												title.link = copyString(fileentries->data[F].link);
											}
											LA52: ;
											{
												NI LOC56;
												TY122008* extracols;
												NimStringDesc* LOC59;
												LOC56 = 0;
												LOC56 = nsuFindChar(fileentries->data[F].link, 9, ((NI) 0));
												if (!(((NI) 0) < LOC56)) goto LA57;
												extracols = nsuSplitChar(fileentries->data[F].link, 9);
												LOC59 = 0;
												LOC59 = fileentries->data[F].link; fileentries->data[F].link = copyStringRC1(extracols->data[((NI) 0)]);
												if (LOC59) nimGCunrefNoCycle(LOC59);
												asgnRefNoCycle((void**) (&fileentries->data[F].linktitle), unquoteindexcolumn_311845(extracols->data[((NI) 1)]));
												asgnRefNoCycle((void**) (&fileentries->data[F].linkdesc), unquoteindexcolumn_311845(extracols->data[((NI) 2)]));
											}
											goto LA54;
											LA57: ;
											{
												NimStringDesc* LOC61;
												NimStringDesc* LOC62;
												LOC61 = 0;
												LOC61 = fileentries->data[F].linktitle; fileentries->data[F].linktitle = copyStringRC1(NIM_NIL);
												if (LOC61) nimGCunrefNoCycle(LOC61);
												LOC62 = 0;
												LOC62 = fileentries->data[F].linkdesc; fileentries->data[F].linkdesc = copyStringRC1(NIM_NIL);
												if (LOC62) nimGCunrefNoCycle(LOC62);
											}
											LA54: ;
											F += ((NI) 1);
										} LA43: ;
									} LA41: ;
								}
								fclose(f_316677);
							}
							{
								TY119589 LOC83;
								NimStringDesc* LOC84;
								if (!title.keyword == 0) goto LA65;
								{
									NI i_315028;
									NI HEX3Atmp_316683;
									NI res_316686;
									i_315028 = 0;
									HEX3Atmp_316683 = 0;
									HEX3Atmp_316683 = (F - 1);
									res_316686 = ((NI) 0);
									{
										while (1) {
											if (!(res_316686 <= HEX3Atmp_316683)) goto LA69;
											i_315028 = res_316686;
											{
												NimStringDesc* toc;
												NimStringDesc* LOC79;
												NimStringDesc* LOC80;
												NimStringDesc* LOC81;
												NimStringDesc* LOC82;
												toc = fileentries->data[i_315028].linktitle;
												{
													NIM_BOOL LOC73;
													NIM_BOOL LOC74;
													LOC73 = 0;
													LOC74 = 0;
													LOC74 = !(toc == 0);
													if (!(LOC74)) goto LA75;
													LOC74 = (((NI) 0) < (toc ? toc->Sup.len : 0));
													LA75: ;
													LOC73 = LOC74;
													if (!(LOC73)) goto LA76;
													LOC73 = ((NU8)(toc->data[((NI) 0)]) == (NU8)(32));
													LA76: ;
													if (!LOC73) goto LA77;
													goto LA70;
												}
												LA77: ;
												(*Result).Field1 = (TY314702*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Tindexentry312396), ((NI) ((NI)(L + ((NI) 1)))));
												LOC79 = 0;
												LOC79 = (*Result).Field1->data[L].keyword; (*Result).Field1->data[L].keyword = copyStringRC1(fileentries->data[i_315028].keyword);
												if (LOC79) nimGCunrefNoCycle(LOC79);
												LOC80 = 0;
												LOC80 = (*Result).Field1->data[L].link; (*Result).Field1->data[L].link = copyStringRC1(fileentries->data[i_315028].link);
												if (LOC80) nimGCunrefNoCycle(LOC80);
												LOC81 = 0;
												LOC81 = (*Result).Field1->data[L].linktitle; (*Result).Field1->data[L].linktitle = copyStringRC1(fileentries->data[i_315028].linktitle);
												if (LOC81) nimGCunrefNoCycle(LOC81);
												LOC82 = 0;
												LOC82 = (*Result).Field1->data[L].linkdesc; (*Result).Field1->data[L].linkdesc = copyStringRC1(fileentries->data[i_315028].linkdesc);
												if (LOC82) nimGCunrefNoCycle(LOC82);
												L += ((NI) 1);
											} LA70: ;
											res_316686 += ((NI) 1);
										} LA69: ;
									}
								}
								memset((void*)(&LOC83), 0, sizeof(LOC83));
								nossplitFile(path_314837, (&LOC83));
								(*Result).Field0 = (TY122008*) incrSeq(&((*Result).Field0)->Sup, sizeof(NimStringDesc*));
								LOC84 = 0;
								LOC84 = (*Result).Field0->data[(*Result).Field0->Sup.len-1]; (*Result).Field0->data[(*Result).Field0->Sup.len-1] = copyStringRC1(LOC83.Field1);
								if (LOC84) nimGCunrefNoCycle(LOC84);
							}
							goto LA63;
							LA65: ;
							{
								NimStringDesc* LOC86;
								NI LOC87;
								NimStringDesc* LOC88;
								LOC86 = 0;
								LOC87 = 0;
								LOC87 = len_315060((*Result).Field2);
								LOC88 = 0;
								LOC88 = nimIntToStr(LOC87);
								LOC86 = rawNewString(LOC88->Sup.len + 8);
appendString(LOC86, ((NimStringDesc*) &TMP4920));
appendString(LOC86, LOC88);
								title.linktitle = LOC86;
								HEX5BHEX5DHEX3D_315072((&(*Result).Field2), (&title), fileentries);
							}
							LA63: ;
						}
						LA37: ;
					}
					LA16: ;
				}
			} LA6: ;
			LOC89 = 0;
			LOC89 = closedir(d_316692);
		}
		LA4: ;
	}
	memset((void*)(&LOC90), 0, sizeof(LOC90));
	LOC90.ClPrc = ((TMP4923) (cmp_4717)); LOC90.ClEnv = NIM_NIL;
	sort_315301((*Result).Field0->data, (*Result).Field0->Sup.len, LOC90, ((NU8) 1));
}

static N_INLINE(NIM_BOOL, isfilled_156211)(NI hcode) {
	NIM_BOOL result;
	result = 0;
	result = !((hcode == ((NI) 0)));
	return result;
}

N_NIMCALL(void, HEX3CHEX2D_312807)(Tindexentry312396* a, Tindexentry312396* b) {
	unsureAsgnRef((void**) (&(*a).keyword), (*b).keyword);
	unsureAsgnRef((void**) (&(*a).link), (*b).link);
	{
		if (!(*b).linktitle == 0) goto LA3;
		unsureAsgnRef((void**) (&(*a).linktitle), copyString(NIM_NIL));
	}
	goto LA1;
	LA3: ;
	{
		unsureAsgnRef((void**) (&(*a).linktitle), (*b).linktitle);
	}
	LA1: ;
	{
		if (!(*b).linkdesc == 0) goto LA8;
		unsureAsgnRef((void**) (&(*a).linkdesc), copyString(NIM_NIL));
	}
	goto LA6;
	LA8: ;
	{
		unsureAsgnRef((void**) (&(*a).linkdesc), (*b).linkdesc);
	}
	LA6: ;
}

N_NIMCALL(NI, cmp_312430)(Tindexentry312396* a, Tindexentry312396* b) {
	NI result;
	result = 0;
	result = nsuCmpIgnoreStyle((*a).keyword, (*b).keyword);
	{
		if (!(result == ((NI) 0))) goto LA3;
		result = nsuCmpIgnoreStyle((*a).link, (*b).link);
	}
	LA3: ;
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationjumps_314392)(Table312409 docs) {
	NimStringDesc* result_314395;
	TY314702* titles;
	TY314702* result_314397;
	TY313694 LOC14;
	TY122008* chunks;
	NimStringDesc* LOC20;
	NimStringDesc* LOC21;
	result_314395 = 0;
	result_314395 = copyString(((NimStringDesc*) &TMP4924));
	result_314397 = (TY314702*) newSeq((&NTI314702), 0);
	{
		Tindexentry312396 x_314399;
		memset((void*)(&x_314399), 0, sizeof(x_314399));
		{
			NI h_314590;
			NI HEX3Atmp_314592;
			NI res_314594;
			h_314590 = 0;
			HEX3Atmp_314592 = 0;
			HEX3Atmp_314592 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_314594 = ((NI) 0);
			{
				while (1) {
					if (!(res_314594 <= HEX3Atmp_314592)) goto LA4;
					h_314590 = res_314594;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_156211(docs.data->data[h_314590].Field0);
						if (!LOC7) goto LA8;
						x_314399.keyword = docs.data->data[h_314590].Field1.keyword;
						x_314399.link = docs.data->data[h_314590].Field1.link;
						x_314399.linktitle = docs.data->data[h_314590].Field1.linktitle;
						x_314399.linkdesc = docs.data->data[h_314590].Field1.linkdesc;
						result_314397 = (TY314702*) incrSeq(&(result_314397)->Sup, sizeof(Tindexentry312396));
						LOC10 = 0;
						LOC10 = result_314397->data[result_314397->Sup.len-1].keyword; result_314397->data[result_314397->Sup.len-1].keyword = copyStringRC1(x_314399.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_314397->data[result_314397->Sup.len-1].link; result_314397->data[result_314397->Sup.len-1].link = copyStringRC1(x_314399.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_314397->data[result_314397->Sup.len-1].linktitle; result_314397->data[result_314397->Sup.len-1].linktitle = copyStringRC1(x_314399.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_314397->data[result_314397->Sup.len-1].linkdesc; result_314397->data[result_314397->Sup.len-1].linkdesc = copyStringRC1(x_314399.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
					}
					LA8: ;
					res_314594 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_314397, (&NTI314702));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP4927) (cmp_312430)); LOC14.ClEnv = NIM_NIL;
	sort_313687(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	chunks = (TY122008*) newSeq((&NTI122008), 0);
	{
		Tindexentry312396 title_314574;
		NI i_314601;
		NI L_314603;
		memset((void*)(&title_314574), 0, sizeof(title_314574));
		i_314601 = ((NI) 0);
		L_314603 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC18;
				NimStringDesc* LOC19;
				if (!(i_314601 < L_314603)) goto LA17;
				title_314574.keyword = titles->data[i_314601].keyword;
				title_314574.link = titles->data[i_314601].link;
				title_314574.linktitle = titles->data[i_314601].linktitle;
				title_314574.linkdesc = titles->data[i_314601].linkdesc;
				LOC18 = 0;
				LOC18 = rawNewString(title_314574.link->Sup.len + title_314574.keyword->Sup.len + 15);
appendString(LOC18, ((NimStringDesc*) &TMP4928));
appendString(LOC18, title_314574.link);
appendString(LOC18, ((NimStringDesc*) &TMP4929));
appendString(LOC18, title_314574.keyword);
appendString(LOC18, ((NimStringDesc*) &TMP4930));
				chunks = (TY122008*) incrSeq(&(chunks)->Sup, sizeof(NimStringDesc*));
				LOC19 = 0;
				LOC19 = chunks->data[chunks->Sup.len-1]; chunks->data[chunks->Sup.len-1] = copyStringRC1(LOC18);
				if (LOC19) nimGCunrefNoCycle(LOC19);
				i_314601 += ((NI) 1);
			} LA17: ;
		}
	}
	LOC20 = 0;
	LOC21 = 0;
	LOC21 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP4931));
	LOC20 = rawNewString(LOC21->Sup.len + 5);
appendString(LOC20, LOC21);
appendString(LOC20, ((NimStringDesc*) &TMP4932));
	result_314395 = resizeString(result_314395, LOC20->Sup.len + 0);
appendString(result_314395, LOC20);
	return result_314395;
}

N_NIMCALL(NimStringDesc*, generatemodulejumps_314631)(TY122008* modules) {
	NimStringDesc* result;
	TY122008* chunks;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP4934));
	chunks = (TY122008*) newSeq((&NTI122008), 0);
	{
		NimStringDesc* name_314663;
		NI i_314678;
		NI L_314680;
		name_314663 = 0;
		i_314678 = ((NI) 0);
		L_314680 = (modules ? modules->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				NimStringDesc* LOC5;
				if (!(i_314678 < L_314680)) goto LA3;
				name_314663 = modules->data[i_314678];
				LOC4 = 0;
				LOC4 = rawNewString(name_314663->Sup.len + name_314663->Sup.len + 20);
appendString(LOC4, ((NimStringDesc*) &TMP4928));
appendString(LOC4, name_314663);
appendString(LOC4, ((NimStringDesc*) &TMP4935));
appendString(LOC4, name_314663);
appendString(LOC4, ((NimStringDesc*) &TMP4930));
				chunks = (TY122008*) incrSeq(&(chunks)->Sup, sizeof(NimStringDesc*));
				LOC5 = 0;
				LOC5 = chunks->data[chunks->Sup.len-1]; chunks->data[chunks->Sup.len-1] = copyStringRC1(LOC4);
				if (LOC5) nimGCunrefNoCycle(LOC5);
				i_314678 += ((NI) 1);
			} LA3: ;
		}
	}
	LOC6 = 0;
	LOC7 = 0;
	LOC7 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP4931));
	LOC6 = rawNewString(LOC7->Sup.len + 5);
appendString(LOC6, LOC7);
appendString(LOC6, ((NimStringDesc*) &TMP4932));
	result = resizeString(result, LOC6->Sup.len + 0);
appendString(result, LOC6);
	return result;
}
N_NIMCALL(void, TMP4939)(void* p, NI op) {
	TY313066* a;
	NI LOC1;
	a = (TY313066*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Field1, op);
	}
}

static N_INLINE(NimStringDesc*, HEX5BHEX5D_85765)(NimStringDesc* s, Slice85772 x) {
	NimStringDesc* result;
	result = 0;
	result = copyStrLast(s, x.a, x.b);
	return result;
}

static N_INLINE(Slice85772, HEX2EHEX2E_105273)(NI a, NI b) {
	Slice85772 result;
	memset((void*)(&result), 0, sizeof(result));
	result.a = a;
	result.b = b;
	return result;
}

N_NIMCALL(void, striptoclevel_312981)(NimStringDesc* s, TY313067* Result) {
	Slice85772 LOC8;
	{
		NI c_313006;
		NI HEX3Atmp_313026;
		NI res_313029;
		c_313006 = 0;
		HEX3Atmp_313026 = 0;
		HEX3Atmp_313026 = ((s ? s->Sup.len : 0) - 1);
		res_313029 = ((NI) 0);
		{
			while (1) {
				if (!(res_313029 <= HEX3Atmp_313026)) goto LA3;
				c_313006 = res_313029;
				(*Result).Field0 = c_313006;
				{
					if (!!(((NU8)(s->data[c_313006]) == (NU8)(32)))) goto LA6;
					goto LA1;
				}
				LA6: ;
				res_313029 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	LOC8 = HEX2EHEX2E_105273((*Result).Field0, ((s ? s->Sup.len : 0) - 1));
	unsureAsgnRef((void**) (&(*Result).Field1), HEX5BHEX5D_85765(s, LOC8));
}

N_NIMCALL(NimStringDesc*, indenttolevel_313048)(NI* level, NI newlevel) {
	NimStringDesc* result;
{	result = 0;
	result = copyString(((NimStringDesc*) &TMP2093));
	{
		if (!((*level) == newlevel)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!((*level) < newlevel)) goto LA7;
		result = nsuRepeatStr(((NimStringDesc*) &TMP4941), ((NI) ((NI)(newlevel - (*level)))));
	}
	goto LA5;
	LA7: ;
	{
		result = nsuRepeatStr(((NimStringDesc*) &TMP4942), ((NI) ((NI)((*level) - newlevel))));
	}
	LA5: ;
	(*level) = newlevel;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationtoc_313060)(TY314702* entries) {
	NimStringDesc* result;
	NimStringDesc* titleref;
	TY313066* levels;
	NI L_313071;
	NI level;
	NimStringDesc* LOC23;
	NimStringDesc* LOC24;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2093));
	titleref = 0;
	levels = 0;
	L_313071 = ((NI) 0);
	level = ((NI) 1);
	levels = (TY313066*) newSeq((&NTI313066), ((NI) ((entries ? entries->Sup.len : 0))));
	{
		Tindexentry312396 entry_313211;
		NI i_313406;
		NI L_313408;
		memset((void*)(&entry_313211), 0, sizeof(entry_313211));
		i_313406 = ((NI) 0);
		L_313408 = (entries ? entries->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				TY313067 LOC5;
				NI rawlevel;
				NimStringDesc* rawtext;
				if (!(i_313406 < L_313408)) goto LA3;
				entry_313211.keyword = entries->data[i_313406].keyword;
				entry_313211.link = entries->data[i_313406].link;
				entry_313211.linktitle = entries->data[i_313406].linktitle;
				entry_313211.linkdesc = entries->data[i_313406].linkdesc;
				LOC4 = 0;
				LOC4 = or_311713(entry_313211.linktitle, entry_313211.keyword);
				memset((void*)(&LOC5), 0, sizeof(LOC5));
				striptoclevel_312981(LOC4, (&LOC5));
				rawlevel = 0;
				rawlevel = LOC5.Field0;
				rawtext = 0;
				rawtext = LOC5.Field1;
				{
					NimStringDesc* LOC10;
					if (!(rawlevel < ((NI) 1))) goto LA8;
					levels->data[L_313071].Field0 = (NI)(level + ((NI) 1));
					LOC10 = 0;
					LOC10 = levels->data[L_313071].Field1; levels->data[L_313071].Field1 = copyStringRC1(entry_313211.keyword);
					if (LOC10) nimGCunrefNoCycle(LOC10);
				}
				goto LA6;
				LA8: ;
				{
					NimStringDesc* LOC12;
					level = rawlevel;
					levels->data[L_313071].Field0 = rawlevel;
					LOC12 = 0;
					LOC12 = levels->data[L_313071].Field1; levels->data[L_313071].Field1 = copyStringRC1(rawtext);
					if (LOC12) nimGCunrefNoCycle(LOC12);
				}
				LA6: ;
				L_313071 += ((NI) 1);
				i_313406 += ((NI) 1);
			} LA3: ;
		}
	}
	result = copyString(((NimStringDesc*) &TMP4940));
	level = ((NI) 1);
	L_313071 = ((NI) 0);
	{
		while (1) {
			NimStringDesc* link;
			if (!(L_313071 < (entries ? entries->Sup.len : 0))) goto LA14;
			link = entries->data[L_313071].link;
			{
				NIM_BOOL LOC17;
				LOC17 = 0;
				LOC17 = isdocumentationtitle_312971(link);
				if (!LOC17) goto LA18;
				titleref = copyString(link);
			}
			goto LA15;
			LA18: ;
			{
				NimStringDesc* LOC21;
				NimStringDesc* LOC22;
				LOC21 = 0;
				LOC21 = indenttolevel_313048((&level), levels->data[L_313071].Field0);
				result = resizeString(result, LOC21->Sup.len + 0);
appendString(result, LOC21);
				LOC22 = 0;
				LOC22 = rawNewString(link->Sup.len + levels->data[L_313071].Field1->Sup.len + 20);
appendString(LOC22, ((NimStringDesc*) &TMP4943));
appendString(LOC22, link);
appendString(LOC22, ((NimStringDesc*) &TMP4929));
appendString(LOC22, levels->data[L_313071].Field1);
appendString(LOC22, ((NimStringDesc*) &TMP4944));
				result = resizeString(result, LOC22->Sup.len + 0);
appendString(result, LOC22);
			}
			LA15: ;
			L_313071 += ((NI) 1);
		} LA14: ;
	}
	LOC23 = 0;
	LOC24 = 0;
	LOC24 = indenttolevel_313048((&level), ((NI) 1));
	LOC23 = rawNewString(LOC24->Sup.len + 6);
appendString(LOC23, LOC24);
appendString(LOC23, ((NimStringDesc*) &TMP4945));
	result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationindex_313431)(Table312409 docs) {
	NimStringDesc* result_313434;
	TY314702* titles;
	TY314702* result_313436;
	TY313694 LOC14;
	result_313434 = 0;
	result_313434 = copyString(((NimStringDesc*) &TMP2093));
	result_313436 = (TY314702*) newSeq((&NTI314702), 0);
	{
		Tindexentry312396 x_313438;
		memset((void*)(&x_313438), 0, sizeof(x_313438));
		{
			NI h_314352;
			NI HEX3Atmp_314354;
			NI res_314356;
			h_314352 = 0;
			HEX3Atmp_314354 = 0;
			HEX3Atmp_314354 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_314356 = ((NI) 0);
			{
				while (1) {
					if (!(res_314356 <= HEX3Atmp_314354)) goto LA4;
					h_314352 = res_314356;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_156211(docs.data->data[h_314352].Field0);
						if (!LOC7) goto LA8;
						x_313438.keyword = docs.data->data[h_314352].Field1.keyword;
						x_313438.link = docs.data->data[h_314352].Field1.link;
						x_313438.linktitle = docs.data->data[h_314352].Field1.linktitle;
						x_313438.linkdesc = docs.data->data[h_314352].Field1.linkdesc;
						result_313436 = (TY314702*) incrSeq(&(result_313436)->Sup, sizeof(Tindexentry312396));
						LOC10 = 0;
						LOC10 = result_313436->data[result_313436->Sup.len-1].keyword; result_313436->data[result_313436->Sup.len-1].keyword = copyStringRC1(x_313438.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_313436->data[result_313436->Sup.len-1].link; result_313436->data[result_313436->Sup.len-1].link = copyStringRC1(x_313438.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_313436->data[result_313436->Sup.len-1].linktitle; result_313436->data[result_313436->Sup.len-1].linktitle = copyStringRC1(x_313438.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_313436->data[result_313436->Sup.len-1].linkdesc; result_313436->data[result_313436->Sup.len-1].linkdesc = copyStringRC1(x_313438.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
					}
					LA8: ;
					res_314356 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_313436, (&NTI314702));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP4937) (cmp_312430)); LOC14.ClEnv = NIM_NIL;
	sort_313687(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	{
		Tindexentry312396 title_314280;
		NI i_314362;
		NI L_314364;
		memset((void*)(&title_314280), 0, sizeof(title_314280));
		i_314362 = ((NI) 0);
		L_314364 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* toclist;
				TY314702* LOC18;
				NimStringDesc* LOC19;
				if (!(i_314362 < L_314364)) goto LA17;
				title_314280.keyword = titles->data[i_314362].keyword;
				title_314280.link = titles->data[i_314362].link;
				title_314280.linktitle = titles->data[i_314362].linktitle;
				title_314280.linkdesc = titles->data[i_314362].linkdesc;
				LOC18 = 0;
				LOC18 = HEX5BHEX5D_314282(docs, (&title_314280));
				toclist = generatedocumentationtoc_313060(LOC18);
				LOC19 = 0;
				LOC19 = rawNewString(title_314280.link->Sup.len + title_314280.keyword->Sup.len + toclist->Sup.len + 30);
appendString(LOC19, ((NimStringDesc*) &TMP4946));
appendString(LOC19, title_314280.link);
appendString(LOC19, ((NimStringDesc*) &TMP4929));
appendString(LOC19, title_314280.keyword);
appendString(LOC19, ((NimStringDesc*) &TMP4944));
appendString(LOC19, toclist);
appendString(LOC19, ((NimStringDesc*) &TMP4945));
				result_313434 = resizeString(result_313434, LOC19->Sup.len + 0);
appendString(result_313434, LOC19);
				i_314362 += ((NI) 1);
			} LA17: ;
		}
	}
	return result_313434;
}

N_NIMCALL(void, sortindex_312818)(Tindexentry312396* a, NI aLen0) {
	NI n;
	NI h;
	n = aLen0;
	h = ((NI) 1);
	{
		while (1) {
			h = (NI)((NI)(((NI) 3) * h) + ((NI) 1));
			{
				if (!(n < h)) goto LA5;
				goto LA1;
			}
			LA5: ;
		}
	} LA1: ;
	{
		while (1) {
			h = (NI)(h / ((NI) 3));
			{
				NI i_312844;
				NI HEX3Atmp_312855;
				NI res_312858;
				i_312844 = 0;
				HEX3Atmp_312855 = 0;
				HEX3Atmp_312855 = (NI)(n - ((NI) 1));
				res_312858 = h;
				{
					while (1) {
						Tindexentry312396 v;
						NI j;
						if (!(res_312858 <= HEX3Atmp_312855)) goto LA11;
						i_312844 = res_312858;
						memset((void*)(&v), 0, sizeof(v));
						HEX3CHEX2D_312807((&v), (&a[i_312844]));
						j = i_312844;
						{
							while (1) {
								NI LOC14;
								LOC14 = 0;
								LOC14 = cmp_312430((&a[(NI)(j - h)]), (&v));
								if (!(((NI) 0) <= LOC14)) goto LA13;
								HEX3CHEX2D_312807((&a[j]), (&a[(NI)(j - h)]));
								j = (NI)(j - h);
								{
									if (!(j < h)) goto LA17;
									goto LA12;
								}
								LA17: ;
							} LA13: ;
						} LA12: ;
						HEX3CHEX2D_312807((&a[j]), (&v));
						res_312858 += ((NI) 1);
					} LA11: ;
				}
			}
			{
				if (!(h == ((NI) 1))) goto LA21;
				goto LA7;
			}
			LA21: ;
		}
	} LA7: ;
}

N_NIMCALL(NimStringDesc*, generatesymbolindex_312895)(TY314702* symbols) {
	NimStringDesc* result;
	NI i;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2093));
	i = ((NI) 0);
	{
		while (1) {
			NimStringDesc* keyword;
			NimStringDesc* cleanedkeyword;
			Slice85772 LOC3;
			TY154965 LOC4;
			NI j;
			if (!(i < (symbols ? symbols->Sup.len : 0))) goto LA2;
			keyword = symbols->data[i].keyword;
			LOC3 = HEX2EHEX2E_105273(((NI) 1), (NI)((keyword ? (keyword->Sup.len-1) : -1) - ((NI) 1)));
			cleanedkeyword = HEX5BHEX5D_85765(keyword, LOC3);
			memset((void*)LOC4, 0, sizeof(LOC4));
			LOC4[0] = copyString(keyword);
			LOC4[1] = copyString(cleanedkeyword);
			nsuAddf((&result), ((NimStringDesc*) &TMP4948), LOC4, 2);
			j = i;
			{
				while (1) {
					NIM_BOOL LOC7;
					NimStringDesc* url;
					NimStringDesc* text;
					NimStringDesc* desc;
					LOC7 = 0;
					LOC7 = (j < (symbols ? symbols->Sup.len : 0));
					if (!(LOC7)) goto LA8;
					LOC7 = eqStrings(keyword, symbols->data[j].keyword);
					LA8: ;
					if (!LOC7) goto LA6;
					url = symbols->data[j].link;
					{
						if (!!(symbols->data[j].linktitle == 0)) goto LA11;
						text = symbols->data[j].linktitle;
					}
					goto LA9;
					LA11: ;
					{
						text = url;
					}
					LA9: ;
					{
						if (!!(symbols->data[j].linkdesc == 0)) goto LA16;
						desc = symbols->data[j].linkdesc;
					}
					goto LA14;
					LA16: ;
					{
						desc = copyString(((NimStringDesc*) &TMP2093));
					}
					LA14: ;
					{
						TY176061 LOC23;
						if (!(((NI) 0) < (desc ? desc->Sup.len : 0))) goto LA21;
						memset((void*)LOC23, 0, sizeof(LOC23));
						LOC23[0] = copyString(url);
						LOC23[1] = copyString(text);
						LOC23[2] = copyString(desc);
						nsuAddf((&result), ((NimStringDesc*) &TMP4949), LOC23, 3);
					}
					goto LA19;
					LA21: ;
					{
						TY154965 LOC25;
						memset((void*)LOC25, 0, sizeof(LOC25));
						LOC25[0] = copyString(url);
						LOC25[1] = copyString(text);
						nsuAddf((&result), ((NimStringDesc*) &TMP4950), LOC25, 2);
					}
					LA19: ;
					j += ((NI) 1);
				} LA6: ;
			}
			result = resizeString(result, 11);
appendString(result, ((NimStringDesc*) &TMP4951));
			i = j;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, mergeindexes_316740)(NimStringDesc* dir) {
	NimStringDesc* result;
	TY314699 LOC1;
	TY122008* modules;
	TY314702* symbols;
	Table312409 docs;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	readindexdir_314696(dir, (&LOC1));
	modules = 0;
	genericSeqAssign((&modules), LOC1.Field0, (&NTI122008));
	symbols = 0;
	genericSeqAssign((&symbols), LOC1.Field1, (&NTI314702));
	memset((void*)(&docs), 0, sizeof(docs));
	genericSeqAssign((&docs.data), LOC1.Field2.data, (&NTI312412));
	docs.counter = LOC1.Field2.counter;
	result = copyString(((NimStringDesc*) &TMP2093));
	{
		NI LOC4;
		NimStringDesc* LOC7;
		LOC4 = 0;
		LOC4 = len_315060(docs);
		if (!(((NI) 0) < LOC4)) goto LA5;
		LOC7 = 0;
		LOC7 = generatedocumentationjumps_314392(docs);
		result = resizeString(result, LOC7->Sup.len + 0);
appendString(result, LOC7);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP4933));
	}
	LA5: ;
	{
		NimStringDesc* LOC12;
		if (!(((NI) 0) < (modules ? modules->Sup.len : 0))) goto LA10;
		LOC12 = 0;
		LOC12 = generatemodulejumps_314631(modules);
		result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP4933));
	}
	LA10: ;
	{
		NI LOC15;
		NimStringDesc* LOC18;
		LOC15 = 0;
		LOC15 = len_315060(docs);
		if (!(((NI) 0) < LOC15)) goto LA16;
		result = resizeString(result, 29);
appendString(result, ((NimStringDesc*) &TMP4936));
		LOC18 = 0;
		LOC18 = generatedocumentationindex_313431(docs);
		result = resizeString(result, LOC18->Sup.len + 0);
appendString(result, LOC18);
	}
	LA16: ;
	{
		NimStringDesc* LOC23;
		if (!(((NI) 0) < (symbols ? symbols->Sup.len : 0))) goto LA21;
		sortindex_312818(symbols->data, symbols->Sup.len);
		result = resizeString(result, 21);
appendString(result, ((NimStringDesc*) &TMP4947));
		LOC23 = 0;
		LOC23 = generatesymbolindex_312895(symbols);
		result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	}
	LA21: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, docutils_rstgenInit)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_311489; splitter_311489 = copyStringRC1(((NimStringDesc*) &TMP898));
	if (LOC1) nimGCunrefNoCycle(LOC1);
}

NIM_EXTERNC N_NOINLINE(void, docutils_rstgenDatInit)(void) {
static TNimNode* TMP4757[13];
static TNimNode* TMP4758[2];
NI TMP4760;
static char* NIM_CONST TMP4759[2] = {
"outHtml", 
"outLatex"};
static TNimNode* TMP4761[3];
static TNimNode* TMP4914[4];
static TNimNode* TMP4938[2];
static TNimNode TMP890[29];
NTI311016.size = sizeof(Trstgenerator311016);
NTI311016.kind = 17;
NTI311016.base = (&NTI3411);
TMP4757[0] = &TMP890[1];
NTI311010.size = sizeof(NU8);
NTI311010.kind = 14;
NTI311010.base = 0;
NTI311010.flags = 3;
for (TMP4760 = 0; TMP4760 < 2; TMP4760++) {
TMP890[TMP4760+2].kind = 1;
TMP890[TMP4760+2].offset = TMP4760;
TMP890[TMP4760+2].name = TMP4759[TMP4760];
TMP4758[TMP4760] = &TMP890[TMP4760+2];
}
TMP890[4].len = 2; TMP890[4].kind = 2; TMP890[4].sons = &TMP4758[0];
NTI311010.node = &TMP890[4];
TMP890[1].kind = 1;
TMP890[1].offset = offsetof(Trstgenerator311016, target);
TMP890[1].typ = (&NTI311010);
TMP890[1].name = "target";
TMP4757[1] = &TMP890[5];
TMP890[5].kind = 1;
TMP890[5].offset = offsetof(Trstgenerator311016, config);
TMP890[5].typ = (&NTI134014);
TMP890[5].name = "config";
TMP4757[2] = &TMP890[6];
TMP890[6].kind = 1;
TMP890[6].offset = offsetof(Trstgenerator311016, splitafter);
TMP890[6].typ = (&NTI108);
TMP890[6].name = "splitAfter";
TMP4757[3] = &TMP890[7];
NTI311012.size = sizeof(Ttocentry311012);
NTI311012.kind = 18;
NTI311012.base = 0;
NTI311012.flags = 2;
TMP4761[0] = &TMP890[9];
TMP890[9].kind = 1;
TMP890[9].offset = offsetof(Ttocentry311012, n);
TMP890[9].typ = (&NTI296007);
TMP890[9].name = "n";
TMP4761[1] = &TMP890[10];
TMP890[10].kind = 1;
TMP890[10].offset = offsetof(Ttocentry311012, refname);
TMP890[10].typ = (&NTI149);
TMP890[10].name = "refname";
TMP4761[2] = &TMP890[11];
TMP890[11].kind = 1;
TMP890[11].offset = offsetof(Ttocentry311012, header);
TMP890[11].typ = (&NTI149);
TMP890[11].name = "header";
TMP890[8].len = 3; TMP890[8].kind = 2; TMP890[8].sons = &TMP4761[0];
NTI311012.node = &TMP890[8];
NTI311034.size = sizeof(TY311034*);
NTI311034.kind = 24;
NTI311034.base = (&NTI311012);
NTI311034.flags = 2;
NTI311034.marker = TMP4762;
TMP890[7].kind = 1;
TMP890[7].offset = offsetof(Trstgenerator311016, tocpart);
TMP890[7].typ = (&NTI311034);
TMP890[7].name = "tocPart";
TMP4757[4] = &TMP890[12];
TMP890[12].kind = 1;
TMP890[12].offset = offsetof(Trstgenerator311016, hastoc);
TMP890[12].typ = (&NTI138);
TMP890[12].name = "hasToc";
TMP4757[5] = &TMP890[13];
TMP890[13].kind = 1;
TMP890[13].offset = offsetof(Trstgenerator311016, theindex);
TMP890[13].typ = (&NTI149);
TMP890[13].name = "theIndex";
TMP4757[6] = &TMP890[14];
TMP890[14].kind = 1;
TMP890[14].offset = offsetof(Trstgenerator311016, options);
TMP890[14].typ = (&NTI297015);
TMP890[14].name = "options";
TMP4757[7] = &TMP890[15];
TMP890[15].kind = 1;
TMP890[15].offset = offsetof(Trstgenerator311016, findfile);
TMP890[15].typ = (&NTI297023);
TMP890[15].name = "findFile";
TMP4757[8] = &TMP890[16];
TMP890[16].kind = 1;
TMP890[16].offset = offsetof(Trstgenerator311016, msghandler);
TMP890[16].typ = (&NTI297021);
TMP890[16].name = "msgHandler";
TMP4757[9] = &TMP890[17];
TMP890[17].kind = 1;
TMP890[17].offset = offsetof(Trstgenerator311016, filename);
TMP890[17].typ = (&NTI149);
TMP890[17].name = "filename";
TMP4757[10] = &TMP890[18];
NTI311042.size = sizeof(TY311042);
NTI311042.kind = 16;
NTI311042.base = (&NTI149);
NTI311042.flags = 2;
TMP890[18].kind = 1;
TMP890[18].offset = offsetof(Trstgenerator311016, meta);
TMP890[18].typ = (&NTI311042);
TMP890[18].name = "meta";
TMP4757[11] = &TMP890[19];
TMP890[19].kind = 1;
TMP890[19].offset = offsetof(Trstgenerator311016, currentsection);
TMP890[19].typ = (&NTI149);
TMP890[19].name = "currentSection";
TMP4757[12] = &TMP890[20];
TMP890[20].kind = 1;
TMP890[20].offset = offsetof(Trstgenerator311016, seenindexterms);
TMP890[20].typ = (&NTI311052);
TMP890[20].name = "seenIndexTerms";
TMP890[0].len = 13; TMP890[0].kind = 2; TMP890[0].sons = &TMP4757[0];
NTI311016.node = &TMP890[0];
NTI312396.size = sizeof(Tindexentry312396);
NTI312396.kind = 18;
NTI312396.base = 0;
NTI312396.flags = 2;
TMP4914[0] = &TMP890[22];
TMP890[22].kind = 1;
TMP890[22].offset = offsetof(Tindexentry312396, keyword);
TMP890[22].typ = (&NTI149);
TMP890[22].name = "keyword";
TMP4914[1] = &TMP890[23];
TMP890[23].kind = 1;
TMP890[23].offset = offsetof(Tindexentry312396, link);
TMP890[23].typ = (&NTI149);
TMP890[23].name = "link";
TMP4914[2] = &TMP890[24];
TMP890[24].kind = 1;
TMP890[24].offset = offsetof(Tindexentry312396, linktitle);
TMP890[24].typ = (&NTI149);
TMP890[24].name = "linkTitle";
TMP4914[3] = &TMP890[25];
TMP890[25].kind = 1;
TMP890[25].offset = offsetof(Tindexentry312396, linkdesc);
TMP890[25].typ = (&NTI149);
TMP890[25].name = "linkDesc";
TMP890[21].len = 4; TMP890[21].kind = 2; TMP890[21].sons = &TMP4914[0];
NTI312396.node = &TMP890[21];
NTI314702.size = sizeof(TY314702*);
NTI314702.kind = 24;
NTI314702.base = (&NTI312396);
NTI314702.flags = 2;
NTI314702.marker = TMP4915;
NTI313067.size = sizeof(TY313067);
NTI313067.kind = 18;
NTI313067.base = 0;
NTI313067.flags = 2;
TMP4938[0] = &TMP890[27];
TMP890[27].kind = 1;
TMP890[27].offset = offsetof(TY313067, Field0);
TMP890[27].typ = (&NTI108);
TMP890[27].name = "Field0";
TMP4938[1] = &TMP890[28];
TMP890[28].kind = 1;
TMP890[28].offset = offsetof(TY313067, Field1);
TMP890[28].typ = (&NTI149);
TMP890[28].name = "Field1";
TMP890[26].len = 2; TMP890[26].kind = 2; TMP890[26].sons = &TMP4938[0];
NTI313067.node = &TMP890[26];
NTI313066.size = sizeof(TY313066*);
NTI313066.kind = 24;
NTI313066.base = (&NTI313067);
NTI313066.flags = 2;
NTI313066.marker = TMP4939;
}

