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

#include <string.h>

#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Tcell46346 Tcell46346;
typedef struct TNimType TNimType;
typedef struct Tcellseq46362 Tcellseq46362;
typedef struct Tgcheap48216 Tgcheap48216;
typedef struct Tcellset46358 Tcellset46358;
typedef struct Tpagedesc46354 Tpagedesc46354;
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 Trstgenerator312016 Trstgenerator312016;
typedef struct Trstnode297011 Trstnode297011;
typedef struct Trstnodeseq297009 Trstnodeseq297009;
typedef struct TNimObject TNimObject;
typedef struct TNimNode TNimNode;
typedef struct Stringtableobj136012 Stringtableobj136012;
typedef struct TY312034 TY312034;
typedef struct Table312052 Table312052;
typedef struct Keyvaluepairseq312055 Keyvaluepairseq312055;
typedef struct Ttocentry312012 Ttocentry312012;
typedef struct Codeblockparams312020 Codeblockparams312020;
typedef struct Keyvaluepair136008 Keyvaluepair136008;
typedef struct Tgeneraltokenizer306023 Tgeneraltokenizer306023;
typedef struct TY118789 TY118789;
typedef struct TY315699 TY315699;
typedef struct TY123008 TY123008;
typedef struct TY315702 TY315702;
typedef struct Tindexentry313396 Tindexentry313396;
typedef struct Table313409 Table313409;
typedef struct Keyvaluepairseq313412 Keyvaluepairseq313412;
typedef struct Twin32finddata105219 Twin32finddata105219;
typedef struct Tfiletime104248 Tfiletime104248;
typedef struct Keyvaluepair313415 Keyvaluepair313415;
typedef struct TY314066 TY314066;
typedef struct TY314067 TY314067;
typedef struct Slice87574 Slice87574;
typedef struct Tbasechunk27438 Tbasechunk27438;
typedef struct Tfreecell27430 Tfreecell27430;
typedef struct Keyvaluepairseq136010 Keyvaluepairseq136010;
typedef struct Keyvaluepair312058 Keyvaluepair312058;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Tcell46346  {
NI refcount;
TNimType* typ;
};
struct  Tcellseq46362  {
NI len;
NI cap;
Tcell46346** d;
};
struct  Tcellset46358  {
NI counter;
NI max;
Tpagedesc46354* head;
Tpagedesc46354** 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;
Tcellseq46362 zct;
Tcellseq46362 decstack;
Tcellset46358 cycleroots;
Tcellseq46362 tempstack;
NI recgclock;
Tmemregion28210 region;
Tgcstat48214 stat;
};
struct  Trstnode297011  {
NU8 kind;
NimStringDesc* text;
NI level;
Trstnodeseq297009* 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*, Tfindfilehandler298023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, Tmsghandler298021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
typedef NimStringDesc* TY312042[5];
struct  Table312052  {
Keyvaluepairseq312055* data;
NI counter;
};
struct  Trstgenerator312016  {
  TNimObject Sup;
NU8 target;
Stringtableobj136012* config;
NI splitafter;
TY312034* tocpart;
NIM_BOOL hastoc;
NimStringDesc* theindex;
NU8 options;
Tfindfilehandler298023 findfile;
Tmsghandler298021 msghandler;
NimStringDesc* filename;
TY312042 meta;
NimStringDesc* currentsection;
Table312052 seenindexterms;
};
struct  Ttocentry312012  {
Trstnode297011* n;
NimStringDesc* refname;
NimStringDesc* header;
};
typedef NimStringDesc* TY165825[4];
typedef NimStringDesc* TY165566[1];
typedef NimStringDesc* TY155943[2];
typedef NU8 TY179407[32];
struct  Codeblockparams312020  {
NIM_BOOL numberlines;
NI startline;
NimStringDesc* langstr;
NU8 lang;
};
struct Keyvaluepair136008 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
typedef NimStringDesc* TY219714[1];
struct  Tgeneraltokenizer306023  {
  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* TY306082[33];
struct TY118789 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  Tindexentry313396  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
struct  Table313409  {
Keyvaluepairseq313412* data;
NI counter;
};
struct TY315699 {
TY123008* Field0;
TY315702* Field1;
Table313409 Field2;
};
struct  Tfiletime104248  {
NI32 dwlowdatetime;
NI32 dwhighdatetime;
};
typedef NI16 TY105228[260];
typedef NI16 TY105232[14];
struct  Twin32finddata105219  {
NI32 dwfileattributes;
Tfiletime104248 ftcreationtime;
Tfiletime104248 ftlastaccesstime;
Tfiletime104248 ftlastwritetime;
NI32 nfilesizehigh;
NI32 nfilesizelow;
NI32 dwreserved0;
NI32 dwreserved1;
TY105228 cfilename;
TY105232 calternatefilename;
};
typedef N_STDCALL_PTR(NI32, TY105245) (NI hfindfile, Twin32finddata105219* lpfindfiledata);
typedef N_STDCALL_PTR(void, TY105405) (NI hfindfile);
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (NimStringDesc* x_316310, NimStringDesc* y_316312, void* ClEnv);
void* ClEnv;
} TY316308;
typedef N_CLOSURE_PTR(NI, TMP4922) (NimStringDesc* x_316297, NimStringDesc* y_316299, void* ClEnv);
struct Keyvaluepair313415 {
NI Field0;
Tindexentry313396 Field1;
TY315702* Field2;
};
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Tindexentry313396 x_314696, Tindexentry313396 y_314698, void* ClEnv);
void* ClEnv;
} TY314694;
typedef N_CLOSURE_PTR(NI, TMP4926) (Tindexentry313396 x_315527, Tindexentry313396 y_315529, void* ClEnv);
typedef N_CLOSURE_PTR(NI, TMP4936) (Tindexentry313396 x_314683, Tindexentry313396 y_314685, void* ClEnv);
struct TY314067 {
NI Field0;
NimStringDesc* Field1;
};
struct  Slice87574  {
NI a;
NI b;
};
typedef NimStringDesc* TY177061[3];
typedef NI TY27420[16];
struct  Tpagedesc46354  {
Tpagedesc46354* 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  Stringtableobj136012  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq136010* data;
NU8 mode;
};
struct Keyvaluepair312058 {
NI Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  Tfreecell27430  {
Tfreecell27430* next;
NI zerofield;
};
struct TY312034 {
  TGenericSeq Sup;
  Ttocentry312012 data[SEQ_DECL_SIZE];
};
struct Trstnodeseq297009 {
  TGenericSeq Sup;
  Trstnode297011* data[SEQ_DECL_SIZE];
};
struct TY123008 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct TY315702 {
  TGenericSeq Sup;
  Tindexentry313396 data[SEQ_DECL_SIZE];
};
struct TY314066 {
  TGenericSeq Sup;
  TY314067 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq312055 {
  TGenericSeq Sup;
  Keyvaluepair312058 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq313412 {
  TGenericSeq Sup;
  Keyvaluepair313415 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq136010 {
  TGenericSeq Sup;
  Keyvaluepair136008 data[SEQ_DECL_SIZE];
};
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Tcell46346*, usrtocell_49846)(void* usr);
static N_INLINE(void, rtladdzct_51404)(Tcell46346* c);
N_NOINLINE(void, addzct_49817)(Tcellseq46362* s, Tcell46346* c);
N_NIMCALL(void, renderaux_312734)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(NI, len_297084)(Trstnode297011* n);
N_NIMCALL(void, renderrsttoout_312724)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(void, renderheadline_317861)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, rstnodetorefname_298061)(Trstnode297011* 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_312689)(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_312855)(Trstgenerator312016* 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_312835)(NimStringDesc* text);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(void, insert_89201)(NimStringDesc** x, NimStringDesc* item, NI i);
N_NIMCALL(NimStringDesc*, striptochtml_317841)(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_318045)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(void, renderaux_312776)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result);
N_NIMCALL(void, renderfield_319716)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, addnodes_298067)(Trstnode297011* n);
N_NIMCALL(NimStringDesc*, esc_312553)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NI, nextsplitpoint_312506)(NimStringDesc* s, NI start);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(void, escchar_312494)(NU8 target, NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addxmlchar_312456)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addtexchar_312478)(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_88157)(NimStringDesc* msg);
N_NIMCALL(NimStringDesc*, texcolumns_319676)(Trstnode297011* n);
N_NIMCALL(Trstnode297011*, lastson_297147)(Trstnode297011* n);
N_NIMCALL(void, renderimage_318213)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, getfieldvalue_298073)(Trstnode297011* n, NimStringDesc* fieldname);
N_NIMCALL(NIM_BOOL, allcharsinset_99459)(NimStringDesc* s, TY179407 theset);
N_NIMCALL(NimStringDesc*, dispf_312666)(NU8 target, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getargument_298080)(Trstnode297011* n);
N_NIMCALL(void, rendercodeblock_319233)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(void, parsecodeblockparams_318508)(Trstgenerator312016* d, Trstnode297011* n, Codeblockparams312020* Result);
N_NIMCALL(void, init_312078)(Codeblockparams312020* p);
N_NIMCALL(void, parsecodeblockfield_318493)(Trstgenerator312016* d, Trstnode297011* n, Codeblockparams312020* params);
N_NIMCALL(NimStringDesc*, nsuToLowerStr)(NimStringDesc* s);
N_NIMCALL(NI, npuParseInt)(NimStringDesc* s, NI* number, NI start);
N_NIMCALL(NimStringDesc*, getfieldvalue_301310)(Trstnode297011* n);
N_NIMCALL(NU8, getsourcelanguage_306093)(NimStringDesc* name);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, buildlineshtmltable_319035)(Codeblockparams312020 params, NimStringDesc* code, Keyvaluepair136008* Result);
N_NIMCALL(NI, nsuCountLines)(NimStringDesc* s);
N_NIMCALL(void, initgeneraltokenizer_306289)(Tgeneraltokenizer306023* g, NimStringDesc* buf);
N_NIMCALL(void, getnexttoken_308766)(Tgeneraltokenizer306023* 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_306300)(Tgeneraltokenizer306023* g);
N_NIMCALL(void, rendercontainer_319657)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(void, renderindexterm_313066)(Trstgenerator312016* d, Trstnode297011* n_313069, NimStringDesc** result);
N_NIMCALL(NIM_BOOL, haskey_313074)(Table312052 t, NimStringDesc* key);
N_NIMCALL(void, HEX5BHEX5DHEX3D_313148)(Table312052* t, NimStringDesc* key, NI val);
N_NIMCALL(NI, HEX5BHEX5D_313117)(Table312052 t, NimStringDesc* key);
N_NIMCALL(void, rendersmiley_318479)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, nstGet)(Stringtableobj136012* 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, TY118789* Result);
N_NIMCALL(void, inittable_312116)(NI initialsize, Table312052* Result);
N_NIMCALL(NI, nsuParseInt)(NimStringDesc* s);
N_NIMCALL(void, rendertocentry_318162)(Trstgenerator312016* d, Ttocentry312012 e, NimStringDesc** result);
N_NIMCALL(void, rendertocentries_318176)(Trstgenerator312016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, writefile_13437)(NimStringDesc* filename, NimStringDesc* content);
N_NIMCALL(void, readindexdir_315696)(NimStringDesc* dir, TY315699* Result);
N_NIMCALL(void, inittable_315724)(NI initialsize, Table313409* Result);
N_NIMCALL(void, TMP4915)(void* p, NI op);
N_NIMCALL(NI, findfirstfile_115416)(NimStringDesc* a, Twin32finddata105219* b);
N_NIMCALL(NimStringDesc*, HEX2F_118492)(NimStringDesc* head, NimStringDesc* tail);
static N_INLINE(NIM_BOOL, skipfinddata_115436)(Twin32finddata105219* f);
N_NIMCALL(NimStringDesc*, HEX24_80989)(NI16* s);
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_313971)(NimStringDesc* hyperlink);
N_NIMCALL(TY123008*, nsuSplitChar)(NimStringDesc* s, NIM_CHAR sep);
N_NIMCALL(NimStringDesc*, unquoteindexcolumn_312845)(NimStringDesc* text);
N_NIMCALL(TGenericSeq*, incrSeq)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(NI, len_316060)(Table313409 t);
N_NIMCALL(void, HEX5BHEX5DHEX3D_316072)(Table313409* t, Tindexentry313396 key, TY315702* val);
static N_INLINE(NI, HEX21HEX26_133025)(NI h, NI val);
N_NIMCALL(NI, hash_133839)(NimStringDesc* x);
static N_INLINE(NimStringDesc*, or_312713)(NimStringDesc* x, NimStringDesc* y);
static N_INLINE(NI, HEX21HEX24_133054)(NI h);
N_NIMCALL(void, sort_316301)(NimStringDesc** a, NI aLen0, TY316308 cmp, NU8 order);
N_NIMCALL(NI, cmp_4717)(NimStringDesc* x, NimStringDesc* y);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_83004, TNimType* mt);
N_NIMCALL(NimStringDesc*, generatedocumentationjumps_315392)(Table313409 docs);
static N_INLINE(NIM_BOOL, isfilled_157211)(NI hcode);
N_NIMCALL(void, sort_314687)(Tindexentry313396* a, NI aLen0, TY314694 cmp, NU8 order);
N_NIMCALL(NI, cmp_313430)(Tindexentry313396 a, Tindexentry313396 b);
N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen0, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, generatemodulejumps_315631)(TY123008* modules);
N_NIMCALL(NimStringDesc*, generatedocumentationindex_314431)(Table313409 docs);
N_NIMCALL(NimStringDesc*, generatedocumentationtoc_314060)(TY315702* entries);
N_NIMCALL(void, TMP4938)(void* p, NI op);
N_NIMCALL(void, striptoclevel_313981)(NimStringDesc* s, TY314067* Result);
static N_INLINE(NimStringDesc*, HEX5BHEX5D_87567)(NimStringDesc* s, Slice87574 x);
static N_INLINE(Slice87574, HEX2EHEX2E_109273)(NI a, NI b);
N_NIMCALL(NimStringDesc*, indenttolevel_314048)(NI* level, NI newlevel);
N_NIMCALL(NimStringDesc*, nsuRepeatStr)(NimStringDesc* s, NI n);
N_NIMCALL(TY315702*, HEX5BHEX5D_315282)(Table313409 t, Tindexentry313396 key);
N_NIMCALL(void, sortindex_313818)(Tindexentry313396* a, NI aLen0);
N_NIMCALL(void, HEX3CHEX2D_313807)(Tindexentry313396* a, Tindexentry313396 b);
N_NIMCALL(NimStringDesc*, generatesymbolindex_313895)(TY315702* symbols);
STRING_LITERAL(TMP900, "<wbr />", 7);
STRING_LITERAL(TMP2097, "", 0);
STRING_LITERAL(TMP2099, "-", 1);
STRING_LITERAL(TMP2100, "\015\012<h$1><a class=\"toc-backref\" id=\"$2\" href=\"#$2\">$3</a></h$1>", 61);
STRING_LITERAL(TMP2101, "\\rsth$4{$3}\\label{$2}\015\012", 23);
STRING_LITERAL(TMP2102, "\015\012<h$1 id=\"$2\">$3</h$1>", 23);
STRING_LITERAL(TMP2103, "html", 4);
STRING_LITERAL(TMP2104, "\\", 1);
STRING_LITERAL(TMP2105, "\\\\", 2);
STRING_LITERAL(TMP2106, "\015\012", 2);
STRING_LITERAL(TMP2107, "\\n", 2);
STRING_LITERAL(TMP2108, "\011", 1);
STRING_LITERAL(TMP2109, "\\t", 2);
STRING_LITERAL(TMP2110, "<h$1 id=\"$2\"><center>$3</center></h$1>", 38);
STRING_LITERAL(TMP2111, "\\rstov$4{$3}\\label{$2}\015\012", 24);
STRING_LITERAL(TMP2112, "<hr />\015\012", 8);
STRING_LITERAL(TMP2113, "\\hrule\015\012", 8);
STRING_LITERAL(TMP2114, "<p>$1</p>\015\012", 11);
STRING_LITERAL(TMP2115, "$1\015\012\015\012", 6);
STRING_LITERAL(TMP2116, "<ul class=\"simple\">$1</ul>\015\012", 28);
STRING_LITERAL(TMP2117, "\\begin{itemize}$1\\end{itemize}\015\012", 32);
STRING_LITERAL(TMP2118, "<li>$1</li>\015\012", 13);
STRING_LITERAL(TMP2119, "\\item $1\015\012", 10);
STRING_LITERAL(TMP2120, "<ol class=\"simple\">$1</ol>\015\012", 28);
STRING_LITERAL(TMP2121, "\\begin{enumerate}$1\\end{enumerate}\015\012", 36);
STRING_LITERAL(TMP2122, "<dl class=\"docutils\">$1</dl>\015\012", 30);
STRING_LITERAL(TMP2123, "\\begin{description}$1\\end{description}\015\012", 40);
STRING_LITERAL(TMP2124, "<dt>$1</dt>\015\012", 13);
STRING_LITERAL(TMP2125, "\\item[$1] ", 10);
STRING_LITERAL(TMP2126, "<dd>$1</dd>\015\012", 13);
STRING_LITERAL(TMP2127, "$1\015\012", 4);
STRING_LITERAL(TMP2128, "<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(TMP2129, " ", 1);
STRING_LITERAL(TMP2130, "&amp;", 5);
STRING_LITERAL(TMP2131, "&lt;", 4);
STRING_LITERAL(TMP2132, "&gt;", 4);
STRING_LITERAL(TMP2133, "&quot;", 6);
STRING_LITERAL(TMP2134, "\\_", 2);
STRING_LITERAL(TMP2135, "\\symbol{123}", 12);
STRING_LITERAL(TMP2136, "\\symbol{125}", 12);
STRING_LITERAL(TMP2137, "\\symbol{91}", 11);
STRING_LITERAL(TMP2138, "\\symbol{93}", 11);
STRING_LITERAL(TMP2139, "\\symbol{92}", 11);
STRING_LITERAL(TMP2140, "\\$", 2);
STRING_LITERAL(TMP2141, "\\&", 2);
STRING_LITERAL(TMP2142, "\\#", 2);
STRING_LITERAL(TMP2143, "\\%", 2);
STRING_LITERAL(TMP2144, "\\symbol{126}", 12);
STRING_LITERAL(TMP2145, "\\symbol{64}", 11);
STRING_LITERAL(TMP2146, "\\symbol{94}", 11);
STRING_LITERAL(TMP2147, "\\symbol{96}", 11);
STRING_LITERAL(TMP2148, "author", 6);
STRING_LITERAL(TMP2149, "authors", 7);
STRING_LITERAL(TMP2150, "version", 7);
STRING_LITERAL(TMP2151, "<tr>$1</tr>\015\012", 13);
STRING_LITERAL(TMP2152, "$1", 2);
STRING_LITERAL(TMP2153, "<th class=\"docinfo-name\">$1:</th>", 33);
STRING_LITERAL(TMP2154, "\\item[$1:]", 10);
STRING_LITERAL(TMP2155, "<td>$1</td>", 11);
STRING_LITERAL(TMP2156, " $1\015\012", 5);
STRING_LITERAL(TMP2157, "<table frame=\"void\">$1</table>", 30);
STRING_LITERAL(TMP2158, "\\begin{description}\015\012$1\\end{description}\015\012", 42);
STRING_LITERAL(TMP2159, "<th align=\"left\">$1</th>", 24);
STRING_LITERAL(TMP2160, "\\item[$1]", 9);
STRING_LITERAL(TMP2161, "<td align=\"left\">$1</td>\015\012", 26);
STRING_LITERAL(TMP2163, "false renderRstToOut", 20);
STRING_LITERAL(TMP2164, "<pre>$1</pre>\015\012", 15);
STRING_LITERAL(TMP2165, "\\begin{rstpre}\015\012$1\015\012\\end{rstpre}\015\012", 34);
STRING_LITERAL(TMP2166, "<p>$1</p>", 9);
STRING_LITERAL(TMP2167, "$1<br />", 8);
STRING_LITERAL(TMP2168, "$1\\\\\015\012", 6);
STRING_LITERAL(TMP2169, "<blockquote><p>$1</p></blockquote>\015\012", 36);
STRING_LITERAL(TMP2170, "\\begin{quote}$1\\end{quote}\015\012", 28);
STRING_LITERAL(TMP2171, "<table border=\"1\" class=\"docutils\">$1</table>", 45);
STRING_LITERAL(TMP2172, "\\begin{table}\\begin{rsttab}{", 28);
STRING_LITERAL(TMP2173, "|X", 2);
STRING_LITERAL(TMP2174, "|}\015\012\\hline\015\012$1\\end{rsttab}\\end{table}", 37);
STRING_LITERAL(TMP2175, " & ", 3);
STRING_LITERAL(TMP2176, "\\\\\015\012\\hline\015\012", 12);
STRING_LITERAL(TMP2177, "<tr>", 4);
STRING_LITERAL(TMP2178, "</tr>\015\012", 7);
STRING_LITERAL(TMP2179, "<th>$1</th>", 11);
STRING_LITERAL(TMP2180, "\\textbf{$1}", 11);
STRING_LITERAL(TMP2181, "<a class=\"reference external\" href=\"#$2\">$1</a>", 47);
STRING_LITERAL(TMP2182, "$1\\ref{$2}", 10);
STRING_LITERAL(TMP2183, "<a class=\"reference external\" href=\"$1\">$1</a>", 46);
STRING_LITERAL(TMP2184, "\\href{$1}{$1}", 13);
STRING_LITERAL(TMP2185, "<a class=\"reference external\" href=\"$2\">$1</a>", 46);
STRING_LITERAL(TMP2186, "\\href{$2}{$1}", 13);
STRING_LITERAL(TMP2188, "scale", 5);
static NIM_CONST TY179407 TMP2189 = {
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(TMP2190, " scale=\"$1\"", 11);
STRING_LITERAL(TMP2191, " scale=$1", 9);
STRING_LITERAL(TMP2192, "height", 6);
STRING_LITERAL(TMP2193, " height=\"$1\"", 12);
STRING_LITERAL(TMP2194, " height=$1", 10);
STRING_LITERAL(TMP2195, "width", 5);
STRING_LITERAL(TMP2196, " width=\"$1\"", 11);
STRING_LITERAL(TMP2197, " width=$1", 9);
STRING_LITERAL(TMP2198, "alt", 3);
STRING_LITERAL(TMP2199, " alt=\"$1\"", 9);
STRING_LITERAL(TMP2200, "align", 5);
STRING_LITERAL(TMP2201, " align=\"$1\"", 11);
STRING_LITERAL(TMP2202, "[$1]", 4);
STRING_LITERAL(TMP2203, "<img src=\"$1\"$2 />", 18);
STRING_LITERAL(TMP2204, "\\includegraphics$2{$1}", 22);
STRING_LITERAL(TMP2205, "number-lines", 12);
STRING_LITERAL(TMP2206, "file", 4);
STRING_LITERAL(TMP2207, "default-language", 16);
STRING_LITERAL(TMP2216, "<pre>", 5);
STRING_LITERAL(TMP2217, "</pre>", 6);
NIM_CONST Keyvaluepair136008 TMP2215 = {((NimStringDesc*) &TMP2216),
((NimStringDesc*) &TMP2217)}
;
STRING_LITERAL(TMP2218, "<table class=\"line-nums-table\"><tbody><tr><td class=\"blob-line-"
"nums\"><pre>", 74);
STRING_LITERAL(TMP2219, "</pre></td><td><pre>", 20);
STRING_LITERAL(TMP2220, "</pre></td></tr></tbody></table>", 32);
STRING_LITERAL(TMP2221, "\\begin{rstpre}\015\012", 16);
STRING_LITERAL(TMP2383, "<span class=\"$2\">$1</span>", 26);
STRING_LITERAL(TMP2384, "\\span$2{$1}", 11);
extern NIM_CONST TY306082 tokenclasstostr_306081;
STRING_LITERAL(TMP2418, "\015\012\\end{rstpre}\015\012", 16);
STRING_LITERAL(TMP2419, "<div>$1</div>", 13);
STRING_LITERAL(TMP2420, "<div class=\"$1\">$2</div>", 24);
STRING_LITERAL(TMP2421, "$2", 2);
STRING_LITERAL(TMP2422, "|$1|", 4);
STRING_LITERAL(TMP2423, "<sub>$1</sub>", 13);
STRING_LITERAL(TMP2424, "\\rstsub{$1}", 11);
STRING_LITERAL(TMP2425, "<sup>$1</sup>", 13);
STRING_LITERAL(TMP2426, "\\rstsup{$1}", 11);
STRING_LITERAL(TMP2427, "<em>$1</em>", 11);
STRING_LITERAL(TMP2428, "\\emph{$1}", 9);
STRING_LITERAL(TMP2429, "<strong>$1</strong>", 19);
STRING_LITERAL(TMP2430, "<strong><em>$1</em></strong>", 28);
STRING_LITERAL(TMP2431, "\\textbf{emph{$1}}", 17);
STRING_LITERAL(TMP2432, "<cite>$1</cite>", 15);
STRING_LITERAL(TMP2435, "<span id=\"$1\">$2</span>", 23);
STRING_LITERAL(TMP2436, "$2\\label{$1}", 12);
STRING_LITERAL(TMP2437, "<tt class=\"docutils literal\"><span class=\"pre\">$1</span></tt>", 61);
STRING_LITERAL(TMP2438, "\\texttt{$1}", 11);
STRING_LITERAL(TMP2439, "<img src=\"$1\" width=\"15\"\015\012        height=\"17\" hspace=\"2\" vspace"
"=\"2\" class=\"smiley\" />", 85);
STRING_LITERAL(TMP2440, "\\includegraphics{$1}", 20);
STRING_LITERAL(TMP2441, "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>\015\012", 61);
STRING_LITERAL(TMP4844, "\\item\\label{$1_toc} $2\\ref{$1}\015\012", 32);
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, ".idx", 4);
STRING_LITERAL(TMP4919, "doc_toc_", 8);
STRING_LITERAL(TMP4923, "Documents: ", 11);
STRING_LITERAL(TMP4927, "<a href=\"", 9);
STRING_LITERAL(TMP4928, "\">", 2);
STRING_LITERAL(TMP4929, "</a>", 4);
STRING_LITERAL(TMP4930, ", ", 2);
STRING_LITERAL(TMP4931, ".<br>", 5);
STRING_LITERAL(TMP4932, "<p />", 5);
STRING_LITERAL(TMP4933, "Modules: ", 9);
STRING_LITERAL(TMP4934, ".html\">", 7);
STRING_LITERAL(TMP4935, "<h2>Documentation files</h2>\015\012", 30);
STRING_LITERAL(TMP4939, "<ul>\015\012", 6);
STRING_LITERAL(TMP4940, "<ul>", 4);
STRING_LITERAL(TMP4941, "</ul>", 5);
STRING_LITERAL(TMP4942, "<li><a href=\"", 13);
STRING_LITERAL(TMP4943, "</a>\015\012", 6);
STRING_LITERAL(TMP4944, "</ul>\015\012", 7);
STRING_LITERAL(TMP4945, "<ul><li><a href=\"", 17);
STRING_LITERAL(TMP4946, "<h2>API symbols</h2>\015\012", 22);
STRING_LITERAL(TMP4947, "<dt><a name=\"$2\" href=\"#$2\"><span>$1:</span></a></dt><ul class="
"\"simple\"><dd>\015\012", 78);
STRING_LITERAL(TMP4948, "<li><a class=\"reference external\"\015\012          title=\"$3\" href=\"$"
"1\">$2</a></li>\015\012          ", 89);
STRING_LITERAL(TMP4949, "<li><a class=\"reference external\" href=\"$1\">$2</a></li>\015\012      "
"    ", 67);
STRING_LITERAL(TMP4950, "</ul></dd>\015\012", 12);
NimStringDesc* splitter_312489;
extern Tgcheap48216 gch_48244;
extern TNimType NTI306023; /* TGeneralTokenizer */
extern TNimType NTI3411; /* RootObj */
TNimType NTI312016; /* TRstGenerator */
TNimType NTI312010; /* TOutputTarget */
extern TNimType NTI136014; /* StringTableRef */
extern TNimType NTI108; /* int */
TNimType NTI312012; /* TTocEntry */
extern TNimType NTI297007; /* PRstNode */
extern TNimType NTI149; /* string */
TNimType NTI312034; /* seq[TTocEntry] */
extern TNimType NTI138; /* bool */
extern TNimType NTI298015; /* TRstParseOptions */
extern TNimType NTI298023; /* TFindFileHandler */
extern TNimType NTI298021; /* TMsgHandler */
TNimType NTI312042; /* array[TMetaEnum, string] */
extern TNimType NTI312052; /* Table */
extern TNimType NTI123008; /* seq[string] */
TNimType NTI313396; /* TIndexEntry */
TNimType NTI315702; /* seq[TIndexEntry] */
extern TY105245 Dl_105244;
extern TY105405 Dl_105404;
extern TNimType NTI313412; /* KeyValuePairSeq */
TNimType NTI314067; /* tuple[level: int, text: string] */
TNimType NTI314066; /* seq[tuple[level: int, text: string]] */

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

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

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

N_NIMCALL(void, renderaux_312734)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	{
		NI i_312752;
		NI HEX3Atmp_312754;
		NI LOC2;
		NI res_312757;
		i_312752 = 0;
		HEX3Atmp_312754 = 0;
		LOC2 = 0;
		LOC2 = len_297084(n);
		HEX3Atmp_312754 = (NI)(LOC2 - ((NI) 1));
		res_312757 = ((NI) 0);
		{
			while (1) {
				if (!(res_312757 <= HEX3Atmp_312754)) goto LA4;
				i_312752 = res_312757;
				renderrsttoout_312724(d, (*n).sons->data[i_312752], result);
				res_312757 += ((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) {
	{
		Tcell46346* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_49846(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Tcell46346* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_49846((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_51404(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, dispa_312689)(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_312835)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2104), ((NimStringDesc*) &TMP2105));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2106), ((NimStringDesc*) &TMP2107));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2108), ((NimStringDesc*) &TMP2109));
	return result;
}

N_NIMCALL(void, setindexterm_312855)(Trstgenerator312016* 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*) &TMP2103));
	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_312835(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_312835(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, 2);
appendString(entry, ((NimStringDesc*) &TMP2106));
	{
		if (!istitle) goto LA19;
		insert_89201((&(*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_317841)(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_317861)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* sectionprefix;
	NimStringDesc* refname;
	NimStringDesc* LOC14;
	NimStringDesc* LOC15;
	NimStringDesc* LOC25;
	NimStringDesc* LOC26;
	NimStringDesc* LOC27;
	tmp = copyString(((NimStringDesc*) &TMP2097));
	{
		NI i_317880;
		NI HEX3Atmp_318006;
		NI LOC2;
		NI res_318009;
		i_317880 = 0;
		HEX3Atmp_318006 = 0;
		LOC2 = 0;
		LOC2 = len_297084(n);
		HEX3Atmp_318006 = (NI)(LOC2 - ((NI) 1));
		res_318009 = ((NI) 0);
		{
			while (1) {
				if (!(res_318009 <= HEX3Atmp_318006)) goto LA4;
				i_317880 = res_318009;
				renderrsttoout_312724(d, (*n).sons->data[i_317880], (&tmp));
				res_318009 += ((NI) 1);
			} LA4: ;
		}
	}
	unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
	sectionprefix = copyString(((NimStringDesc*) &TMP2097));
	{
		NI i_317894;
		NI HEX3Atmp_318014;
		NI res_318017;
		i_317894 = 0;
		HEX3Atmp_318014 = 0;
		HEX3Atmp_318014 = ((*d).tocpart ? ((*d).tocpart->Sup.len-1) : -1);
		res_318017 = HEX3Atmp_318014;
		{
			while (1) {
				Trstnode297011* n2;
				if (!(((NI) 0) <= res_318017)) goto LA7;
				i_317894 = res_318017;
				n2 = (*d).tocpart->data[i_317894].n;
				{
					NimStringDesc* LOC12;
					NimStringDesc* LOC13;
					if (!((*n2).level < (*n).level)) goto LA10;
					LOC12 = 0;
					LOC13 = 0;
					LOC13 = rstnodetorefname_298061(n2);
					LOC12 = rawNewString(LOC13->Sup.len + 1);
appendString(LOC12, LOC13);
appendString(LOC12, ((NimStringDesc*) &TMP2099));
					sectionprefix = LOC12;
					goto LA5;
				}
				LA10: ;
				res_318017 -= ((NI) 1);
			} LA7: ;
		}
	} LA5: ;
	LOC14 = 0;
	LOC15 = 0;
	LOC15 = rstnodetorefname_298061(n);
	LOC14 = rawNewString(sectionprefix->Sup.len + LOC15->Sup.len + 0);
appendString(LOC14, sectionprefix);
appendString(LOC14, LOC15);
	refname = LOC14;
	{
		NI length;
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		TY165825 LOC22;
		if (!(*d).hastoc) goto LA18;
		length = ((*d).tocpart ? (*d).tocpart->Sup.len : 0);
		(*d).tocpart = (TY312034*) setLengthSeq(&((*d).tocpart)->Sup, sizeof(Ttocentry312012), ((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_312689((*d).target, result, ((NimStringDesc*) &TMP2100), ((NimStringDesc*) &TMP2101), LOC22, 4);
	}
	goto LA16;
	LA18: ;
	{
		TY165825 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_312689((*d).target, result, ((NimStringDesc*) &TMP2102), ((NimStringDesc*) &TMP2101), LOC24, 4);
	}
	LA16: ;
	LOC25 = 0;
	LOC25 = striptochtml_317841(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_312855(d, refname, LOC25, LOC26, ((NimStringDesc*) &TMP2097));
}

N_NIMCALL(void, renderoverline_318045)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	{
		if (!(((*d).meta[(((NU8) 1))- 0] ? (*d).meta[(((NU8) 1))- 0]->Sup.len : 0) == ((NI) 0))) goto LA3;
		{
			NI i_318063;
			NI HEX3Atmp_318106;
			NI LOC6;
			NI res_318109;
			i_318063 = 0;
			HEX3Atmp_318106 = 0;
			LOC6 = 0;
			LOC6 = len_297084(n);
			HEX3Atmp_318106 = (NI)(LOC6 - ((NI) 1));
			res_318109 = ((NI) 0);
			{
				while (1) {
					if (!(res_318109 <= HEX3Atmp_318106)) goto LA8;
					i_318063 = res_318109;
					renderrsttoout_312724(d, (*n).sons->data[i_318063], (&(*d).meta[(((NU8) 1))- 0]));
					res_318109 += ((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_318077;
			NI HEX3Atmp_318114;
			NI LOC13;
			NI res_318117;
			i_318077 = 0;
			HEX3Atmp_318114 = 0;
			LOC13 = 0;
			LOC13 = len_297084(n);
			HEX3Atmp_318114 = (NI)(LOC13 - ((NI) 1));
			res_318117 = ((NI) 0);
			{
				while (1) {
					if (!(res_318117 <= HEX3Atmp_318114)) goto LA15;
					i_318077 = res_318117;
					renderrsttoout_312724(d, (*n).sons->data[i_318077], (&(*d).meta[(((NU8) 2))- 0]));
					res_318117 += ((NI) 1);
				} LA15: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString((*d).meta[(((NU8) 2))- 0]));
	}
	goto LA1;
	LA10: ;
	{
		NimStringDesc* tmp;
		TY165825 LOC21;
		tmp = copyString(((NimStringDesc*) &TMP2097));
		{
			NI i_318092;
			NI HEX3Atmp_318122;
			NI LOC18;
			NI res_318125;
			i_318092 = 0;
			HEX3Atmp_318122 = 0;
			LOC18 = 0;
			LOC18 = len_297084(n);
			HEX3Atmp_318122 = (NI)(LOC18 - ((NI) 1));
			res_318125 = ((NI) 0);
			{
				while (1) {
					if (!(res_318125 <= HEX3Atmp_318122)) goto LA20;
					i_318092 = res_318125;
					renderrsttoout_312724(d, (*n).sons->data[i_318092], (&tmp));
					res_318125 += ((NI) 1);
				} LA20: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nimIntToStr((*n).level);
		LOC21[1] = rstnodetorefname_298061(n);
		LOC21[2] = copyString(tmp);
		LOC21[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2110), ((NimStringDesc*) &TMP2111), LOC21, 4);
	}
	LA1: ;
}

N_NIMCALL(void, renderaux_312776)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2097));
	{
		NI i_312797;
		NI HEX3Atmp_312813;
		NI LOC2;
		NI res_312816;
		i_312797 = 0;
		HEX3Atmp_312813 = 0;
		LOC2 = 0;
		LOC2 = len_297084(n);
		HEX3Atmp_312813 = (NI)(LOC2 - ((NI) 1));
		res_312816 = ((NI) 0);
		{
			while (1) {
				if (!(res_312816 <= HEX3Atmp_312813)) goto LA4;
				i_312797 = res_312816;
				renderrsttoout_312724(d, (*n).sons->data[i_312797], (&tmp));
				res_312816 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		TY165566 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: ;
	{
		TY165566 LOC11;
		memset((void*)LOC11, 0, sizeof(LOC11));
		LOC11[0] = copyString(tmp);
		nsuAddf(result, frmtb, LOC11, 1);
	}
	LA5: ;
}

N_NIMCALL(NI, nextsplitpoint_312506)(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_312456)(NimStringDesc** dest, NIM_CHAR c) {
	switch (((NU8)(c))) {
	case 38:
	{
		(*dest) = resizeString((*dest), 5);
appendString((*dest), ((NimStringDesc*) &TMP2130));
	}
	break;
	case 60:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2131));
	}
	break;
	case 62:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2132));
	}
	break;
	case 34:
	{
		(*dest) = resizeString((*dest), 6);
appendString((*dest), ((NimStringDesc*) &TMP2133));
	}
	break;
	default:
	{
		(*dest) = addChar((*dest), c);
	}
	break;
	}
}

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

static N_INLINE(void, escchar_312494)(NU8 target, NimStringDesc** dest, NIM_CHAR c) {
	switch (target) {
	case ((NU8) 0):
	{
		addxmlchar_312456(dest, c);
	}
	break;
	case ((NU8) 1):
	{
		addtexchar_312478(dest, c);
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, esc_312553)(NU8 target, NimStringDesc* s, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2097));
	{
		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_312506(s, j);
				{
					NIM_BOOL LOC9;
					LOC9 = 0;
					LOC9 = !(eqStrings(splitter_312489, ((NimStringDesc*) &TMP2129)));
					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_312489->Sup.len + 0);
appendString(result, splitter_312489);
				}
				LA11: ;
				{
					NI i_312574;
					NI res_312603;
					i_312574 = 0;
					res_312603 = j;
					{
						while (1) {
							if (!(res_312603 <= k)) goto LA15;
							i_312574 = res_312603;
							escchar_312494(target, (&result), s->data[i_312574]);
							res_312603 += ((NI) 1);
						} LA15: ;
					}
				}
				partlen += (NI)((NI)(k - j) + ((NI) 1));
				j = (NI)(k + ((NI) 1));
			} LA6: ;
		}
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_312597;
			NI HEX3Atmp_312608;
			NI res_312611;
			i_312597 = 0;
			HEX3Atmp_312608 = 0;
			HEX3Atmp_312608 = (NI)((s ? s->Sup.len : 0) - ((NI) 1));
			res_312611 = ((NI) 0);
			{
				while (1) {
					if (!(res_312611 <= HEX3Atmp_312608)) goto LA19;
					i_312597 = res_312611;
					escchar_312494(target, (&result), s->data[i_312597]);
					res_312611 += ((NI) 1);
				} LA19: ;
			}
		}
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, renderfield_319716)(Trstgenerator312016* d, Trstnode297011* 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_298067((*n).sons->data[((NI) 0)]);
		LOC5 = 0;
		LOC5 = addnodes_298067((*n).sons->data[((NI) 1)]);
		LOC6 = 0;
		LOC6 = nsuStrip(LOC5, NIM_TRUE, NIM_TRUE);
		fieldval = esc_312553((*d).target, LOC6, ((NI) -1));
		{
			NIM_BOOL LOC9;
			NI LOC10;
			NI LOC12;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2148));
			LOC9 = (LOC10 == ((NI) 0));
			if (LOC9) goto LA11;
			LOC12 = 0;
			LOC12 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2149));
			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*) &TMP2150));
			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_312776(d, n, ((NimStringDesc*) &TMP2151), ((NimStringDesc*) &TMP2152), result);
	}
	LA29: ;
}

N_NIMCALL(NimStringDesc*, texcolumns_319676)(Trstnode297011* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2097));
	{
		NI i_319692;
		NI HEX3Atmp_319694;
		NI res_319697;
		i_319692 = 0;
		HEX3Atmp_319694 = 0;
		HEX3Atmp_319694 = len_297084(n);
		res_319697 = ((NI) 1);
		{
			while (1) {
				if (!(res_319697 <= HEX3Atmp_319694)) goto LA3;
				i_319692 = res_319697;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP2173));
				res_319697 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(NimStringDesc*, dispf_312666)(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_318213)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	NimStringDesc* options;
	NimStringDesc* s;
	NimStringDesc* arg;
	options = copyString(((NimStringDesc*) &TMP2097));
	s = getfieldvalue_298073(n, ((NimStringDesc*) &TMP2188));
	{
		NIM_BOOL LOC3;
		TY165566 LOC7;
		LOC3 = 0;
		LOC3 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = allcharsinset_99459(s, TMP2189);
		LA4: ;
		if (!LOC3) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_312689((*d).target, (&options), ((NimStringDesc*) &TMP2190), ((NimStringDesc*) &TMP2191), LOC7, 1);
	}
	LA5: ;
	s = getfieldvalue_298073(n, ((NimStringDesc*) &TMP2192));
	{
		NIM_BOOL LOC10;
		TY165566 LOC14;
		LOC10 = 0;
		LOC10 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC10)) goto LA11;
		LOC10 = allcharsinset_99459(s, TMP2189);
		LA11: ;
		if (!LOC10) goto LA12;
		memset((void*)LOC14, 0, sizeof(LOC14));
		LOC14[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_312689((*d).target, (&options), ((NimStringDesc*) &TMP2193), ((NimStringDesc*) &TMP2194), LOC14, 1);
	}
	LA12: ;
	s = getfieldvalue_298073(n, ((NimStringDesc*) &TMP2195));
	{
		NIM_BOOL LOC17;
		TY165566 LOC21;
		LOC17 = 0;
		LOC17 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC17)) goto LA18;
		LOC17 = allcharsinset_99459(s, TMP2189);
		LA18: ;
		if (!LOC17) goto LA19;
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_312689((*d).target, (&options), ((NimStringDesc*) &TMP2196), ((NimStringDesc*) &TMP2197), LOC21, 1);
	}
	LA19: ;
	s = getfieldvalue_298073(n, ((NimStringDesc*) &TMP2198));
	{
		NIM_BOOL LOC24;
		TY165566 LOC28;
		LOC24 = 0;
		LOC24 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC24)) goto LA25;
		LOC24 = allcharsinset_99459(s, TMP2189);
		LA25: ;
		if (!LOC24) goto LA26;
		memset((void*)LOC28, 0, sizeof(LOC28));
		LOC28[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_312689((*d).target, (&options), ((NimStringDesc*) &TMP2199), ((NimStringDesc*) &TMP2097), LOC28, 1);
	}
	LA26: ;
	s = getfieldvalue_298073(n, ((NimStringDesc*) &TMP2200));
	{
		NIM_BOOL LOC31;
		TY165566 LOC35;
		LOC31 = 0;
		LOC31 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC31)) goto LA32;
		LOC31 = allcharsinset_99459(s, TMP2189);
		LA32: ;
		if (!LOC31) goto LA33;
		memset((void*)LOC35, 0, sizeof(LOC35));
		LOC35[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE);
		dispa_312689((*d).target, (&options), ((NimStringDesc*) &TMP2201), ((NimStringDesc*) &TMP2097), LOC35, 1);
	}
	LA33: ;
	{
		TY165566 LOC40;
		if (!(((NI) 0) < (options ? options->Sup.len : 0))) goto LA38;
		memset((void*)LOC40, 0, sizeof(LOC40));
		LOC40[0] = copyString(options);
		options = dispf_312666((*d).target, ((NimStringDesc*) &TMP2152), ((NimStringDesc*) &TMP2202), LOC40, 1);
	}
	LA38: ;
	arg = getargument_298080(n);
	{
		NIM_BOOL LOC43;
		TY155943 LOC47;
		LOC43 = 0;
		LOC43 = (((NI) 0) < (arg ? arg->Sup.len : 0));
		if (!(LOC43)) goto LA44;
		LOC43 = allcharsinset_99459(arg, TMP2189);
		LA44: ;
		if (!LOC43) goto LA45;
		memset((void*)LOC47, 0, sizeof(LOC47));
		LOC47[0] = copyString(arg);
		LOC47[1] = copyString(options);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2203), ((NimStringDesc*) &TMP2204), LOC47, 2);
	}
	LA45: ;
	{
		NI LOC50;
		LOC50 = 0;
		LOC50 = len_297084(n);
		if (!(((NI) 3) <= LOC50)) goto LA51;
		renderrsttoout_312724(d, (*n).sons->data[((NI) 2)], result);
	}
	LA51: ;
}

N_NIMCALL(void, init_312078)(Codeblockparams312020* p) {
	(*p).startline = ((NI) 1);
	(*p).lang = ((NU8) 0);
	unsureAsgnRef((void**) (&(*p).langstr), copyString(((NimStringDesc*) &TMP2097)));
}

N_NIMCALL(void, parsecodeblockfield_318493)(Trstgenerator312016* d, Trstnode297011* n, Codeblockparams312020* params) {
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	LOC1 = 0;
	LOC1 = getargument_298080(n);
	LOC2 = 0;
	LOC2 = nsuToLowerStr(LOC1);
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2205))) goto LA3;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2206))) goto LA4;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2207))) goto LA5;
	goto LA6;
	LA3: ;
	{
		NI number;
		(*params).numberlines = NIM_TRUE;
		number = 0;
		{
			NimStringDesc* LOC11;
			NI LOC12;
			LOC11 = 0;
			LOC11 = getfieldvalue_301310(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_301310(n);
		unsureAsgnRef((void**) (&(*params).langstr), nsuStrip(LOC17, NIM_TRUE, NIM_TRUE));
		(*params).lang = getsourcelanguage_306093((*params).langstr);
	}
	goto LA7;
	LA6: ;
	{
		NimStringDesc* LOC19;
		LOC19 = 0;
		LOC19 = getargument_298080(n);
		(*d).msghandler((*d).filename, ((NI) 1), ((NI) 0), ((NU8) 9), LOC19);
	}
	LA7: ;
}

N_NIMCALL(void, parsecodeblockparams_318508)(Trstgenerator312016* d, Trstnode297011* n, Codeblockparams312020* Result) {
	NimStringDesc* LOC12;
{	init_312078(Result);
	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((*n).sons->data[((NI) 1)] == 0)) goto LA7;
		{
			Trstnode297011* son_319011;
			Trstnodeseq297009* HEX3Atmp_319014;
			NI i_319017;
			NI L_319019;
			son_319011 = 0;
			HEX3Atmp_319014 = 0;
			HEX3Atmp_319014 = (*(*n).sons->data[((NI) 1)]).sons;
			i_319017 = ((NI) 0);
			L_319019 = (HEX3Atmp_319014 ? HEX3Atmp_319014->Sup.len : 0);
			{
				while (1) {
					if (!(i_319017 < L_319019)) goto LA11;
					son_319011 = HEX3Atmp_319014->data[i_319017];
					parsecodeblockfield_318493(d, son_319011, Result);
					i_319017 += ((NI) 1);
				} LA11: ;
			}
		}
	}
	LA7: ;
	LOC12 = 0;
	LOC12 = getargument_298080(n);
	unsureAsgnRef((void**) (&(*Result).langstr), nsuStrip(LOC12, NIM_TRUE, NIM_TRUE));
	{
		if (!!((((*Result).langstr) && ((*Result).langstr)->Sup.len == 0))) goto LA15;
		(*Result).lang = getsourcelanguage_306093((*Result).langstr);
	}
	LA15: ;
	}BeforeRet: ;
}

N_NIMCALL(void, buildlineshtmltable_319035)(Codeblockparams312020 params, NimStringDesc* code, Keyvaluepair136008* Result) {
	NI codelines;
	NimStringDesc* LOC5;
	NI LOC6;
	NI line;
{	{
		if (!!(params.numberlines)) goto LA3;
		unsureAsgnRef((void**) (&(*Result).Field0), copyString(TMP2215.Field0));
		unsureAsgnRef((void**) (&(*Result).Field1), copyString(TMP2215.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*) &TMP2218)));
	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 + 2);
appendString(LOC9, LOC10);
appendString(LOC9, ((NimStringDesc*) &TMP2106));
			(*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*) &TMP2219));
	unsureAsgnRef((void**) (&(*Result).Field1), copyString(((NimStringDesc*) &TMP2220)));
	}BeforeRet: ;
}

N_NIMCALL(void, rendercodeblock_319233)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	Codeblockparams312020 params;
	Trstnode297011* m;
	Keyvaluepair136008 LOC5;
	NimStringDesc* blockstart;
	NimStringDesc* blockend;
	TY219714 LOC6;
	TY219714 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_318508(d, n, (&params));
	m = (*(*n).sons->data[((NI) 2)]).sons->data[((NI) 0)];
	memset((void*)(&LOC5), 0, sizeof(LOC5));
	buildlineshtmltable_319035(params, (*m).text, (&LOC5));
	blockstart = 0;
	blockstart = LOC5.Field0;
	blockend = 0;
	blockend = LOC5.Field1;
	memset((void*)LOC6, 0, sizeof(LOC6));
	dispa_312689((*d).target, result, blockstart, ((NimStringDesc*) &TMP2221), 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_319615;
			NimStringDesc* HEX3Atmp_319627;
			NI i_319630;
			NI L_319632;
			letter_319615 = 0;
			HEX3Atmp_319627 = 0;
			HEX3Atmp_319627 = (*m).text;
			i_319630 = ((NI) 0);
			L_319632 = (HEX3Atmp_319627 ? HEX3Atmp_319627->Sup.len : 0);
			{
				while (1) {
					if (!(i_319630 < L_319632)) goto LA17;
					letter_319615 = HEX3Atmp_319627->data[i_319630];
					escchar_312494((*d).target, result, letter_319615);
					i_319630 += ((NI) 1);
				} LA17: ;
			}
		}
	}
	goto LA7;
	LA9: ;
	{
		Tgeneraltokenizer306023 g;
		memset((void*)(&g), 0, sizeof(g));
		g.Sup.m_type = (&NTI306023);
		initgeneraltokenizer_306289((&g), (*m).text);
		{
			while (1) {
				getnexttoken_308766((&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:
				{
					TY155943 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_312553((*d).target, LOC26, ((NI) -1));
					LOC25[1] = copyString(tokenclasstostr_306081[(g.kind)- 0]);
					dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2383), ((NimStringDesc*) &TMP2384), LOC25, 2);
				}
				break;
				}
			}
		} LA19: ;
		deinitgeneraltokenizer_306300((&g));
	}
	LA7: ;
	memset((void*)LOC27, 0, sizeof(LOC27));
	dispa_312689((*d).target, result, blockend, ((NimStringDesc*) &TMP2418), LOC27, 0);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercontainer_319657)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* arg;
	NimStringDesc* LOC1;
	tmp = copyString(((NimStringDesc*) &TMP2097));
	renderrsttoout_312724(d, (*n).sons->data[((NI) 2)], (&tmp));
	LOC1 = 0;
	LOC1 = getargument_298080(n);
	arg = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE);
	{
		TY165566 LOC6;
		if (!((arg) && (arg)->Sup.len == 0)) goto LA4;
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = copyString(tmp);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2419), ((NimStringDesc*) &TMP2152), LOC6, 1);
	}
	goto LA2;
	LA4: ;
	{
		TY155943 LOC8;
		memset((void*)LOC8, 0, sizeof(LOC8));
		LOC8[0] = copyString(arg);
		LOC8[1] = copyString(tmp);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2420), ((NimStringDesc*) &TMP2421), LOC8, 2);
	}
	LA2: ;
}

N_NIMCALL(void, renderindexterm_313066)(Trstgenerator312016* d, Trstnode297011* n_313069, NimStringDesc** result) {
	NimStringDesc* refname;
	NimStringDesc* id;
	NimStringDesc* LOC8;
	NI LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* term;
	TY155943 LOC11;
	refname = rstnodetorefname_298061(n_313069);
	{
		NIM_BOOL LOC3;
		NI LOC6;
		LOC3 = 0;
		LOC3 = haskey_313074((*d).seenindexterms, refname);
		if (!LOC3) goto LA4;
		LOC6 = 0;
		LOC6 = HEX5BHEX5D_313117((*d).seenindexterms, refname);
		HEX5BHEX5DHEX3D_313148((&(*d).seenindexterms), refname, (NI)(LOC6 + ((NI) 1)));
	}
	goto LA1;
	LA4: ;
	{
		HEX5BHEX5DHEX3D_313148((&(*d).seenindexterms), refname, ((NI) 1));
	}
	LA1: ;
	LOC8 = 0;
	LOC9 = 0;
	LOC9 = HEX5BHEX5D_313117((*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*) &TMP2097));
	renderaux_312734(d, n_313069, (&term));
	setindexterm_312855(d, id, term, (*d).currentsection, ((NimStringDesc*) &TMP2097));
	memset((void*)LOC11, 0, sizeof(LOC11));
	LOC11[0] = copyString(id);
	LOC11[1] = copyString(term);
	dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2435), ((NimStringDesc*) &TMP2436), LOC11, 2);
}

N_NIMCALL(void, rendersmiley_318479)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
	TY165566 LOC1;
	NimStringDesc* LOC2;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC2 = 0;
	LOC2 = nstGet((*d).config, ((NimStringDesc*) &TMP2441));
	LOC1[0] = nsuFormatSingleElem(LOC2, (*n).text);
	dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2439), ((NimStringDesc*) &TMP2440), LOC1, 1);
}

N_NIMCALL(void, renderrsttoout_312724)(Trstgenerator312016* d, Trstnode297011* n, NimStringDesc** result) {
{	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 0):
	{
		renderaux_312734(d, n, result);
	}
	break;
	case ((NU8) 1):
	{
		renderheadline_317861(d, n, result);
	}
	break;
	case ((NU8) 2):
	{
		renderoverline_318045(d, n, result);
	}
	break;
	case ((NU8) 3):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2112), ((NimStringDesc*) &TMP2113), result);
	}
	break;
	case ((NU8) 4):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2114), ((NimStringDesc*) &TMP2115), result);
	}
	break;
	case ((NU8) 5):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2116), ((NimStringDesc*) &TMP2117), result);
	}
	break;
	case ((NU8) 6):
	case ((NU8) 8):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2118), ((NimStringDesc*) &TMP2119), result);
	}
	break;
	case ((NU8) 7):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2120), ((NimStringDesc*) &TMP2121), result);
	}
	break;
	case ((NU8) 9):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2122), ((NimStringDesc*) &TMP2123), result);
	}
	break;
	case ((NU8) 10):
	{
		renderaux_312734(d, n, result);
	}
	break;
	case ((NU8) 11):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2124), ((NimStringDesc*) &TMP2125), result);
	}
	break;
	case ((NU8) 12):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2126), ((NimStringDesc*) &TMP2127), result);
	}
	break;
	case ((NU8) 13):
	{
		NimStringDesc* tmp;
		tmp = copyString(((NimStringDesc*) &TMP2097));
		{
			NI i_319771;
			NI HEX3Atmp_319833;
			NI LOC19;
			NI res_319836;
			i_319771 = 0;
			HEX3Atmp_319833 = 0;
			LOC19 = 0;
			LOC19 = len_297084(n);
			HEX3Atmp_319833 = (NI)(LOC19 - ((NI) 1));
			res_319836 = ((NI) 0);
			{
				while (1) {
					if (!(res_319836 <= HEX3Atmp_319833)) goto LA21;
					i_319771 = res_319836;
					renderrsttoout_312724(d, (*n).sons->data[i_319771], (&tmp));
					res_319836 += ((NI) 1);
				} LA21: ;
			}
		}
		{
			TY165566 LOC26;
			if (!!(((tmp ? tmp->Sup.len : 0) == ((NI) 0)))) goto LA24;
			memset((void*)LOC26, 0, sizeof(LOC26));
			LOC26[0] = copyString(tmp);
			dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2128), ((NimStringDesc*) &TMP2123), LOC26, 1);
		}
		LA24: ;
	}
	break;
	case ((NU8) 14):
	{
		renderfield_319716(d, n, result);
	}
	break;
	case ((NU8) 15):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2153), ((NimStringDesc*) &TMP2154), result);
	}
	break;
	case ((NU8) 16):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2155), ((NimStringDesc*) &TMP2156), result);
	}
	break;
	case ((NU8) 51):
	{
		renderrsttoout_312724(d, (*n).sons->data[((NI) 2)], result);
	}
	break;
	case ((NU8) 17):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2157), ((NimStringDesc*) &TMP2158), result);
	}
	break;
	case ((NU8) 18):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2151), ((NimStringDesc*) &TMP2152), result);
	}
	break;
	case ((NU8) 19):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2159), ((NimStringDesc*) &TMP2160), result);
	}
	break;
	case ((NU8) 23):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2161), ((NimStringDesc*) &TMP2156), result);
	}
	break;
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		{
			if (!NIM_TRUE) goto LA38;
			raiseassert_88157(((NimStringDesc*) &TMP2163));
		}
		LA38: ;
	}
	break;
	case ((NU8) 24):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2164), ((NimStringDesc*) &TMP2165), result);
	}
	break;
	case ((NU8) 25):
	{
		{
			if (!NIM_TRUE) goto LA44;
			raiseassert_88157(((NimStringDesc*) &TMP2163));
		}
		LA44: ;
	}
	break;
	case ((NU8) 26):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2166), ((NimStringDesc*) &TMP2115), result);
	}
	break;
	case ((NU8) 27):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2167), ((NimStringDesc*) &TMP2168), result);
	}
	break;
	case ((NU8) 28):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2169), ((NimStringDesc*) &TMP2170), result);
	}
	break;
	case ((NU8) 29):
	case ((NU8) 30):
	{
		NimStringDesc* LOC50;
		NimStringDesc* LOC51;
		LOC50 = 0;
		LOC51 = 0;
		LOC51 = texcolumns_319676(n);
		LOC50 = rawNewString(LOC51->Sup.len + 65);
appendString(LOC50, ((NimStringDesc*) &TMP2172));
appendString(LOC50, LOC51);
appendString(LOC50, ((NimStringDesc*) &TMP2174));
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2171), LOC50, result);
	}
	break;
	case ((NU8) 31):
	{
		{
			NI LOC55;
			LOC55 = 0;
			LOC55 = len_297084(n);
			if (!(((NI) 1) <= LOC55)) goto LA56;
			{
				if (!((*d).target == ((NU8) 1))) goto LA60;
				renderrsttoout_312724(d, (*n).sons->data[((NI) 0)], result);
				{
					NI i_319796;
					NI HEX3Atmp_319841;
					NI LOC63;
					NI res_319844;
					i_319796 = 0;
					HEX3Atmp_319841 = 0;
					LOC63 = 0;
					LOC63 = len_297084(n);
					HEX3Atmp_319841 = (NI)(LOC63 - ((NI) 1));
					res_319844 = ((NI) 1);
					{
						while (1) {
							if (!(res_319844 <= HEX3Atmp_319841)) goto LA65;
							i_319796 = res_319844;
							(*result) = resizeString((*result), 3);
appendString((*result), ((NimStringDesc*) &TMP2175));
							renderrsttoout_312724(d, (*n).sons->data[i_319796], result);
							res_319844 += ((NI) 1);
						} LA65: ;
					}
				}
				(*result) = resizeString((*result), 12);
appendString((*result), ((NimStringDesc*) &TMP2176));
			}
			goto LA58;
			LA60: ;
			{
				(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP2177));
				renderaux_312734(d, n, result);
				(*result) = resizeString((*result), 7);
appendString((*result), ((NimStringDesc*) &TMP2178));
			}
			LA58: ;
		}
		LA56: ;
	}
	break;
	case ((NU8) 33):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2155), ((NimStringDesc*) &TMP2152), result);
	}
	break;
	case ((NU8) 32):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2179), ((NimStringDesc*) &TMP2180), result);
	}
	break;
	case ((NU8) 34):
	{
		{
			if (!NIM_TRUE) goto LA72;
			raiseassert_88157(((NimStringDesc*) &TMP2163));
		}
		LA72: ;
	}
	break;
	case ((NU8) 35):
	{
		{
			if (!NIM_TRUE) goto LA77;
			raiseassert_88157(((NimStringDesc*) &TMP2163));
		}
		LA77: ;
	}
	break;
	case ((NU8) 36):
	{
		{
			if (!NIM_TRUE) goto LA82;
			raiseassert_88157(((NimStringDesc*) &TMP2163));
		}
		LA82: ;
	}
	break;
	case ((NU8) 39):
	{
		NimStringDesc* tmp;
		TY155943 LOC85;
		tmp = copyString(((NimStringDesc*) &TMP2097));
		renderaux_312734(d, n, (&tmp));
		memset((void*)LOC85, 0, sizeof(LOC85));
		LOC85[0] = copyString(tmp);
		LOC85[1] = rstnodetorefname_298061(n);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2181), ((NimStringDesc*) &TMP2182), LOC85, 2);
	}
	break;
	case ((NU8) 37):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2183), ((NimStringDesc*) &TMP2184), result);
	}
	break;
	case ((NU8) 38):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY155943 LOC88;
		tmp0 = copyString(((NimStringDesc*) &TMP2097));
		tmp1 = copyString(((NimStringDesc*) &TMP2097));
		renderrsttoout_312724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_312724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC88, 0, sizeof(LOC88));
		LOC88[0] = copyString(tmp0);
		LOC88[1] = copyString(tmp1);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2185), ((NimStringDesc*) &TMP2186), LOC88, 2);
	}
	break;
	case ((NU8) 41):
	case ((NU8) 42):
	{
		renderaux_312734(d, n, result);
	}
	break;
	case ((NU8) 48):
	{
		{
			Trstnode297011* LOC95;
			NimStringDesc* LOC96;
			if (!!(((*d).target == ((NU8) 1)))) goto LA93;
			LOC95 = 0;
			LOC95 = lastson_297147(n);
			LOC96 = 0;
			LOC96 = addnodes_298067(LOC95);
			(*result) = resizeString((*result), LOC96->Sup.len + 0);
appendString((*result), LOC96);
		}
		LA93: ;
	}
	break;
	case ((NU8) 49):
	{
		{
			Trstnode297011* LOC102;
			NimStringDesc* LOC103;
			if (!((*d).target == ((NU8) 1))) goto LA100;
			LOC102 = 0;
			LOC102 = lastson_297147(n);
			LOC103 = 0;
			LOC103 = addnodes_298067(LOC102);
			(*result) = resizeString((*result), LOC103->Sup.len + 0);
appendString((*result), LOC103);
		}
		LA100: ;
	}
	break;
	case ((NU8) 45):
	case ((NU8) 46):
	{
		renderimage_318213(d, n, result);
	}
	break;
	case ((NU8) 47):
	{
		rendercodeblock_319233(d, n, result);
	}
	break;
	case ((NU8) 50):
	{
		rendercontainer_319657(d, n, result);
	}
	break;
	case ((NU8) 62):
	case ((NU8) 52):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2422), ((NimStringDesc*) &TMP2422), result);
	}
	break;
	case ((NU8) 40):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2097), ((NimStringDesc*) &TMP2097), result);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY155943 LOC110;
		tmp0 = copyString(((NimStringDesc*) &TMP2097));
		tmp1 = copyString(((NimStringDesc*) &TMP2097));
		renderrsttoout_312724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_312724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC110, 0, sizeof(LOC110));
		LOC110[0] = copyString(tmp0);
		LOC110[1] = copyString(tmp1);
		dispa_312689((*d).target, result, ((NimStringDesc*) &TMP2383), ((NimStringDesc*) &TMP2384), LOC110, 2);
	}
	break;
	case ((NU8) 54):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2423), ((NimStringDesc*) &TMP2424), result);
	}
	break;
	case ((NU8) 55):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2425), ((NimStringDesc*) &TMP2426), result);
	}
	break;
	case ((NU8) 57):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2427), ((NimStringDesc*) &TMP2428), result);
	}
	break;
	case ((NU8) 58):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2429), ((NimStringDesc*) &TMP2180), result);
	}
	break;
	case ((NU8) 59):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2430), ((NimStringDesc*) &TMP2431), result);
	}
	break;
	case ((NU8) 60):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2432), ((NimStringDesc*) &TMP2428), result);
	}
	break;
	case ((NU8) 56):
	{
		renderindexterm_313066(d, n, result);
	}
	break;
	case ((NU8) 61):
	{
		renderaux_312776(d, n, ((NimStringDesc*) &TMP2437), ((NimStringDesc*) &TMP2438), result);
	}
	break;
	case ((NU8) 63):
	{
		rendersmiley_318479(d, n, result);
	}
	break;
	case ((NU8) 64):
	{
		NimStringDesc* LOC121;
		LOC121 = 0;
		LOC121 = esc_312553((*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*) &TMP2097)));
		renderrsttoout_312724(d, (*n).sons->data[((NI) 0)], (&(*d).meta[(((NU8) 1))- 0]));
	}
	break;
	}
	}BeforeRet: ;
}
N_NIMCALL(void, TMP4762)(void* p, NI op) {
	TY312034* a;
	NI LOC1;
	a = (TY312034*)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_312088)(Trstgenerator312016* g, NU8 target, Stringtableobj136012* config, NimStringDesc* filename, NU8 options, Tfindfilehandler298023 findfile, Tmsghandler298021 msghandler) {
	TY118789 fileparts;
	NimStringDesc* s;
	unsureAsgnRef((void**) (&(*g).config), config);
	(*g).target = target;
	unsureAsgnRef((void**) (&(*g).tocpart), (TY312034*) newSeq((&NTI312034), 0));
	unsureAsgnRef((void**) (&(*g).filename), copyString(filename));
	(*g).splitafter = ((NI) 20);
	unsureAsgnRef((void**) (&(*g).theindex), copyString(((NimStringDesc*) &TMP2097)));
	(*g).options = options;
	(*g).findfile = findfile;
	unsureAsgnRef((void**) (&(*g).currentsection), copyString(((NimStringDesc*) &TMP2097)));
	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_312116(((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_312423;
		NI res_312427;
		i_312423 = 0;
		res_312427 = ((NI) 0);
		{
			while (1) {
				if (!(res_312427 <= ((NI) 4))) goto LA12;
				i_312423 = ((NU8) (res_312427));
				unsureAsgnRef((void**) (&(*g).meta[(i_312423)- 0]), copyString(((NimStringDesc*) &TMP2097)));
				res_312427 += ((NI) 1);
			} LA12: ;
		}
	}
}

N_NIMCALL(void, rendertocentry_318162)(Trstgenerator312016* d, Ttocentry312012 e, NimStringDesc** result) {
	TY155943 LOC1;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString(e.refname);
	LOC1[1] = copyString(e.header);
	dispa_312689((*d).target, result, ((NimStringDesc*) &TMP4843), ((NimStringDesc*) &TMP4844), LOC1, 2);
}

N_NIMCALL(void, rendertocentries_318176)(Trstgenerator312016* d, NI* j, NI lvl, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2097));
	{
		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_318162(d, (*d).tocpart->data[(*j)], (&tmp));
				(*j) += ((NI) 1);
			}
			goto LA3;
			LA5: ;
			{
				if (!(lvl < a)) goto LA8;
				rendertocentries_318176(d, j, a, (&tmp));
			}
			goto LA3;
			LA8: ;
			{
				goto LA1;
			}
			LA3: ;
		} LA2: ;
	} LA1: ;
	{
		TY165566 LOC15;
		if (!(((NI) 1) < lvl)) goto LA13;
		memset((void*)LOC15, 0, sizeof(LOC15));
		LOC15[0] = copyString(tmp);
		dispa_312689((*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_312445)(Trstgenerator312016* 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) {
	TY315702* a;
	NI LOC1;
	a = (TY315702*)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);
	}
}

static N_INLINE(NIM_BOOL, skipfinddata_115436)(Twin32finddata105219* f) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	NIM_BOOL LOC3;
	NIM_BOOL LOC5;
	result = 0;
	LOC1 = 0;
	LOC1 = (((NI) ((*f).cfilename[(((NI) 0))- 0])) == ((NI) 46));
	if (!(LOC1)) goto LA2;
	LOC3 = 0;
	LOC3 = (((NI) ((*f).cfilename[(((NI) 1))- 0])) == ((NI) 0));
	if (LOC3) goto LA4;
	LOC5 = 0;
	LOC5 = (((NI) ((*f).cfilename[(((NI) 1))- 0])) == ((NI) 46));
	if (!(LOC5)) goto LA6;
	LOC5 = (((NI) ((*f).cfilename[(((NI) 2))- 0])) == ((NI) 0));
	LA6: ;
	LOC3 = LOC5;
	LA4: ;
	LOC1 = LOC3;
	LA2: ;
	result = LOC1;
	return result;
}

N_NIMCALL(NIM_BOOL, isdocumentationtitle_313971)(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_312845)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2109), ((NimStringDesc*) &TMP2108));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2107), ((NimStringDesc*) &TMP2106));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2105), ((NimStringDesc*) &TMP2104));
	return result;
}

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

static N_INLINE(NimStringDesc*, or_312713)(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_133054)(NI h) {
	NI result;
	result = 0;
	result = (NI)((NU32)(h) + (NU32)((NI)((NU32)(h) << (NU32)(((NI) 3)))));
	result = (NI)(result ^ (NI)((NU32)(result) >> (NU32)(((NI) 11))));
	result = (NI)((NU32)(result) + (NU32)((NI)((NU32)(result) << (NU32)(((NI) 15)))));
	return result;
}

N_NIMCALL(NI, hash_313441)(Tindexentry313396 x) {
	NI result;
	NI LOC1;
	NI LOC2;
	NimStringDesc* LOC3;
	NI LOC4;
	NimStringDesc* LOC5;
	NI LOC6;
	result = 0;
	LOC1 = 0;
	LOC1 = hash_133839(x.keyword);
	LOC2 = 0;
	LOC2 = hash_133839(x.link);
	result = HEX21HEX26_133025(LOC1, LOC2);
	LOC3 = 0;
	LOC3 = or_312713(x.linktitle, ((NimStringDesc*) &TMP2097));
	LOC4 = 0;
	LOC4 = hash_133839(LOC3);
	result = HEX21HEX26_133025(result, LOC4);
	LOC5 = 0;
	LOC5 = or_312713(x.linkdesc, ((NimStringDesc*) &TMP2097));
	LOC6 = 0;
	LOC6 = hash_133839(LOC5);
	result = HEX21HEX26_133025(result, LOC6);
	result = HEX21HEX24_133054(result);
	return result;
}

N_NIMCALL(void, readindexdir_315696)(NimStringDesc* dir, TY315699* Result) {
	NI L;
	TY316308 LOC85;
	unsureAsgnRef((void**) (&(*Result).Field0), (TY123008*) newSeq((&NTI123008), 0));
	inittable_315724(((NI) 32), (&(*Result).Field2));
	unsureAsgnRef((void**) (&(*Result).Field1), (TY315702*) newSeq((&NTI315702), ((NI) 15000)));
	(*Result).Field1 = (TY315702*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Tindexentry313396), ((NI) 0));
	L = ((NI) 0);
	{
		NU8 kind_315836;
		NimStringDesc* path_315837;
		Twin32finddata105219 f_317692;
		NI h_317694;
		NimStringDesc* LOC2;
		kind_315836 = 0;
		path_315837 = 0;
		memset((void*)(&f_317692), 0, sizeof(f_317692));
		LOC2 = 0;
		LOC2 = HEX2F_118492(dir, ((NimStringDesc*) &TMP4917));
		h_317694 = findfirstfile_115416(LOC2, (&f_317692));
		{
			if (!!((h_317694 == ((NI) -1)))) goto LA5;
			{
				while (1) {
					NU8 k_317696;
					k_317696 = ((NU8) 0);
					{
						NIM_BOOL LOC11;
						NimStringDesc* LOC22;
						NimStringDesc* LOC23;
						LOC11 = 0;
						LOC11 = skipfinddata_115436((&f_317692));
						if (!!(LOC11)) goto LA12;
						{
							if (!!(((NI32)(f_317692.dwfileattributes & ((NI32) 16)) == ((NI32) 0)))) goto LA16;
							k_317696 = ((NU8) 2);
						}
						LA16: ;
						{
							if (!!(((NI32)(f_317692.dwfileattributes & ((NI32) 1024)) == ((NI32) 0)))) goto LA20;
							k_317696 = (NU8)(k_317696 + ((NI) 1));
						}
						LA20: ;
						kind_315836 = k_317696;
						LOC22 = 0;
						LOC22 = HEX24_80989(((NI16*) ((&f_317692.cfilename[(((NI) 0))- 0]))));
						LOC23 = 0;
						LOC23 = nosextractFilename(LOC22);
						path_315837 = HEX2F_118492(dir, LOC23);
						{
							NIM_BOOL LOC26;
							TY315702* fileentries;
							Tindexentry313396 title;
							NI F;
							LOC26 = 0;
							LOC26 = (kind_315836 == ((NU8) 0));
							if (!(LOC26)) goto LA27;
							LOC26 = nsuEndsWith(path_315837, ((NimStringDesc*) &TMP4918));
							LA27: ;
							if (!LOC26) goto LA28;
							fileentries = 0;
							memset((void*)(&title), 0, sizeof(title));
							F = ((NI) 0);
							fileentries = (TY315702*) newSeq((&NTI315702), ((NI) 500));
							fileentries = (TY315702*) setLengthSeq(&(fileentries)->Sup, sizeof(Tindexentry313396), ((NI) 0));
							{
								NimStringDesc* line_315872;
								FILE* f_317677;
								NimStringDesc* res_317679;
								line_315872 = 0;
								f_317677 = open_13217(path_315837, ((NU8) 0), ((NI) 8000));
								res_317679 = rawNewString(((NI) 80));
								{
									while (1) {
										NIM_BOOL LOC33;
										LOC33 = 0;
										LOC33 = readline_13481(f_317677, (&res_317679));
										if (!LOC33) goto LA32;
										line_315872 = res_317679;
										{
											NI s;
											s = nsuFindChar(line_315872, 9, ((NI) 0));
											{
												if (!(s < ((NI) 0))) goto LA37;
												goto LA34;
											}
											LA37: ;
											fileentries = (TY315702*) setLengthSeq(&(fileentries)->Sup, sizeof(Tindexentry313396), ((NI) ((NI)(F + ((NI) 1)))));
											asgnRefNoCycle((void**) (&fileentries->data[F].keyword), copyStrLast(line_315872, ((NI) 0), (NI)(s - ((NI) 1))));
											asgnRefNoCycle((void**) (&fileentries->data[F].link), copyStr(line_315872, (NI)(s + ((NI) 1))));
											{
												NIM_BOOL LOC41;
												LOC41 = 0;
												LOC41 = title.keyword == 0;
												if (!(LOC41)) goto LA42;
												LOC41 = isdocumentationtitle_313971(fileentries->data[F].link);
												LA42: ;
												if (!LOC41) goto LA43;
												title.keyword = copyString(fileentries->data[F].keyword);
												title.link = copyString(fileentries->data[F].link);
											}
											LA43: ;
											{
												NI LOC47;
												TY123008* extracols;
												NimStringDesc* LOC50;
												LOC47 = 0;
												LOC47 = nsuFindChar(fileentries->data[F].link, 9, ((NI) 0));
												if (!(((NI) 0) < LOC47)) goto LA48;
												extracols = nsuSplitChar(fileentries->data[F].link, 9);
												LOC50 = 0;
												LOC50 = fileentries->data[F].link; fileentries->data[F].link = copyStringRC1(extracols->data[((NI) 0)]);
												if (LOC50) nimGCunrefNoCycle(LOC50);
												asgnRefNoCycle((void**) (&fileentries->data[F].linktitle), unquoteindexcolumn_312845(extracols->data[((NI) 1)]));
												asgnRefNoCycle((void**) (&fileentries->data[F].linkdesc), unquoteindexcolumn_312845(extracols->data[((NI) 2)]));
											}
											goto LA45;
											LA48: ;
											{
												NimStringDesc* LOC52;
												NimStringDesc* LOC53;
												LOC52 = 0;
												LOC52 = fileentries->data[F].linktitle; fileentries->data[F].linktitle = copyStringRC1(NIM_NIL);
												if (LOC52) nimGCunrefNoCycle(LOC52);
												LOC53 = 0;
												LOC53 = fileentries->data[F].linkdesc; fileentries->data[F].linkdesc = copyStringRC1(NIM_NIL);
												if (LOC53) nimGCunrefNoCycle(LOC53);
											}
											LA45: ;
											F += ((NI) 1);
										} LA34: ;
									} LA32: ;
								}
								fclose(f_317677);
							}
							{
								TY118789 LOC74;
								NimStringDesc* LOC75;
								if (!title.keyword == 0) goto LA56;
								{
									NI i_316028;
									NI HEX3Atmp_317683;
									NI res_317686;
									i_316028 = 0;
									HEX3Atmp_317683 = 0;
									HEX3Atmp_317683 = (F - 1);
									res_317686 = ((NI) 0);
									{
										while (1) {
											if (!(res_317686 <= HEX3Atmp_317683)) goto LA60;
											i_316028 = res_317686;
											{
												NimStringDesc* toc;
												NimStringDesc* LOC70;
												NimStringDesc* LOC71;
												NimStringDesc* LOC72;
												NimStringDesc* LOC73;
												toc = fileentries->data[i_316028].linktitle;
												{
													NIM_BOOL LOC64;
													NIM_BOOL LOC65;
													LOC64 = 0;
													LOC65 = 0;
													LOC65 = !(toc == 0);
													if (!(LOC65)) goto LA66;
													LOC65 = (((NI) 0) < (toc ? toc->Sup.len : 0));
													LA66: ;
													LOC64 = LOC65;
													if (!(LOC64)) goto LA67;
													LOC64 = ((NU8)(toc->data[((NI) 0)]) == (NU8)(32));
													LA67: ;
													if (!LOC64) goto LA68;
													goto LA61;
												}
												LA68: ;
												(*Result).Field1 = (TY315702*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Tindexentry313396), ((NI) ((NI)(L + ((NI) 1)))));
												LOC70 = 0;
												LOC70 = (*Result).Field1->data[L].keyword; (*Result).Field1->data[L].keyword = copyStringRC1(fileentries->data[i_316028].keyword);
												if (LOC70) nimGCunrefNoCycle(LOC70);
												LOC71 = 0;
												LOC71 = (*Result).Field1->data[L].link; (*Result).Field1->data[L].link = copyStringRC1(fileentries->data[i_316028].link);
												if (LOC71) nimGCunrefNoCycle(LOC71);
												LOC72 = 0;
												LOC72 = (*Result).Field1->data[L].linktitle; (*Result).Field1->data[L].linktitle = copyStringRC1(fileentries->data[i_316028].linktitle);
												if (LOC72) nimGCunrefNoCycle(LOC72);
												LOC73 = 0;
												LOC73 = (*Result).Field1->data[L].linkdesc; (*Result).Field1->data[L].linkdesc = copyStringRC1(fileentries->data[i_316028].linkdesc);
												if (LOC73) nimGCunrefNoCycle(LOC73);
												L += ((NI) 1);
											} LA61: ;
											res_317686 += ((NI) 1);
										} LA60: ;
									}
								}
								memset((void*)(&LOC74), 0, sizeof(LOC74));
								nossplitFile(path_315837, (&LOC74));
								(*Result).Field0 = (TY123008*) incrSeq(&((*Result).Field0)->Sup, sizeof(NimStringDesc*));
								LOC75 = 0;
								LOC75 = (*Result).Field0->data[(*Result).Field0->Sup.len-1]; (*Result).Field0->data[(*Result).Field0->Sup.len-1] = copyStringRC1(LOC74.Field1);
								if (LOC75) nimGCunrefNoCycle(LOC75);
							}
							goto LA54;
							LA56: ;
							{
								NimStringDesc* LOC77;
								NI LOC78;
								NimStringDesc* LOC79;
								LOC77 = 0;
								LOC78 = 0;
								LOC78 = len_316060((*Result).Field2);
								LOC79 = 0;
								LOC79 = nimIntToStr(LOC78);
								LOC77 = rawNewString(LOC79->Sup.len + 8);
appendString(LOC77, ((NimStringDesc*) &TMP4919));
appendString(LOC77, LOC79);
								title.linktitle = LOC77;
								HEX5BHEX5DHEX3D_316072((&(*Result).Field2), title, fileentries);
							}
							LA54: ;
						}
						LA28: ;
					}
					LA12: ;
					{
						NI32 LOC82;
						LOC82 = 0;
						LOC82 = Dl_105244(h_317694, (&f_317692));
						if (!(LOC82 == ((NI32) 0))) goto LA83;
						goto LA7;
					}
					LA83: ;
				}
			} LA7: ;
			Dl_105404(h_317694);
		}
		LA5: ;
	}
	memset((void*)(&LOC85), 0, sizeof(LOC85));
	LOC85.ClPrc = ((TMP4922) (cmp_4717)); LOC85.ClEnv = NIM_NIL;
	sort_316301((*Result).Field0->data, (*Result).Field0->Sup.len, LOC85, ((NU8) 1));
}

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

N_NIMCALL(void, HEX3CHEX2D_313807)(Tindexentry313396* a, Tindexentry313396 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_313430)(Tindexentry313396 a, Tindexentry313396 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_315392)(Table313409 docs) {
	NimStringDesc* result_315395;
	TY315702* titles;
	TY315702* result_315397;
	TY314694 LOC14;
	TY123008* chunks;
	NimStringDesc* LOC20;
	NimStringDesc* LOC21;
	result_315395 = 0;
	result_315395 = copyString(((NimStringDesc*) &TMP4923));
	result_315397 = (TY315702*) newSeq((&NTI315702), 0);
	{
		Tindexentry313396 x_315399;
		memset((void*)(&x_315399), 0, sizeof(x_315399));
		{
			NI h_315590;
			NI HEX3Atmp_315592;
			NI res_315594;
			h_315590 = 0;
			HEX3Atmp_315592 = 0;
			HEX3Atmp_315592 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_315594 = ((NI) 0);
			{
				while (1) {
					if (!(res_315594 <= HEX3Atmp_315592)) goto LA4;
					h_315590 = res_315594;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_157211(docs.data->data[h_315590].Field0);
						if (!LOC7) goto LA8;
						x_315399.keyword = docs.data->data[h_315590].Field1.keyword;
						x_315399.link = docs.data->data[h_315590].Field1.link;
						x_315399.linktitle = docs.data->data[h_315590].Field1.linktitle;
						x_315399.linkdesc = docs.data->data[h_315590].Field1.linkdesc;
						result_315397 = (TY315702*) incrSeq(&(result_315397)->Sup, sizeof(Tindexentry313396));
						LOC10 = 0;
						LOC10 = result_315397->data[result_315397->Sup.len-1].keyword; result_315397->data[result_315397->Sup.len-1].keyword = copyStringRC1(x_315399.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_315397->data[result_315397->Sup.len-1].link; result_315397->data[result_315397->Sup.len-1].link = copyStringRC1(x_315399.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_315397->data[result_315397->Sup.len-1].linktitle; result_315397->data[result_315397->Sup.len-1].linktitle = copyStringRC1(x_315399.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_315397->data[result_315397->Sup.len-1].linkdesc; result_315397->data[result_315397->Sup.len-1].linkdesc = copyStringRC1(x_315399.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
					}
					LA8: ;
					res_315594 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_315397, (&NTI315702));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP4926) (cmp_313430)); LOC14.ClEnv = NIM_NIL;
	sort_314687(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	chunks = (TY123008*) newSeq((&NTI123008), 0);
	{
		Tindexentry313396 title_315574;
		NI i_315601;
		NI L_315603;
		memset((void*)(&title_315574), 0, sizeof(title_315574));
		i_315601 = ((NI) 0);
		L_315603 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC18;
				NimStringDesc* LOC19;
				if (!(i_315601 < L_315603)) goto LA17;
				title_315574.keyword = titles->data[i_315601].keyword;
				title_315574.link = titles->data[i_315601].link;
				title_315574.linktitle = titles->data[i_315601].linktitle;
				title_315574.linkdesc = titles->data[i_315601].linkdesc;
				LOC18 = 0;
				LOC18 = rawNewString(title_315574.link->Sup.len + title_315574.keyword->Sup.len + 15);
appendString(LOC18, ((NimStringDesc*) &TMP4927));
appendString(LOC18, title_315574.link);
appendString(LOC18, ((NimStringDesc*) &TMP4928));
appendString(LOC18, title_315574.keyword);
appendString(LOC18, ((NimStringDesc*) &TMP4929));
				chunks = (TY123008*) 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_315601 += ((NI) 1);
			} LA17: ;
		}
	}
	LOC20 = 0;
	LOC21 = 0;
	LOC21 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP4930));
	LOC20 = rawNewString(LOC21->Sup.len + 5);
appendString(LOC20, LOC21);
appendString(LOC20, ((NimStringDesc*) &TMP4931));
	result_315395 = resizeString(result_315395, LOC20->Sup.len + 0);
appendString(result_315395, LOC20);
	return result_315395;
}

N_NIMCALL(NimStringDesc*, generatemodulejumps_315631)(TY123008* modules) {
	NimStringDesc* result;
	TY123008* chunks;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP4933));
	chunks = (TY123008*) newSeq((&NTI123008), 0);
	{
		NimStringDesc* name_315663;
		NI i_315678;
		NI L_315680;
		name_315663 = 0;
		i_315678 = ((NI) 0);
		L_315680 = (modules ? modules->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				NimStringDesc* LOC5;
				if (!(i_315678 < L_315680)) goto LA3;
				name_315663 = modules->data[i_315678];
				LOC4 = 0;
				LOC4 = rawNewString(name_315663->Sup.len + name_315663->Sup.len + 20);
appendString(LOC4, ((NimStringDesc*) &TMP4927));
appendString(LOC4, name_315663);
appendString(LOC4, ((NimStringDesc*) &TMP4934));
appendString(LOC4, name_315663);
appendString(LOC4, ((NimStringDesc*) &TMP4929));
				chunks = (TY123008*) 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_315678 += ((NI) 1);
			} LA3: ;
		}
	}
	LOC6 = 0;
	LOC7 = 0;
	LOC7 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP4930));
	LOC6 = rawNewString(LOC7->Sup.len + 5);
appendString(LOC6, LOC7);
appendString(LOC6, ((NimStringDesc*) &TMP4931));
	result = resizeString(result, LOC6->Sup.len + 0);
appendString(result, LOC6);
	return result;
}
N_NIMCALL(void, TMP4938)(void* p, NI op) {
	TY314066* a;
	NI LOC1;
	a = (TY314066*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Field1, op);
	}
}

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

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

N_NIMCALL(void, striptoclevel_313981)(NimStringDesc* s, TY314067* Result) {
	Slice87574 LOC8;
	{
		NI c_314006;
		NI HEX3Atmp_314026;
		NI res_314029;
		c_314006 = 0;
		HEX3Atmp_314026 = 0;
		HEX3Atmp_314026 = ((s ? s->Sup.len : 0) - 1);
		res_314029 = ((NI) 0);
		{
			while (1) {
				if (!(res_314029 <= HEX3Atmp_314026)) goto LA3;
				c_314006 = res_314029;
				(*Result).Field0 = c_314006;
				{
					if (!!(((NU8)(s->data[c_314006]) == (NU8)(32)))) goto LA6;
					goto LA1;
				}
				LA6: ;
				res_314029 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	LOC8 = HEX2EHEX2E_109273((*Result).Field0, ((s ? s->Sup.len : 0) - 1));
	unsureAsgnRef((void**) (&(*Result).Field1), HEX5BHEX5D_87567(s, LOC8));
}

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

N_NIMCALL(NimStringDesc*, generatedocumentationtoc_314060)(TY315702* entries) {
	NimStringDesc* result;
	NimStringDesc* titleref;
	TY314066* levels;
	NI L_314071;
	NI level;
	NimStringDesc* LOC23;
	NimStringDesc* LOC24;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2097));
	titleref = 0;
	levels = 0;
	L_314071 = ((NI) 0);
	level = ((NI) 1);
	levels = (TY314066*) newSeq((&NTI314066), ((NI) ((entries ? entries->Sup.len : 0))));
	{
		Tindexentry313396 entry_314211;
		NI i_314406;
		NI L_314408;
		memset((void*)(&entry_314211), 0, sizeof(entry_314211));
		i_314406 = ((NI) 0);
		L_314408 = (entries ? entries->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				TY314067 LOC5;
				NI rawlevel;
				NimStringDesc* rawtext;
				if (!(i_314406 < L_314408)) goto LA3;
				entry_314211.keyword = entries->data[i_314406].keyword;
				entry_314211.link = entries->data[i_314406].link;
				entry_314211.linktitle = entries->data[i_314406].linktitle;
				entry_314211.linkdesc = entries->data[i_314406].linkdesc;
				LOC4 = 0;
				LOC4 = or_312713(entry_314211.linktitle, entry_314211.keyword);
				memset((void*)(&LOC5), 0, sizeof(LOC5));
				striptoclevel_313981(LOC4, (&LOC5));
				rawlevel = 0;
				rawlevel = LOC5.Field0;
				rawtext = 0;
				rawtext = LOC5.Field1;
				{
					NimStringDesc* LOC10;
					if (!(rawlevel < ((NI) 1))) goto LA8;
					levels->data[L_314071].Field0 = (NI)(level + ((NI) 1));
					LOC10 = 0;
					LOC10 = levels->data[L_314071].Field1; levels->data[L_314071].Field1 = copyStringRC1(entry_314211.keyword);
					if (LOC10) nimGCunrefNoCycle(LOC10);
				}
				goto LA6;
				LA8: ;
				{
					NimStringDesc* LOC12;
					level = rawlevel;
					levels->data[L_314071].Field0 = rawlevel;
					LOC12 = 0;
					LOC12 = levels->data[L_314071].Field1; levels->data[L_314071].Field1 = copyStringRC1(rawtext);
					if (LOC12) nimGCunrefNoCycle(LOC12);
				}
				LA6: ;
				L_314071 += ((NI) 1);
				i_314406 += ((NI) 1);
			} LA3: ;
		}
	}
	result = copyString(((NimStringDesc*) &TMP4939));
	level = ((NI) 1);
	L_314071 = ((NI) 0);
	{
		while (1) {
			NimStringDesc* link;
			if (!(L_314071 < (entries ? entries->Sup.len : 0))) goto LA14;
			link = entries->data[L_314071].link;
			{
				NIM_BOOL LOC17;
				LOC17 = 0;
				LOC17 = isdocumentationtitle_313971(link);
				if (!LOC17) goto LA18;
				titleref = copyString(link);
			}
			goto LA15;
			LA18: ;
			{
				NimStringDesc* LOC21;
				NimStringDesc* LOC22;
				LOC21 = 0;
				LOC21 = indenttolevel_314048((&level), levels->data[L_314071].Field0);
				result = resizeString(result, LOC21->Sup.len + 0);
appendString(result, LOC21);
				LOC22 = 0;
				LOC22 = rawNewString(link->Sup.len + levels->data[L_314071].Field1->Sup.len + 21);
appendString(LOC22, ((NimStringDesc*) &TMP4942));
appendString(LOC22, link);
appendString(LOC22, ((NimStringDesc*) &TMP4928));
appendString(LOC22, levels->data[L_314071].Field1);
appendString(LOC22, ((NimStringDesc*) &TMP4943));
				result = resizeString(result, LOC22->Sup.len + 0);
appendString(result, LOC22);
			}
			LA15: ;
			L_314071 += ((NI) 1);
		} LA14: ;
	}
	LOC23 = 0;
	LOC24 = 0;
	LOC24 = indenttolevel_314048((&level), ((NI) 1));
	LOC23 = rawNewString(LOC24->Sup.len + 7);
appendString(LOC23, LOC24);
appendString(LOC23, ((NimStringDesc*) &TMP4944));
	result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationindex_314431)(Table313409 docs) {
	NimStringDesc* result_314434;
	TY315702* titles;
	TY315702* result_314436;
	TY314694 LOC14;
	result_314434 = 0;
	result_314434 = copyString(((NimStringDesc*) &TMP2097));
	result_314436 = (TY315702*) newSeq((&NTI315702), 0);
	{
		Tindexentry313396 x_314438;
		memset((void*)(&x_314438), 0, sizeof(x_314438));
		{
			NI h_315352;
			NI HEX3Atmp_315354;
			NI res_315356;
			h_315352 = 0;
			HEX3Atmp_315354 = 0;
			HEX3Atmp_315354 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_315356 = ((NI) 0);
			{
				while (1) {
					if (!(res_315356 <= HEX3Atmp_315354)) goto LA4;
					h_315352 = res_315356;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_157211(docs.data->data[h_315352].Field0);
						if (!LOC7) goto LA8;
						x_314438.keyword = docs.data->data[h_315352].Field1.keyword;
						x_314438.link = docs.data->data[h_315352].Field1.link;
						x_314438.linktitle = docs.data->data[h_315352].Field1.linktitle;
						x_314438.linkdesc = docs.data->data[h_315352].Field1.linkdesc;
						result_314436 = (TY315702*) incrSeq(&(result_314436)->Sup, sizeof(Tindexentry313396));
						LOC10 = 0;
						LOC10 = result_314436->data[result_314436->Sup.len-1].keyword; result_314436->data[result_314436->Sup.len-1].keyword = copyStringRC1(x_314438.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_314436->data[result_314436->Sup.len-1].link; result_314436->data[result_314436->Sup.len-1].link = copyStringRC1(x_314438.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_314436->data[result_314436->Sup.len-1].linktitle; result_314436->data[result_314436->Sup.len-1].linktitle = copyStringRC1(x_314438.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_314436->data[result_314436->Sup.len-1].linkdesc; result_314436->data[result_314436->Sup.len-1].linkdesc = copyStringRC1(x_314438.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
					}
					LA8: ;
					res_315356 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_314436, (&NTI315702));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP4936) (cmp_313430)); LOC14.ClEnv = NIM_NIL;
	sort_314687(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	{
		Tindexentry313396 title_315280;
		NI i_315362;
		NI L_315364;
		memset((void*)(&title_315280), 0, sizeof(title_315280));
		i_315362 = ((NI) 0);
		L_315364 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* toclist;
				TY315702* LOC18;
				NimStringDesc* LOC19;
				if (!(i_315362 < L_315364)) goto LA17;
				title_315280.keyword = titles->data[i_315362].keyword;
				title_315280.link = titles->data[i_315362].link;
				title_315280.linktitle = titles->data[i_315362].linktitle;
				title_315280.linkdesc = titles->data[i_315362].linkdesc;
				LOC18 = 0;
				LOC18 = HEX5BHEX5D_315282(docs, title_315280);
				toclist = generatedocumentationtoc_314060(LOC18);
				LOC19 = 0;
				LOC19 = rawNewString(title_315280.link->Sup.len + title_315280.keyword->Sup.len + toclist->Sup.len + 32);
appendString(LOC19, ((NimStringDesc*) &TMP4945));
appendString(LOC19, title_315280.link);
appendString(LOC19, ((NimStringDesc*) &TMP4928));
appendString(LOC19, title_315280.keyword);
appendString(LOC19, ((NimStringDesc*) &TMP4943));
appendString(LOC19, toclist);
appendString(LOC19, ((NimStringDesc*) &TMP4944));
				result_314434 = resizeString(result_314434, LOC19->Sup.len + 0);
appendString(result_314434, LOC19);
				i_315362 += ((NI) 1);
			} LA17: ;
		}
	}
	return result_314434;
}

N_NIMCALL(void, sortindex_313818)(Tindexentry313396* 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_313844;
				NI HEX3Atmp_313855;
				NI res_313858;
				i_313844 = 0;
				HEX3Atmp_313855 = 0;
				HEX3Atmp_313855 = (NI)(n - ((NI) 1));
				res_313858 = h;
				{
					while (1) {
						Tindexentry313396 v;
						NI j;
						if (!(res_313858 <= HEX3Atmp_313855)) goto LA11;
						i_313844 = res_313858;
						memset((void*)(&v), 0, sizeof(v));
						HEX3CHEX2D_313807((&v), a[i_313844]);
						j = i_313844;
						{
							while (1) {
								NI LOC14;
								LOC14 = 0;
								LOC14 = cmp_313430(a[(NI)(j - h)], v);
								if (!(((NI) 0) <= LOC14)) goto LA13;
								HEX3CHEX2D_313807((&a[j]), a[(NI)(j - h)]);
								j = (NI)(j - h);
								{
									if (!(j < h)) goto LA17;
									goto LA12;
								}
								LA17: ;
							} LA13: ;
						} LA12: ;
						HEX3CHEX2D_313807((&a[j]), v);
						res_313858 += ((NI) 1);
					} LA11: ;
				}
			}
			{
				if (!(h == ((NI) 1))) goto LA21;
				goto LA7;
			}
			LA21: ;
		}
	} LA7: ;
}

N_NIMCALL(NimStringDesc*, generatesymbolindex_313895)(TY315702* symbols) {
	NimStringDesc* result;
	NI i;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2097));
	i = ((NI) 0);
	{
		while (1) {
			NimStringDesc* keyword;
			NimStringDesc* cleanedkeyword;
			Slice87574 LOC3;
			TY155943 LOC4;
			NI j;
			if (!(i < (symbols ? symbols->Sup.len : 0))) goto LA2;
			keyword = symbols->data[i].keyword;
			LOC3 = HEX2EHEX2E_109273(((NI) 1), (NI)((keyword ? (keyword->Sup.len-1) : -1) - ((NI) 1)));
			cleanedkeyword = HEX5BHEX5D_87567(keyword, LOC3);
			memset((void*)LOC4, 0, sizeof(LOC4));
			LOC4[0] = copyString(keyword);
			LOC4[1] = copyString(cleanedkeyword);
			nsuAddf((&result), ((NimStringDesc*) &TMP4947), 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*) &TMP2097));
					}
					LA14: ;
					{
						TY177061 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*) &TMP4948), LOC23, 3);
					}
					goto LA19;
					LA21: ;
					{
						TY155943 LOC25;
						memset((void*)LOC25, 0, sizeof(LOC25));
						LOC25[0] = copyString(url);
						LOC25[1] = copyString(text);
						nsuAddf((&result), ((NimStringDesc*) &TMP4949), LOC25, 2);
					}
					LA19: ;
					j += ((NI) 1);
				} LA6: ;
			}
			result = resizeString(result, 12);
appendString(result, ((NimStringDesc*) &TMP4950));
			i = j;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, mergeindexes_317737)(NimStringDesc* dir) {
	NimStringDesc* result;
	TY315699 LOC1;
	TY123008* modules;
	TY315702* symbols;
	Table313409 docs;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	readindexdir_315696(dir, (&LOC1));
	modules = 0;
	genericSeqAssign((&modules), LOC1.Field0, (&NTI123008));
	symbols = 0;
	genericSeqAssign((&symbols), LOC1.Field1, (&NTI315702));
	memset((void*)(&docs), 0, sizeof(docs));
	genericSeqAssign((&docs.data), LOC1.Field2.data, (&NTI313412));
	docs.counter = LOC1.Field2.counter;
	result = copyString(((NimStringDesc*) &TMP2097));
	{
		NI LOC4;
		NimStringDesc* LOC7;
		LOC4 = 0;
		LOC4 = len_316060(docs);
		if (!(((NI) 0) < LOC4)) goto LA5;
		LOC7 = 0;
		LOC7 = generatedocumentationjumps_315392(docs);
		result = resizeString(result, LOC7->Sup.len + 0);
appendString(result, LOC7);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP4932));
	}
	LA5: ;
	{
		NimStringDesc* LOC12;
		if (!(((NI) 0) < (modules ? modules->Sup.len : 0))) goto LA10;
		LOC12 = 0;
		LOC12 = generatemodulejumps_315631(modules);
		result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP4932));
	}
	LA10: ;
	{
		NI LOC15;
		NimStringDesc* LOC18;
		LOC15 = 0;
		LOC15 = len_316060(docs);
		if (!(((NI) 0) < LOC15)) goto LA16;
		result = resizeString(result, 30);
appendString(result, ((NimStringDesc*) &TMP4935));
		LOC18 = 0;
		LOC18 = generatedocumentationindex_314431(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_313818(symbols->data, symbols->Sup.len);
		result = resizeString(result, 22);
appendString(result, ((NimStringDesc*) &TMP4946));
		LOC23 = 0;
		LOC23 = generatesymbolindex_313895(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_312489; splitter_312489 = copyStringRC1(((NimStringDesc*) &TMP900));
	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* TMP4937[2];
static TNimNode TMP892[29];
NTI312016.size = sizeof(Trstgenerator312016);
NTI312016.kind = 17;
NTI312016.base = (&NTI3411);
TMP4757[0] = &TMP892[1];
NTI312010.size = sizeof(NU8);
NTI312010.kind = 14;
NTI312010.base = 0;
NTI312010.flags = 3;
for (TMP4760 = 0; TMP4760 < 2; TMP4760++) {
TMP892[TMP4760+2].kind = 1;
TMP892[TMP4760+2].offset = TMP4760;
TMP892[TMP4760+2].name = TMP4759[TMP4760];
TMP4758[TMP4760] = &TMP892[TMP4760+2];
}
TMP892[4].len = 2; TMP892[4].kind = 2; TMP892[4].sons = &TMP4758[0];
NTI312010.node = &TMP892[4];
TMP892[1].kind = 1;
TMP892[1].offset = offsetof(Trstgenerator312016, target);
TMP892[1].typ = (&NTI312010);
TMP892[1].name = "target";
TMP4757[1] = &TMP892[5];
TMP892[5].kind = 1;
TMP892[5].offset = offsetof(Trstgenerator312016, config);
TMP892[5].typ = (&NTI136014);
TMP892[5].name = "config";
TMP4757[2] = &TMP892[6];
TMP892[6].kind = 1;
TMP892[6].offset = offsetof(Trstgenerator312016, splitafter);
TMP892[6].typ = (&NTI108);
TMP892[6].name = "splitAfter";
TMP4757[3] = &TMP892[7];
NTI312012.size = sizeof(Ttocentry312012);
NTI312012.kind = 18;
NTI312012.base = 0;
NTI312012.flags = 2;
TMP4761[0] = &TMP892[9];
TMP892[9].kind = 1;
TMP892[9].offset = offsetof(Ttocentry312012, n);
TMP892[9].typ = (&NTI297007);
TMP892[9].name = "n";
TMP4761[1] = &TMP892[10];
TMP892[10].kind = 1;
TMP892[10].offset = offsetof(Ttocentry312012, refname);
TMP892[10].typ = (&NTI149);
TMP892[10].name = "refname";
TMP4761[2] = &TMP892[11];
TMP892[11].kind = 1;
TMP892[11].offset = offsetof(Ttocentry312012, header);
TMP892[11].typ = (&NTI149);
TMP892[11].name = "header";
TMP892[8].len = 3; TMP892[8].kind = 2; TMP892[8].sons = &TMP4761[0];
NTI312012.node = &TMP892[8];
NTI312034.size = sizeof(TY312034*);
NTI312034.kind = 24;
NTI312034.base = (&NTI312012);
NTI312034.flags = 2;
NTI312034.marker = TMP4762;
TMP892[7].kind = 1;
TMP892[7].offset = offsetof(Trstgenerator312016, tocpart);
TMP892[7].typ = (&NTI312034);
TMP892[7].name = "tocPart";
TMP4757[4] = &TMP892[12];
TMP892[12].kind = 1;
TMP892[12].offset = offsetof(Trstgenerator312016, hastoc);
TMP892[12].typ = (&NTI138);
TMP892[12].name = "hasToc";
TMP4757[5] = &TMP892[13];
TMP892[13].kind = 1;
TMP892[13].offset = offsetof(Trstgenerator312016, theindex);
TMP892[13].typ = (&NTI149);
TMP892[13].name = "theIndex";
TMP4757[6] = &TMP892[14];
TMP892[14].kind = 1;
TMP892[14].offset = offsetof(Trstgenerator312016, options);
TMP892[14].typ = (&NTI298015);
TMP892[14].name = "options";
TMP4757[7] = &TMP892[15];
TMP892[15].kind = 1;
TMP892[15].offset = offsetof(Trstgenerator312016, findfile);
TMP892[15].typ = (&NTI298023);
TMP892[15].name = "findFile";
TMP4757[8] = &TMP892[16];
TMP892[16].kind = 1;
TMP892[16].offset = offsetof(Trstgenerator312016, msghandler);
TMP892[16].typ = (&NTI298021);
TMP892[16].name = "msgHandler";
TMP4757[9] = &TMP892[17];
TMP892[17].kind = 1;
TMP892[17].offset = offsetof(Trstgenerator312016, filename);
TMP892[17].typ = (&NTI149);
TMP892[17].name = "filename";
TMP4757[10] = &TMP892[18];
NTI312042.size = sizeof(TY312042);
NTI312042.kind = 16;
NTI312042.base = (&NTI149);
NTI312042.flags = 2;
TMP892[18].kind = 1;
TMP892[18].offset = offsetof(Trstgenerator312016, meta);
TMP892[18].typ = (&NTI312042);
TMP892[18].name = "meta";
TMP4757[11] = &TMP892[19];
TMP892[19].kind = 1;
TMP892[19].offset = offsetof(Trstgenerator312016, currentsection);
TMP892[19].typ = (&NTI149);
TMP892[19].name = "currentSection";
TMP4757[12] = &TMP892[20];
TMP892[20].kind = 1;
TMP892[20].offset = offsetof(Trstgenerator312016, seenindexterms);
TMP892[20].typ = (&NTI312052);
TMP892[20].name = "seenIndexTerms";
TMP892[0].len = 13; TMP892[0].kind = 2; TMP892[0].sons = &TMP4757[0];
NTI312016.node = &TMP892[0];
NTI313396.size = sizeof(Tindexentry313396);
NTI313396.kind = 18;
NTI313396.base = 0;
NTI313396.flags = 2;
TMP4914[0] = &TMP892[22];
TMP892[22].kind = 1;
TMP892[22].offset = offsetof(Tindexentry313396, keyword);
TMP892[22].typ = (&NTI149);
TMP892[22].name = "keyword";
TMP4914[1] = &TMP892[23];
TMP892[23].kind = 1;
TMP892[23].offset = offsetof(Tindexentry313396, link);
TMP892[23].typ = (&NTI149);
TMP892[23].name = "link";
TMP4914[2] = &TMP892[24];
TMP892[24].kind = 1;
TMP892[24].offset = offsetof(Tindexentry313396, linktitle);
TMP892[24].typ = (&NTI149);
TMP892[24].name = "linkTitle";
TMP4914[3] = &TMP892[25];
TMP892[25].kind = 1;
TMP892[25].offset = offsetof(Tindexentry313396, linkdesc);
TMP892[25].typ = (&NTI149);
TMP892[25].name = "linkDesc";
TMP892[21].len = 4; TMP892[21].kind = 2; TMP892[21].sons = &TMP4914[0];
NTI313396.node = &TMP892[21];
NTI315702.size = sizeof(TY315702*);
NTI315702.kind = 24;
NTI315702.base = (&NTI313396);
NTI315702.flags = 2;
NTI315702.marker = TMP4915;
NTI314067.size = sizeof(TY314067);
NTI314067.kind = 18;
NTI314067.base = 0;
NTI314067.flags = 2;
TMP4937[0] = &TMP892[27];
TMP892[27].kind = 1;
TMP892[27].offset = offsetof(TY314067, Field0);
TMP892[27].typ = (&NTI108);
TMP892[27].name = "Field0";
TMP4937[1] = &TMP892[28];
TMP892[28].kind = 1;
TMP892[28].offset = offsetof(TY314067, Field1);
TMP892[28].typ = (&NTI149);
TMP892[28].name = "Field1";
TMP892[26].len = 2; TMP892[26].kind = 2; TMP892[26].sons = &TMP4937[0];
NTI314067.node = &TMP892[26];
NTI314066.size = sizeof(TY314066*);
NTI314066.kind = 24;
NTI314066.base = (&NTI314067);
NTI314066.flags = 2;
NTI314066.marker = TMP4938;
}

