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

#include "nimbase.h"
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell48947 Cell48947;
typedef struct TNimType TNimType;
typedef struct Cellseq48963 Cellseq48963;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48959 Cellset48959;
typedef struct Pagedesc48955 Pagedesc48955;
typedef struct Memregion30891 Memregion30891;
typedef struct Smallchunk30843 Smallchunk30843;
typedef struct Llchunk30885 Llchunk30885;
typedef struct Bigchunk30845 Bigchunk30845;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30889 Avlnode30889;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Rstgenerator346016 Rstgenerator346016;
typedef struct Rstnode331011 Rstnode331011;
typedef struct Rstnodeseq331009 Rstnodeseq331009;
typedef struct TNimObject TNimObject;
typedef struct TNimNode TNimNode;
typedef struct Stringtableobj145212 Stringtableobj145212;
typedef struct TY346035 TY346035;
typedef struct Table346053 Table346053;
typedef struct Keyvaluepairseq346056 Keyvaluepairseq346056;
typedef struct Tocentry346012 Tocentry346012;
typedef struct Codeblockparams346020 Codeblockparams346020;
typedef struct Keyvaluepair145208 Keyvaluepair145208;
typedef struct Generaltokenizer340023 Generaltokenizer340023;
typedef struct TY123809 TY123809;
typedef struct TY350504 TY350504;
typedef struct TY130408 TY130408;
typedef struct TY350507 TY350507;
typedef struct Indexentry347397 Indexentry347397;
typedef struct Table347410 Table347410;
typedef struct Keyvaluepairseq347413 Keyvaluepairseq347413;
typedef struct Keyvaluepair347416 Keyvaluepair347416;
typedef struct TY348074 TY348074;
typedef struct TY348075 TY348075;
typedef struct Slice90365 Slice90365;
typedef struct Basechunk30841 Basechunk30841;
typedef struct Freecell30833 Freecell30833;
typedef struct Keyvaluepairseq145210 Keyvaluepairseq145210;
typedef struct Keyvaluepair346059 Keyvaluepair346059;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Cell48947  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48963  {
NI len;
NI cap;
Cell48947** d;
};
struct  Cellset48959  {
NI counter;
NI max;
Pagedesc48955* head;
Pagedesc48955** data;
};
typedef Smallchunk30843* TY30906[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30891  {
NI minlargeobj;
NI maxlargeobj;
TY30906 freesmallchunks;
Llchunk30885* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30845* freechunkslist;
Intset30817 chunkstarts;
Avlnode30889* root;
Avlnode30889* deleted;
Avlnode30889* last;
Avlnode30889* freeavlnodes;
};
struct  Gcstat51014  {
NI stackscans;
NI cyclecollections;
NI maxthreshold;
NI maxstacksize;
NI maxstackcells;
NI cycletablesize;
NI64 maxpause;
};
struct  Gcheap51018  {
Gcstack51016* stack;
void* stackbottom;
NI cyclethreshold;
Cellseq48963 zct;
Cellseq48963 decstack;
Cellset48959 cycleroots;
Cellseq48963 tempstack;
NI recgclock;
Memregion30891 region;
Gcstat51014 stat;
};
struct  Rstnode331011  {
NU8 kind;
NimStringDesc* text;
NI level;
Rstnodeseq331009* sons;
};
typedef N_NIMCALL_PTR(void, TY3889) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3894) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3889 marker;
TY3894 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
typedef N_NIMCALL_PTR(NimStringDesc*, Findfilehandler332023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, Msghandler332021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
typedef NimStringDesc* TY346045[5];
struct  Table346053  {
Keyvaluepairseq346056* data;
NI counter;
};
struct  Rstgenerator346016  {
  TNimObject Sup;
NU8 target;
Stringtableobj145212* config;
NI splitafter;
NI listingcounter;
TY346035* tocpart;
NIM_BOOL hastoc;
NimStringDesc* theindex;
NU8 options;
Findfilehandler332023 findfile;
Msghandler332021 msghandler;
NimStringDesc* filename;
TY346045 meta;
NimStringDesc* currentsection;
Table346053 seenindexterms;
};
struct  Tocentry346012  {
Rstnode331011* n;
NimStringDesc* refname;
NimStringDesc* header;
};
typedef NimStringDesc* TY193829[4];
typedef NimStringDesc* TY191421[1];
typedef NU8 TY212407[32];
typedef NimStringDesc* TY192306[2];
struct  Codeblockparams346020  {
NIM_BOOL numberlines;
NI startline;
NimStringDesc* langstr;
NU8 lang;
};
struct Keyvaluepair145208 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
typedef NimStringDesc* TY252724[1];
struct  Generaltokenizer340023  {
  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* TY340090[33];
struct TY123809 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  Indexentry347397  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
struct  Table347410  {
Keyvaluepairseq347413* data;
NI counter;
};
struct TY350504 {
TY130408* Field0;
TY350507* Field1;
Table347410 Field2;
};
typedef NIM_CHAR TY113386[256];
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (NimStringDesc* x_351107, NimStringDesc* y_351109, void* ClEnv);
void* ClEnv;
} TY351105;
typedef N_CLOSURE_PTR(NI, TMP5182) (NimStringDesc* x_351094, NimStringDesc* y_351096, void* ClEnv);
struct Keyvaluepair347416 {
NI Field0;
Indexentry347397 Field1;
TY350507* Field2;
};
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Indexentry347397* x_349029, Indexentry347397* y_349031, void* ClEnv);
void* ClEnv;
} TY349027;
typedef N_CLOSURE_PTR(NI, TMP5186) (Indexentry347397* x_350330, Indexentry347397* y_350332, void* ClEnv);
typedef N_CLOSURE_PTR(NI, TMP5196) (Indexentry347397* x_349016, Indexentry347397* y_349018, void* ClEnv);
struct TY348075 {
NI Field0;
NimStringDesc* Field1;
};
struct  Slice90365  {
NI a;
NI b;
};
typedef NimStringDesc* TY192293[3];
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30822[8];
struct  Pagedesc48955  {
Pagedesc48955* next;
NI key;
TY30822 bits;
};
struct  Basechunk30841  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30843  {
  Basechunk30841 Sup;
Smallchunk30843* next;
Smallchunk30843* prev;
Freecell30833* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30885  {
NI size;
NI acc;
Llchunk30885* next;
};
struct  Bigchunk30845  {
  Basechunk30841 Sup;
Bigchunk30845* next;
Bigchunk30845* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30822 bits;
};
typedef Avlnode30889* TY30896[2];
struct  Avlnode30889  {
TY30896 link;
NI key;
NI upperbound;
NI level;
};
struct  Stringtableobj145212  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq145210* data;
NU8 mode;
};
struct Keyvaluepair346059 {
NI Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  Freecell30833  {
Freecell30833* next;
NI zerofield;
};
struct TY346035 {
  TGenericSeq Sup;
  Tocentry346012 data[SEQ_DECL_SIZE];
};
struct Rstnodeseq331009 {
  TGenericSeq Sup;
  Rstnode331011* data[SEQ_DECL_SIZE];
};
struct TY130408 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct TY350507 {
  TGenericSeq Sup;
  Indexentry347397 data[SEQ_DECL_SIZE];
};
struct TY348074 {
  TGenericSeq Sup;
  TY348075 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq346056 {
  TGenericSeq Sup;
  Keyvaluepair346059 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq347413 {
  TGenericSeq Sup;
  Keyvaluepair347416 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq145210 {
  TGenericSeq Sup;
  Keyvaluepair145208 data[SEQ_DECL_SIZE];
};
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Cell48947*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48947* c);
N_NOINLINE(void, addzct_52617)(Cellseq48963* s, Cell48947* c);
N_NIMCALL(void, renderaux_346734)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(NI, len_331090)(Rstnode331011* n);
N_NIMCALL(void, renderrsttoout_346724)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(void, renderheadline_352861)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, rstnodetorefname_332067)(Rstnode331011* 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_346689)(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_346855)(Rstgenerator346016* 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_346835)(NimStringDesc* text);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(void, insert_92001)(NimStringDesc** x, NimStringDesc* item, NI i);
N_NIMCALL(NimStringDesc*, striptochtml_352841)(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_353045)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(void, renderaux_346776)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result);
N_NIMCALL(void, renderfield_354717)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, addnodes_332073)(Rstnode331011* n);
N_NIMCALL(NimStringDesc*, esc_346553)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NI, nextsplitpoint_346506)(NimStringDesc* s, NI start);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(void, escchar_346494)(NU8 target, NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addxmlchar_346456)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addtexchar_346478)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, nsuStrip)(NimStringDesc* s, NIM_BOOL leading, NIM_BOOL trailing, TY212407 chars);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NOINLINE(void, raiseassert_90971)(NimStringDesc* msg);
N_NIMCALL(NimStringDesc*, texcolumns_354677)(Rstnode331011* n);
N_NIMCALL(Rstnode331011*, lastson_331153)(Rstnode331011* n);
N_NIMCALL(void, renderimage_353213)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, getfieldvalue_332079)(Rstnode331011* n, NimStringDesc* fieldname);
N_NIMCALL(NIM_BOOL, allcharsinset_103130)(NimStringDesc* s, TY212407 theset);
N_NIMCALL(NimStringDesc*, dispf_346666)(NU8 target, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getargument_332086)(Rstnode331011* n);
N_NIMCALL(void, rendercodeblock_354233)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(void, parsecodeblockparams_353508)(Rstgenerator346016* d, Rstnode331011* n, Codeblockparams346020* Result);
N_NIMCALL(void, init_346086)(Codeblockparams346020* p);
N_NIMCALL(void, parsecodeblockfield_353493)(Rstgenerator346016* d, Rstnode331011* n, Codeblockparams346020* params);
N_NIMCALL(NimStringDesc*, nsuToLowerStr)(NimStringDesc* s);
N_NIMCALL(NI, npuParseInt)(NimStringDesc* s, NI* number, NI start);
N_NIMCALL(NimStringDesc*, getfieldvalue_335314)(Rstnode331011* n);
N_NIMCALL(NU8, getsourcelanguage_340099)(NimStringDesc* name);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, buildlineshtmltable_354035)(Rstgenerator346016* d, Codeblockparams346020* params, NimStringDesc* code, Keyvaluepair145208* Result);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, getordefault_146020)(Stringtableobj145212* t, NimStringDesc* key);
N_NIMCALL(NI, nsuCountLines)(NimStringDesc* s);
N_NIMCALL(void, initgeneraltokenizer_340289)(Generaltokenizer340023* g, NimStringDesc* buf);
N_NIMCALL(void, getnexttoken_342766)(Generaltokenizer340023* g, NU8 lang);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI start_81016, NI last);
N_NIMCALL(NimStringDesc*, copyStrLast)(NimStringDesc* s, NI first, NI last);
N_NIMCALL(void, deinitgeneraltokenizer_340300)(Generaltokenizer340023* g);
N_NIMCALL(void, rendercontainer_354658)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(void, renderindexterm_347068)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(NIM_BOOL, haskey_347076)(Table346053 t, NimStringDesc* key);
N_NIMCALL(void, HEX5BHEX5DHEX3D_347152)(Table346053* t, NimStringDesc* key, NI val);
N_NIMCALL(NI, getordefault_347120)(Table346053 t, NimStringDesc* key);
N_NIMCALL(void, rendersmiley_353479)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP5017)(void* p, NI op);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY123809* Result);
N_NIMCALL(void, inittable_346124)(NI initialsize, Table346053* Result);
N_NIMCALL(NI, nsuParseInt)(NimStringDesc* s);
N_NIMCALL(void, rendertocentry_353162)(Rstgenerator346016* d, Tocentry346012* e, NimStringDesc** result);
N_NIMCALL(void, rendertocentries_353176)(Rstgenerator346016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, writefile_16875)(NimStringDesc* filename, NimStringDesc* content);
N_NIMCALL(void, readindexdir_350501)(NimStringDesc* dir, TY350504* Result);
N_NIMCALL(void, inittable_350529)(NI initialsize, Table347410* Result);
N_NIMCALL(void, TMP5174)(void* p, NI op);
N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
N_NIMCALL(NimStringDesc*, HEX2F_123481)(NimStringDesc* head, NimStringDesc* tail);
static N_INLINE(NIM_BOOL, direxists_127020)(NimStringDesc* dir);
N_NIMCALL(NIM_BOOL, nosexistsDir)(NimStringDesc* dir);
N_NIMCALL(NIM_BOOL, nsuEndsWith)(NimStringDesc* s, NimStringDesc* suffix);
N_NIMCALL(FILE*, open_16817)(NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_BOOL, readline_16919)(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_347979)(NimStringDesc* hyperlink);
N_NIMCALL(TY130408*, nsuSplitChar)(NimStringDesc* s, NIM_CHAR sep);
N_NIMCALL(NimStringDesc*, unquoteindexcolumn_346845)(NimStringDesc* text);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(NI, len_350860)(Table347410 t);
N_NIMCALL(void, HEX5BHEX5DHEX3D_350872)(Table347410* t, Indexentry347397* key, TY350507* val);
static N_INLINE(NI, HEX21HEX26_142013)(NI h, NI val);
N_NIMCALL(NI, hash_142848)(NimStringDesc* x);
static N_INLINE(NimStringDesc*, or_346713)(NimStringDesc* x, NimStringDesc* y);
static N_INLINE(NI, HEX21HEX24_142042)(NI h);
N_NIMCALL(void, sort_351098)(NimStringDesc** a, NI aLen0, TY351105 cmp, NU8 order);
N_NIMCALL(NI, cmp_6577)(NimStringDesc* x, NimStringDesc* y);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_85804, TNimType* mt);
N_NIMCALL(NimStringDesc*, generatedocumentationjumps_349796)(Table347410 docs);
static N_INLINE(NIM_BOOL, isfilled_169281)(NI hcode);
N_NIMCALL(void, sort_349020)(Indexentry347397* a, NI aLen0, TY349027 cmp, NU8 order);
N_NIMCALL(NI, cmp_347436)(Indexentry347397* a, Indexentry347397* b);
N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen0, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, generatemodulejumps_350436)(TY130408* modules);
N_NIMCALL(NimStringDesc*, generatedocumentationindex_348431)(Table347410 docs);
N_NIMCALL(NimStringDesc*, generatedocumentationtoc_348068)(TY350507* entries);
N_NIMCALL(void, TMP5198)(void* p, NI op);
N_NIMCALL(void, striptoclevel_347989)(NimStringDesc* s, TY348075* Result);
static N_INLINE(NimStringDesc*, HEX5BHEX5D_90358)(NimStringDesc* s, Slice90365 x);
static N_INLINE(Slice90365, HEX2EHEX2E_105291)(NI a, NI b);
N_NIMCALL(NimStringDesc*, indenttolevel_348056)(NI* level, NI newlevel);
N_NIMCALL(NimStringDesc*, nsuRepeatStr)(NimStringDesc* s, NI n);
N_NIMCALL(TY350507*, getordefault_349683)(Table347410 t, Indexentry347397* key);
N_NIMCALL(void, sortindex_347826)(Indexentry347397* a, NI aLen0);
N_NIMCALL(void, HEX3CHEX2D_347815)(Indexentry347397* a, Indexentry347397* b);
N_NIMCALL(NimStringDesc*, generatesymbolindex_347903)(TY350507* symbols);
STRING_LITERAL(TMP977, "<wbr />", 7);
STRING_LITERAL(TMP2203, "", 0);
STRING_LITERAL(TMP2205, "-", 1);
STRING_LITERAL(TMP2206, "\012<h$1><a class=\"toc-backref\" id=\"$2\" href=\"#$2\">$3</a></h$1>", 60);
STRING_LITERAL(TMP2207, "\\rsth$4{$3}\\label{$2}\012", 22);
STRING_LITERAL(TMP2208, "\012<h$1 id=\"$2\">$3</h$1>", 22);
STRING_LITERAL(TMP2209, "html", 4);
STRING_LITERAL(TMP2210, "\\", 1);
STRING_LITERAL(TMP2211, "\\\\", 2);
STRING_LITERAL(TMP2212, "\012", 1);
STRING_LITERAL(TMP2213, "\\n", 2);
STRING_LITERAL(TMP2214, "\011", 1);
STRING_LITERAL(TMP2215, "\\t", 2);
STRING_LITERAL(TMP2216, "<h$1 id=\"$2\"><center>$3</center></h$1>", 38);
STRING_LITERAL(TMP2217, "\\rstov$4{$3}\\label{$2}\012", 23);
STRING_LITERAL(TMP2218, "<hr />\012", 7);
STRING_LITERAL(TMP2219, "\\hrule\012", 7);
STRING_LITERAL(TMP2220, "<p>$1</p>\012", 10);
STRING_LITERAL(TMP2221, "$1\012\012", 4);
STRING_LITERAL(TMP2222, "<ul class=\"simple\">$1</ul>\012", 27);
STRING_LITERAL(TMP2223, "\\begin{itemize}$1\\end{itemize}\012", 31);
STRING_LITERAL(TMP2224, "<li>$1</li>\012", 12);
STRING_LITERAL(TMP2225, "\\item $1\012", 9);
STRING_LITERAL(TMP2226, "<ol class=\"simple\">$1</ol>\012", 27);
STRING_LITERAL(TMP2227, "\\begin{enumerate}$1\\end{enumerate}\012", 35);
STRING_LITERAL(TMP2228, "<dl class=\"docutils\">$1</dl>\012", 29);
STRING_LITERAL(TMP2229, "\\begin{description}$1\\end{description}\012", 39);
STRING_LITERAL(TMP2230, "<dt>$1</dt>\012", 12);
STRING_LITERAL(TMP2231, "\\item[$1] ", 10);
STRING_LITERAL(TMP2232, "<dd>$1</dd>\012", 12);
STRING_LITERAL(TMP2233, "$1\012", 3);
STRING_LITERAL(TMP2234, "<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(TMP2235, " ", 1);
STRING_LITERAL(TMP2236, "&amp;", 5);
STRING_LITERAL(TMP2237, "&lt;", 4);
STRING_LITERAL(TMP2238, "&gt;", 4);
STRING_LITERAL(TMP2239, "&quot;", 6);
STRING_LITERAL(TMP2240, "\\_", 2);
STRING_LITERAL(TMP2241, "\\symbol{123}", 12);
STRING_LITERAL(TMP2242, "\\symbol{125}", 12);
STRING_LITERAL(TMP2243, "\\symbol{91}", 11);
STRING_LITERAL(TMP2244, "\\symbol{93}", 11);
STRING_LITERAL(TMP2245, "\\symbol{92}", 11);
STRING_LITERAL(TMP2246, "\\$", 2);
STRING_LITERAL(TMP2247, "\\&", 2);
STRING_LITERAL(TMP2248, "\\#", 2);
STRING_LITERAL(TMP2249, "\\%", 2);
STRING_LITERAL(TMP2250, "\\symbol{126}", 12);
STRING_LITERAL(TMP2251, "\\symbol{64}", 11);
STRING_LITERAL(TMP2252, "\\symbol{94}", 11);
STRING_LITERAL(TMP2253, "\\symbol{96}", 11);
static NIM_CONST TY212407 TMP2254 = {
0x00, 0x3E, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
STRING_LITERAL(TMP2255, "author", 6);
STRING_LITERAL(TMP2256, "authors", 7);
STRING_LITERAL(TMP2257, "version", 7);
STRING_LITERAL(TMP2258, "<tr>$1</tr>\012", 12);
STRING_LITERAL(TMP2259, "$1", 2);
STRING_LITERAL(TMP2260, "<th class=\"docinfo-name\">$1:</th>", 33);
STRING_LITERAL(TMP2261, "\\item[$1:]", 10);
STRING_LITERAL(TMP2262, "<td>$1</td>", 11);
STRING_LITERAL(TMP2263, " $1\012", 4);
STRING_LITERAL(TMP2264, "<table frame=\"void\">$1</table>", 30);
STRING_LITERAL(TMP2265, "\\begin{description}\012$1\\end{description}\012", 40);
STRING_LITERAL(TMP2266, "<th align=\"left\">$1</th>", 24);
STRING_LITERAL(TMP2267, "\\item[$1]", 9);
STRING_LITERAL(TMP2268, "<td align=\"left\">$1</td>\012", 25);
STRING_LITERAL(TMP2270, "false renderRstToOut", 20);
STRING_LITERAL(TMP2271, "<pre>$1</pre>\012", 14);
STRING_LITERAL(TMP2272, "\\begin{rstpre}\012$1\012\\end{rstpre}\012", 31);
STRING_LITERAL(TMP2273, "<p>$1</p>", 9);
STRING_LITERAL(TMP2274, "$1<br />", 8);
STRING_LITERAL(TMP2275, "$1\\\\\012", 5);
STRING_LITERAL(TMP2276, "<blockquote><p>$1</p></blockquote>\012", 35);
STRING_LITERAL(TMP2277, "\\begin{quote}$1\\end{quote}\012", 27);
STRING_LITERAL(TMP2278, "<table border=\"1\" class=\"docutils\">$1</table>", 45);
STRING_LITERAL(TMP2279, "\\begin{table}\\begin{rsttab}{", 28);
STRING_LITERAL(TMP2280, "|X", 2);
STRING_LITERAL(TMP2281, "|}\012\\hline\012$1\\end{rsttab}\\end{table}", 35);
STRING_LITERAL(TMP2282, " & ", 3);
STRING_LITERAL(TMP2283, "\\\\\012\\hline\012", 10);
STRING_LITERAL(TMP2284, "<tr>", 4);
STRING_LITERAL(TMP2285, "</tr>\012", 6);
STRING_LITERAL(TMP2286, "<th>$1</th>", 11);
STRING_LITERAL(TMP2287, "\\textbf{$1}", 11);
STRING_LITERAL(TMP2288, "<a class=\"reference external\" href=\"#$2\">$1</a>", 47);
STRING_LITERAL(TMP2289, "$1\\ref{$2}", 10);
STRING_LITERAL(TMP2290, "<a class=\"reference external\" href=\"$1\">$1</a>", 46);
STRING_LITERAL(TMP2291, "\\href{$1}{$1}", 13);
STRING_LITERAL(TMP2292, "<a class=\"reference external\" href=\"$2\">$1</a>", 46);
STRING_LITERAL(TMP2293, "\\href{$2}{$1}", 13);
STRING_LITERAL(TMP2295, "scale", 5);
static NIM_CONST TY212407 TMP2296 = {
0x00, 0x3E, 0x00, 0x00, 0x21, 0xC0, 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(TMP2297, " scale=\"$1\"", 11);
STRING_LITERAL(TMP2298, " scale=$1", 9);
STRING_LITERAL(TMP2299, "height", 6);
STRING_LITERAL(TMP2300, " height=\"$1\"", 12);
STRING_LITERAL(TMP2301, " height=$1", 10);
STRING_LITERAL(TMP2302, "width", 5);
STRING_LITERAL(TMP2303, " width=\"$1\"", 11);
STRING_LITERAL(TMP2304, " width=$1", 9);
STRING_LITERAL(TMP2305, "alt", 3);
STRING_LITERAL(TMP2306, " alt=\"$1\"", 9);
STRING_LITERAL(TMP2307, "align", 5);
STRING_LITERAL(TMP2308, " align=\"$1\"", 11);
STRING_LITERAL(TMP2309, "[$1]", 4);
STRING_LITERAL(TMP2310, "<img src=\"$1\"$2 />", 18);
STRING_LITERAL(TMP2311, "\\includegraphics$2{$1}", 22);
STRING_LITERAL(TMP2312, "number-lines", 12);
STRING_LITERAL(TMP2313, "file", 4);
STRING_LITERAL(TMP2314, "default-language", 16);
STRING_LITERAL(TMP2323, "doc.listing_start", 17);
STRING_LITERAL(TMP2324, "doc.listing_end", 15);
STRING_LITERAL(TMP2325, "<table class=\"line-nums-table\"><tbody><tr><td class=\"blob-line-"
"nums\"><pre class=\"line-nums\">", 92);
STRING_LITERAL(TMP2326, "</pre></td><td>", 15);
STRING_LITERAL(TMP2327, "</td></tr></tbody></table>", 26);
STRING_LITERAL(TMP2328, "doc.listing_button", 18);
STRING_LITERAL(TMP2329, "\\begin{rstpre}\012", 15);
STRING_LITERAL(TMP2491, "<span class=\"$2\">$1</span>", 26);
STRING_LITERAL(TMP2492, "\\span$2{$1}", 11);
extern NIM_CONST TY340090 tokenclasstostr_340087;
STRING_LITERAL(TMP2526, "\012\\end{rstpre}\012", 14);
STRING_LITERAL(TMP2527, "<div>$1</div>", 13);
STRING_LITERAL(TMP2528, "<div class=\"$1\">$2</div>", 24);
STRING_LITERAL(TMP2529, "$2", 2);
STRING_LITERAL(TMP2530, "|$1|", 4);
STRING_LITERAL(TMP2531, "<sub>$1</sub>", 13);
STRING_LITERAL(TMP2532, "\\rstsub{$1}", 11);
STRING_LITERAL(TMP2533, "<sup>$1</sup>", 13);
STRING_LITERAL(TMP2534, "\\rstsup{$1}", 11);
STRING_LITERAL(TMP2535, "<em>$1</em>", 11);
STRING_LITERAL(TMP2536, "\\emph{$1}", 9);
STRING_LITERAL(TMP2537, "<strong>$1</strong>", 19);
STRING_LITERAL(TMP2538, "<strong><em>$1</em></strong>", 28);
STRING_LITERAL(TMP2539, "\\textbf{emph{$1}}", 17);
STRING_LITERAL(TMP2540, "<cite>$1</cite>", 15);
STRING_LITERAL(TMP2543, "<span id=\"$1\">$2</span>", 23);
STRING_LITERAL(TMP2544, "$2\\label{$1}", 12);
STRING_LITERAL(TMP2545, "<tt class=\"docutils literal\"><span class=\"pre\">$1</span></tt>", 61);
STRING_LITERAL(TMP2546, "\\texttt{$1}", 11);
STRING_LITERAL(TMP2547, "<img src=\"$1\" width=\"15\"\012        height=\"17\" hspace=\"2\" vspace="
"\"2\" class=\"smiley\" />", 84);
STRING_LITERAL(TMP2548, "\\includegraphics{$1}", 20);
STRING_LITERAL(TMP2549, "doc.smiley_format", 17);
STRING_LITERAL(TMP5021, ".nim", 4);
STRING_LITERAL(TMP5022, "Module ", 7);
STRING_LITERAL(TMP5023, "split.item.toc", 14);
STRING_LITERAL(TMP5102, "<li><a class=\"reference\" id=\"$1_toc\" href=\"#$1\">$2</a></li>\012", 60);
STRING_LITERAL(TMP5103, "\\item\\label{$1_toc} $2\\ref{$1}\012", 31);
STRING_LITERAL(TMP5104, "<ul class=\"simple\">$1</ul>", 26);
STRING_LITERAL(TMP5105, "\\begin{enumerate}$1\\end{enumerate}", 34);
STRING_LITERAL(TMP5176, ".", 1);
STRING_LITERAL(TMP5177, "..", 2);
STRING_LITERAL(TMP5178, ".idx", 4);
STRING_LITERAL(TMP5179, "doc_toc_", 8);
STRING_LITERAL(TMP5183, "Documents: ", 11);
STRING_LITERAL(TMP5187, "<a href=\"", 9);
STRING_LITERAL(TMP5188, "\">", 2);
STRING_LITERAL(TMP5189, "</a>", 4);
STRING_LITERAL(TMP5190, ", ", 2);
STRING_LITERAL(TMP5191, ".<br>", 5);
STRING_LITERAL(TMP5192, "<p />", 5);
STRING_LITERAL(TMP5193, "Modules: ", 9);
STRING_LITERAL(TMP5194, ".html\">", 7);
STRING_LITERAL(TMP5195, "<h2>Documentation files</h2>\012", 29);
STRING_LITERAL(TMP5199, "<ul>\012", 5);
STRING_LITERAL(TMP5200, "<ul>", 4);
STRING_LITERAL(TMP5201, "</ul>", 5);
STRING_LITERAL(TMP5202, "<li><a href=\"", 13);
STRING_LITERAL(TMP5203, "</a>\012", 5);
STRING_LITERAL(TMP5204, "</ul>\012", 6);
STRING_LITERAL(TMP5205, "<ul><li><a href=\"", 17);
STRING_LITERAL(TMP5206, "<h2>API symbols</h2>\012", 21);
STRING_LITERAL(TMP5207, "<dt><a name=\"$2\" href=\"#$2\"><span>$1:</span></a></dt><ul class="
"\"simple\"><dd>\012", 77);
STRING_LITERAL(TMP5208, "<li><a class=\"reference external\"\012          title=\"$3\" href=\"$1"
"\">$2</a></li>\012          ", 87);
STRING_LITERAL(TMP5209, "<li><a class=\"reference external\" href=\"$1\">$2</a></li>\012       "
"   ", 66);
STRING_LITERAL(TMP5210, "</ul></dd>\012", 11);
NimStringDesc* splitter_346489;
extern Gcheap51018 gch_51059;
extern TNimType NTI340023; /* GeneralTokenizer */
extern TNimType NTI4011; /* RootObj */
TNimType NTI346016; /* RstGenerator */
TNimType NTI346010; /* OutputTarget */
extern TNimType NTI145214; /* StringTableRef */
extern TNimType NTI108; /* int */
TNimType NTI346012; /* TocEntry */
extern TNimType NTI331007; /* PRstNode */
extern TNimType NTI149; /* string */
TNimType NTI346035; /* seq[TocEntry] */
extern TNimType NTI138; /* bool */
extern TNimType NTI332015; /* RstParseOptions */
extern TNimType NTI332023; /* FindFileHandler */
extern TNimType NTI332021; /* MsgHandler */
TNimType NTI346045; /* array[MetaEnum, string] */
extern TNimType NTI346053; /* Table */
extern TNimType NTI130408; /* seq[string] */
TNimType NTI347397; /* IndexEntry */
TNimType NTI350507; /* seq[IndexEntry] */
extern TNimType NTI347413; /* KeyValuePairSeq */
TNimType NTI348075; /* tuple[level: int, text: string] */
TNimType NTI348074; /* seq[tuple[level: int, text: string]] */

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

static N_INLINE(void, rtladdzct_54204)(Cell48947* c) {
	addzct_52617((&gch_51059.zct), c);
}

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

N_NIMCALL(void, renderaux_346734)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	{
		NI i_346752;
		NI HEX3Atmp_346754;
		NI LOC2;
		NI res_346757;
		i_346752 = 0;
		HEX3Atmp_346754 = 0;
		LOC2 = 0;
		LOC2 = len_331090(n);
		HEX3Atmp_346754 = (NI)(LOC2 - ((NI) 1));
		res_346757 = ((NI) 0);
		{
			while (1) {
				if (!(res_346757 <= HEX3Atmp_346754)) goto LA4;
				i_346752 = res_346757;
				renderrsttoout_346724(d, (*n).sons->data[i_346752], result);
				res_346757 += ((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) {
	{
		Cell48947* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_52646(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell48947* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_52646((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, dispa_346689)(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_346835)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2210), ((NimStringDesc*) &TMP2211));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2212), ((NimStringDesc*) &TMP2213));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2214), ((NimStringDesc*) &TMP2215));
	return result;
}

N_NIMCALL(void, setindexterm_346855)(Rstgenerator346016* 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*) &TMP2209));
	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_346835(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_346835(linkdesc);
		LOC15 = rawNewString(LOC16->Sup.len + 1);
appendChar(LOC15, 9);
appendString(LOC15, LOC16);
		entry = resizeString(entry, LOC15->Sup.len + 0);
appendString(entry, LOC15);
	}
	LA11: ;
	entry = resizeString(entry, 1);
appendString(entry, ((NimStringDesc*) &TMP2212));
	{
		if (!istitle) goto LA19;
		insert_92001((&(*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_352841)(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_352861)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* sectionprefix;
	NimStringDesc* refname;
	NimStringDesc* LOC14;
	NimStringDesc* LOC15;
	NimStringDesc* LOC25;
	NimStringDesc* LOC26;
	NimStringDesc* LOC27;
	tmp = copyString(((NimStringDesc*) &TMP2203));
	{
		NI i_352880;
		NI HEX3Atmp_353006;
		NI LOC2;
		NI res_353009;
		i_352880 = 0;
		HEX3Atmp_353006 = 0;
		LOC2 = 0;
		LOC2 = len_331090(n);
		HEX3Atmp_353006 = (NI)(LOC2 - ((NI) 1));
		res_353009 = ((NI) 0);
		{
			while (1) {
				if (!(res_353009 <= HEX3Atmp_353006)) goto LA4;
				i_352880 = res_353009;
				renderrsttoout_346724(d, (*n).sons->data[i_352880], (&tmp));
				res_353009 += ((NI) 1);
			} LA4: ;
		}
	}
	unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
	sectionprefix = copyString(((NimStringDesc*) &TMP2203));
	{
		NI i_352894;
		NI HEX3Atmp_353014;
		NI res_353017;
		i_352894 = 0;
		HEX3Atmp_353014 = 0;
		HEX3Atmp_353014 = ((*d).tocpart ? ((*d).tocpart->Sup.len-1) : -1);
		res_353017 = HEX3Atmp_353014;
		{
			while (1) {
				Rstnode331011* n2;
				if (!(((NI) 0) <= res_353017)) goto LA7;
				i_352894 = res_353017;
				n2 = (*d).tocpart->data[i_352894].n;
				{
					NimStringDesc* LOC12;
					NimStringDesc* LOC13;
					if (!((*n2).level < (*n).level)) goto LA10;
					LOC12 = 0;
					LOC13 = 0;
					LOC13 = rstnodetorefname_332067(n2);
					LOC12 = rawNewString(LOC13->Sup.len + 1);
appendString(LOC12, LOC13);
appendString(LOC12, ((NimStringDesc*) &TMP2205));
					sectionprefix = LOC12;
					goto LA5;
				}
				LA10: ;
				res_353017 -= ((NI) 1);
			} LA7: ;
		}
	} LA5: ;
	LOC14 = 0;
	LOC15 = 0;
	LOC15 = rstnodetorefname_332067(n);
	LOC14 = rawNewString(sectionprefix->Sup.len + LOC15->Sup.len + 0);
appendString(LOC14, sectionprefix);
appendString(LOC14, LOC15);
	refname = LOC14;
	{
		NI length;
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		TY193829 LOC22;
		if (!(*d).hastoc) goto LA18;
		length = ((*d).tocpart ? (*d).tocpart->Sup.len : 0);
		(*d).tocpart = (TY346035*) setLengthSeq(&((*d).tocpart)->Sup, sizeof(Tocentry346012), ((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_346689((*d).target, result, ((NimStringDesc*) &TMP2206), ((NimStringDesc*) &TMP2207), LOC22, 4);
	}
	goto LA16;
	LA18: ;
	{
		TY193829 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_346689((*d).target, result, ((NimStringDesc*) &TMP2208), ((NimStringDesc*) &TMP2207), LOC24, 4);
	}
	LA16: ;
	LOC25 = 0;
	LOC25 = striptochtml_352841(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_346855(d, refname, LOC25, LOC26, ((NimStringDesc*) &TMP2203));
}

N_NIMCALL(void, renderoverline_353045)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	{
		if (!(((*d).meta[(((NU8) 1))- 0] ? (*d).meta[(((NU8) 1))- 0]->Sup.len : 0) == ((NI) 0))) goto LA3;
		{
			NI i_353063;
			NI HEX3Atmp_353106;
			NI LOC6;
			NI res_353109;
			i_353063 = 0;
			HEX3Atmp_353106 = 0;
			LOC6 = 0;
			LOC6 = len_331090(n);
			HEX3Atmp_353106 = (NI)(LOC6 - ((NI) 1));
			res_353109 = ((NI) 0);
			{
				while (1) {
					if (!(res_353109 <= HEX3Atmp_353106)) goto LA8;
					i_353063 = res_353109;
					renderrsttoout_346724(d, (*n).sons->data[i_353063], (&(*d).meta[(((NU8) 1))- 0]));
					res_353109 += ((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_353077;
			NI HEX3Atmp_353114;
			NI LOC13;
			NI res_353117;
			i_353077 = 0;
			HEX3Atmp_353114 = 0;
			LOC13 = 0;
			LOC13 = len_331090(n);
			HEX3Atmp_353114 = (NI)(LOC13 - ((NI) 1));
			res_353117 = ((NI) 0);
			{
				while (1) {
					if (!(res_353117 <= HEX3Atmp_353114)) goto LA15;
					i_353077 = res_353117;
					renderrsttoout_346724(d, (*n).sons->data[i_353077], (&(*d).meta[(((NU8) 2))- 0]));
					res_353117 += ((NI) 1);
				} LA15: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString((*d).meta[(((NU8) 2))- 0]));
	}
	goto LA1;
	LA10: ;
	{
		NimStringDesc* tmp;
		TY193829 LOC21;
		tmp = copyString(((NimStringDesc*) &TMP2203));
		{
			NI i_353092;
			NI HEX3Atmp_353122;
			NI LOC18;
			NI res_353125;
			i_353092 = 0;
			HEX3Atmp_353122 = 0;
			LOC18 = 0;
			LOC18 = len_331090(n);
			HEX3Atmp_353122 = (NI)(LOC18 - ((NI) 1));
			res_353125 = ((NI) 0);
			{
				while (1) {
					if (!(res_353125 <= HEX3Atmp_353122)) goto LA20;
					i_353092 = res_353125;
					renderrsttoout_346724(d, (*n).sons->data[i_353092], (&tmp));
					res_353125 += ((NI) 1);
				} LA20: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nimIntToStr((*n).level);
		LOC21[1] = rstnodetorefname_332067(n);
		LOC21[2] = copyString(tmp);
		LOC21[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2216), ((NimStringDesc*) &TMP2217), LOC21, 4);
	}
	LA1: ;
}

N_NIMCALL(void, renderaux_346776)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2203));
	{
		NI i_346797;
		NI HEX3Atmp_346813;
		NI LOC2;
		NI res_346816;
		i_346797 = 0;
		HEX3Atmp_346813 = 0;
		LOC2 = 0;
		LOC2 = len_331090(n);
		HEX3Atmp_346813 = (NI)(LOC2 - ((NI) 1));
		res_346816 = ((NI) 0);
		{
			while (1) {
				if (!(res_346816 <= HEX3Atmp_346813)) goto LA4;
				i_346797 = res_346816;
				renderrsttoout_346724(d, (*n).sons->data[i_346797], (&tmp));
				res_346816 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		TY191421 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: ;
	{
		TY191421 LOC11;
		memset((void*)LOC11, 0, sizeof(LOC11));
		LOC11[0] = copyString(tmp);
		nsuAddf(result, frmtb, LOC11, 1);
	}
	LA5: ;
}

N_NIMCALL(NI, nextsplitpoint_346506)(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_346456)(NimStringDesc** dest, NIM_CHAR c) {
	switch (((NU8)(c))) {
	case 38:
	{
		(*dest) = resizeString((*dest), 5);
appendString((*dest), ((NimStringDesc*) &TMP2236));
	}
	break;
	case 60:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2237));
	}
	break;
	case 62:
	{
		(*dest) = resizeString((*dest), 4);
appendString((*dest), ((NimStringDesc*) &TMP2238));
	}
	break;
	case 34:
	{
		(*dest) = resizeString((*dest), 6);
appendString((*dest), ((NimStringDesc*) &TMP2239));
	}
	break;
	default:
	{
		(*dest) = addChar((*dest), c);
	}
	break;
	}
}

N_NIMCALL(void, addtexchar_346478)(NimStringDesc** dest, NIM_CHAR c) {
	switch (((NU8)(c))) {
	case 95:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2240));
	}
	break;
	case 123:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2241));
	}
	break;
	case 125:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2242));
	}
	break;
	case 91:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2243));
	}
	break;
	case 93:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2244));
	}
	break;
	case 92:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2245));
	}
	break;
	case 36:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2246));
	}
	break;
	case 38:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2247));
	}
	break;
	case 35:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2248));
	}
	break;
	case 37:
	{
		(*dest) = resizeString((*dest), 2);
appendString((*dest), ((NimStringDesc*) &TMP2249));
	}
	break;
	case 126:
	{
		(*dest) = resizeString((*dest), 12);
appendString((*dest), ((NimStringDesc*) &TMP2250));
	}
	break;
	case 64:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2251));
	}
	break;
	case 94:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2252));
	}
	break;
	case 96:
	{
		(*dest) = resizeString((*dest), 11);
appendString((*dest), ((NimStringDesc*) &TMP2253));
	}
	break;
	default:
	{
		(*dest) = addChar((*dest), c);
	}
	break;
	}
}

static N_INLINE(void, escchar_346494)(NU8 target, NimStringDesc** dest, NIM_CHAR c) {
	switch (target) {
	case ((NU8) 0):
	{
		addxmlchar_346456(dest, c);
	}
	break;
	case ((NU8) 1):
	{
		addtexchar_346478(dest, c);
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, esc_346553)(NU8 target, NimStringDesc* s, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2203));
	{
		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_346506(s, j);
				{
					NIM_BOOL LOC9;
					LOC9 = 0;
					LOC9 = !(eqStrings(splitter_346489, ((NimStringDesc*) &TMP2235)));
					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_346489->Sup.len + 0);
appendString(result, splitter_346489);
				}
				LA11: ;
				{
					NI i_346574;
					NI res_346603;
					i_346574 = 0;
					res_346603 = j;
					{
						while (1) {
							if (!(res_346603 <= k)) goto LA15;
							i_346574 = res_346603;
							escchar_346494(target, (&result), s->data[i_346574]);
							res_346603 += ((NI) 1);
						} LA15: ;
					}
				}
				partlen += (NI)((NI)(k - j) + ((NI) 1));
				j = (NI)(k + ((NI) 1));
			} LA6: ;
		}
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_346597;
			NI HEX3Atmp_346608;
			NI res_346611;
			i_346597 = 0;
			HEX3Atmp_346608 = 0;
			HEX3Atmp_346608 = (NI)((s ? s->Sup.len : 0) - ((NI) 1));
			res_346611 = ((NI) 0);
			{
				while (1) {
					if (!(res_346611 <= HEX3Atmp_346608)) goto LA19;
					i_346597 = res_346611;
					escchar_346494(target, (&result), s->data[i_346597]);
					res_346611 += ((NI) 1);
				} LA19: ;
			}
		}
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, renderfield_354717)(Rstgenerator346016* d, Rstnode331011* 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_332073((*n).sons->data[((NI) 0)]);
		LOC5 = 0;
		LOC5 = addnodes_332073((*n).sons->data[((NI) 1)]);
		LOC6 = 0;
		LOC6 = nsuStrip(LOC5, NIM_TRUE, NIM_TRUE, TMP2254);
		fieldval = esc_346553((*d).target, LOC6, ((NI) -1));
		{
			NIM_BOOL LOC9;
			NI LOC10;
			NI LOC12;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2255));
			LOC9 = (LOC10 == ((NI) 0));
			if (LOC9) goto LA11;
			LOC12 = 0;
			LOC12 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2256));
			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*) &TMP2257));
			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_346776(d, n, ((NimStringDesc*) &TMP2258), ((NimStringDesc*) &TMP2259), result);
	}
	LA29: ;
}

N_NIMCALL(NimStringDesc*, texcolumns_354677)(Rstnode331011* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2203));
	{
		NI i_354693;
		NI HEX3Atmp_354695;
		NI res_354698;
		i_354693 = 0;
		HEX3Atmp_354695 = 0;
		HEX3Atmp_354695 = len_331090(n);
		res_354698 = ((NI) 1);
		{
			while (1) {
				if (!(res_354698 <= HEX3Atmp_354695)) goto LA3;
				i_354693 = res_354698;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP2280));
				res_354698 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(NimStringDesc*, dispf_346666)(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_353213)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	NimStringDesc* options;
	NimStringDesc* s;
	NimStringDesc* arg;
	options = copyString(((NimStringDesc*) &TMP2203));
	s = getfieldvalue_332079(n, ((NimStringDesc*) &TMP2295));
	{
		NIM_BOOL LOC3;
		TY191421 LOC7;
		LOC3 = 0;
		LOC3 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = allcharsinset_103130(s, TMP2296);
		LA4: ;
		if (!LOC3) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2254);
		dispa_346689((*d).target, (&options), ((NimStringDesc*) &TMP2297), ((NimStringDesc*) &TMP2298), LOC7, 1);
	}
	LA5: ;
	s = getfieldvalue_332079(n, ((NimStringDesc*) &TMP2299));
	{
		NIM_BOOL LOC10;
		TY191421 LOC14;
		LOC10 = 0;
		LOC10 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC10)) goto LA11;
		LOC10 = allcharsinset_103130(s, TMP2296);
		LA11: ;
		if (!LOC10) goto LA12;
		memset((void*)LOC14, 0, sizeof(LOC14));
		LOC14[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2254);
		dispa_346689((*d).target, (&options), ((NimStringDesc*) &TMP2300), ((NimStringDesc*) &TMP2301), LOC14, 1);
	}
	LA12: ;
	s = getfieldvalue_332079(n, ((NimStringDesc*) &TMP2302));
	{
		NIM_BOOL LOC17;
		TY191421 LOC21;
		LOC17 = 0;
		LOC17 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC17)) goto LA18;
		LOC17 = allcharsinset_103130(s, TMP2296);
		LA18: ;
		if (!LOC17) goto LA19;
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2254);
		dispa_346689((*d).target, (&options), ((NimStringDesc*) &TMP2303), ((NimStringDesc*) &TMP2304), LOC21, 1);
	}
	LA19: ;
	s = getfieldvalue_332079(n, ((NimStringDesc*) &TMP2305));
	{
		NIM_BOOL LOC24;
		TY191421 LOC28;
		LOC24 = 0;
		LOC24 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC24)) goto LA25;
		LOC24 = allcharsinset_103130(s, TMP2296);
		LA25: ;
		if (!LOC24) goto LA26;
		memset((void*)LOC28, 0, sizeof(LOC28));
		LOC28[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2254);
		dispa_346689((*d).target, (&options), ((NimStringDesc*) &TMP2306), ((NimStringDesc*) &TMP2203), LOC28, 1);
	}
	LA26: ;
	s = getfieldvalue_332079(n, ((NimStringDesc*) &TMP2307));
	{
		NIM_BOOL LOC31;
		TY191421 LOC35;
		LOC31 = 0;
		LOC31 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC31)) goto LA32;
		LOC31 = allcharsinset_103130(s, TMP2296);
		LA32: ;
		if (!LOC31) goto LA33;
		memset((void*)LOC35, 0, sizeof(LOC35));
		LOC35[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2254);
		dispa_346689((*d).target, (&options), ((NimStringDesc*) &TMP2308), ((NimStringDesc*) &TMP2203), LOC35, 1);
	}
	LA33: ;
	{
		TY191421 LOC40;
		if (!(((NI) 0) < (options ? options->Sup.len : 0))) goto LA38;
		memset((void*)LOC40, 0, sizeof(LOC40));
		LOC40[0] = copyString(options);
		options = dispf_346666((*d).target, ((NimStringDesc*) &TMP2259), ((NimStringDesc*) &TMP2309), LOC40, 1);
	}
	LA38: ;
	arg = getargument_332086(n);
	{
		NIM_BOOL LOC43;
		TY192306 LOC47;
		LOC43 = 0;
		LOC43 = (((NI) 0) < (arg ? arg->Sup.len : 0));
		if (!(LOC43)) goto LA44;
		LOC43 = allcharsinset_103130(arg, TMP2296);
		LA44: ;
		if (!LOC43) goto LA45;
		memset((void*)LOC47, 0, sizeof(LOC47));
		LOC47[0] = copyString(arg);
		LOC47[1] = copyString(options);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2310), ((NimStringDesc*) &TMP2311), LOC47, 2);
	}
	LA45: ;
	{
		NI LOC50;
		LOC50 = 0;
		LOC50 = len_331090(n);
		if (!(((NI) 3) <= LOC50)) goto LA51;
		renderrsttoout_346724(d, (*n).sons->data[((NI) 2)], result);
	}
	LA51: ;
}

N_NIMCALL(void, init_346086)(Codeblockparams346020* p) {
	(*p).startline = ((NI) 1);
	(*p).lang = ((NU8) 0);
	unsureAsgnRef((void**) (&(*p).langstr), copyString(((NimStringDesc*) &TMP2203)));
}

N_NIMCALL(void, parsecodeblockfield_353493)(Rstgenerator346016* d, Rstnode331011* n, Codeblockparams346020* params) {
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	LOC1 = 0;
	LOC1 = getargument_332086(n);
	LOC2 = 0;
	LOC2 = nsuToLowerStr(LOC1);
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2312))) goto LA3;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2313))) goto LA4;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2314))) goto LA5;
	goto LA6;
	LA3: ;
	{
		NI number;
		(*params).numberlines = NIM_TRUE;
		number = 0;
		{
			NimStringDesc* LOC11;
			NI LOC12;
			LOC11 = 0;
			LOC11 = getfieldvalue_335314(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_335314(n);
		unsureAsgnRef((void**) (&(*params).langstr), nsuStrip(LOC17, NIM_TRUE, NIM_TRUE, TMP2254));
		(*params).lang = getsourcelanguage_340099((*params).langstr);
	}
	goto LA7;
	LA6: ;
	{
		NimStringDesc* LOC19;
		LOC19 = 0;
		LOC19 = getargument_332086(n);
		(*d).msghandler((*d).filename, ((NI) 1), ((NI) 0), ((NU8) 9), LOC19);
	}
	LA7: ;
}

N_NIMCALL(void, parsecodeblockparams_353508)(Rstgenerator346016* d, Rstnode331011* n, Codeblockparams346020* Result) {
	NimStringDesc* LOC12;
{	init_346086(Result);
	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((*n).sons->data[((NI) 1)] == 0)) goto LA7;
		{
			Rstnode331011* son_354011;
			Rstnodeseq331009* HEX3Atmp_354014;
			NI i_354017;
			NI L_354019;
			son_354011 = 0;
			HEX3Atmp_354014 = 0;
			HEX3Atmp_354014 = (*(*n).sons->data[((NI) 1)]).sons;
			i_354017 = ((NI) 0);
			L_354019 = (HEX3Atmp_354014 ? HEX3Atmp_354014->Sup.len : 0);
			{
				while (1) {
					if (!(i_354017 < L_354019)) goto LA11;
					son_354011 = HEX3Atmp_354014->data[i_354017];
					parsecodeblockfield_353493(d, son_354011, Result);
					i_354017 += ((NI) 1);
				} LA11: ;
			}
		}
	}
	LA7: ;
	LOC12 = 0;
	LOC12 = getargument_332086(n);
	unsureAsgnRef((void**) (&(*Result).langstr), nsuStrip(LOC12, NIM_TRUE, NIM_TRUE, TMP2254));
	{
		if (!!((((*Result).langstr) && ((*Result).langstr)->Sup.len == 0))) goto LA15;
		(*Result).lang = getsourcelanguage_340099((*Result).langstr);
	}
	LA15: ;
	}BeforeRet: ;
}

N_NIMCALL(void, buildlineshtmltable_354035)(Rstgenerator346016* d, Codeblockparams346020* params, NimStringDesc* code, Keyvaluepair145208* Result) {
	NimStringDesc* id;
	NI codelines;
	NimStringDesc* LOC7;
	NI LOC8;
	NI line;
	NimStringDesc* LOC13;
	NimStringDesc* LOC14;
	NimStringDesc* LOC15;
	NimStringDesc* LOC16;
	NimStringDesc* LOC17;
	NimStringDesc* LOC18;
	NimStringDesc* LOC19;
	NimStringDesc* LOC20;
{	(*d).listingcounter += ((NI) 1);
	id = nimIntToStr((*d).listingcounter);
	{
		NimStringDesc* LOC5;
		NimStringDesc* LOC6;
		if (!!((*params).numberlines)) goto LA3;
		LOC5 = 0;
		LOC5 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2323));
		unsureAsgnRef((void**) (&(*Result).Field0), nsuFormatSingleElem(LOC5, id));
		LOC6 = 0;
		LOC6 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2324));
		unsureAsgnRef((void**) (&(*Result).Field1), nsuFormatSingleElem(LOC6, id));
		goto BeforeRet;
	}
	LA3: ;
	LOC7 = 0;
	LOC7 = nsuStrip(code, NIM_TRUE, NIM_TRUE, TMP2254);
	LOC8 = 0;
	LOC8 = nsuCountLines(LOC7);
	codelines = (NI)(((NI) 1) + LOC8);
	unsureAsgnRef((void**) (&(*Result).Field0), copyString(((NimStringDesc*) &TMP2325)));
	line = (*params).startline;
	{
		while (1) {
			NimStringDesc* LOC11;
			NimStringDesc* LOC12;
			if (!(((NI) 0) < codelines)) goto LA10;
			LOC11 = 0;
			LOC12 = 0;
			LOC12 = nimIntToStr(line);
			LOC11 = rawNewString(LOC12->Sup.len + 1);
appendString(LOC11, LOC12);
appendString(LOC11, ((NimStringDesc*) &TMP2212));
			(*Result).Field0 = resizeString((*Result).Field0, LOC11->Sup.len + 0);
appendString((*Result).Field0, LOC11);
			line += ((NI) 1);
			codelines -= ((NI) 1);
		} LA10: ;
	}
	LOC13 = 0;
	LOC14 = 0;
	LOC14 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2323));
	LOC15 = 0;
	LOC15 = nsuFormatSingleElem(LOC14, id);
	LOC13 = rawNewString(LOC15->Sup.len + 15);
appendString(LOC13, ((NimStringDesc*) &TMP2326));
appendString(LOC13, LOC15);
	(*Result).Field0 = resizeString((*Result).Field0, LOC13->Sup.len + 0);
appendString((*Result).Field0, LOC13);
	LOC16 = 0;
	LOC17 = 0;
	LOC17 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2324));
	LOC18 = 0;
	LOC18 = nsuFormatSingleElem(LOC17, id);
	LOC19 = 0;
	LOC19 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2328));
	LOC20 = 0;
	LOC20 = nsuFormatSingleElem(LOC19, id);
	LOC16 = rawNewString(LOC18->Sup.len + LOC20->Sup.len + 26);
appendString(LOC16, LOC18);
appendString(LOC16, ((NimStringDesc*) &TMP2327));
appendString(LOC16, LOC20);
	unsureAsgnRef((void**) (&(*Result).Field1), LOC16);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercodeblock_354233)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	Codeblockparams346020 params;
	Rstnode331011* m;
	Keyvaluepair145208 LOC5;
	NimStringDesc* blockstart;
	NimStringDesc* blockend;
	TY252724 LOC6;
	TY252724 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_353508(d, n, (&params));
	m = (*(*n).sons->data[((NI) 2)]).sons->data[((NI) 0)];
	memset((void*)(&LOC5), 0, sizeof(LOC5));
	buildlineshtmltable_354035(d, (&params), (*m).text, (&LOC5));
	blockstart = 0;
	blockstart = LOC5.Field0;
	blockend = 0;
	blockend = LOC5.Field1;
	memset((void*)LOC6, 0, sizeof(LOC6));
	dispa_346689((*d).target, result, blockstart, ((NimStringDesc*) &TMP2329), 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_354616;
			NimStringDesc* HEX3Atmp_354628;
			NI i_354631;
			NI L_354633;
			letter_354616 = 0;
			HEX3Atmp_354628 = 0;
			HEX3Atmp_354628 = (*m).text;
			i_354631 = ((NI) 0);
			L_354633 = (HEX3Atmp_354628 ? HEX3Atmp_354628->Sup.len : 0);
			{
				while (1) {
					if (!(i_354631 < L_354633)) goto LA17;
					letter_354616 = HEX3Atmp_354628->data[i_354631];
					escchar_346494((*d).target, result, letter_354616);
					i_354631 += ((NI) 1);
				} LA17: ;
			}
		}
	}
	goto LA7;
	LA9: ;
	{
		Generaltokenizer340023 g;
		memset((void*)(&g), 0, sizeof(g));
		g.Sup.m_type = (&NTI340023);
		initgeneraltokenizer_340289((&g), (*m).text);
		{
			while (1) {
				getnexttoken_342766((&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:
				{
					TY192306 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_346553((*d).target, LOC26, ((NI) -1));
					LOC25[1] = copyString(tokenclasstostr_340087[(g.kind)- 0]);
					dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2491), ((NimStringDesc*) &TMP2492), LOC25, 2);
				}
				break;
				}
			}
		} LA19: ;
		deinitgeneraltokenizer_340300((&g));
	}
	LA7: ;
	memset((void*)LOC27, 0, sizeof(LOC27));
	dispa_346689((*d).target, result, blockend, ((NimStringDesc*) &TMP2526), LOC27, 0);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercontainer_354658)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* arg;
	NimStringDesc* LOC1;
	tmp = copyString(((NimStringDesc*) &TMP2203));
	renderrsttoout_346724(d, (*n).sons->data[((NI) 2)], (&tmp));
	LOC1 = 0;
	LOC1 = getargument_332086(n);
	arg = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE, TMP2254);
	{
		TY191421 LOC6;
		if (!((arg) && (arg)->Sup.len == 0)) goto LA4;
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = copyString(tmp);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2527), ((NimStringDesc*) &TMP2259), LOC6, 1);
	}
	goto LA2;
	LA4: ;
	{
		TY192306 LOC8;
		memset((void*)LOC8, 0, sizeof(LOC8));
		LOC8[0] = copyString(arg);
		LOC8[1] = copyString(tmp);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2528), ((NimStringDesc*) &TMP2529), LOC8, 2);
	}
	LA2: ;
}

N_NIMCALL(void, renderindexterm_347068)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	NimStringDesc* refname;
	NimStringDesc* id;
	NimStringDesc* LOC8;
	NI LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* term;
	TY192306 LOC11;
	refname = rstnodetorefname_332067(n);
	{
		NIM_BOOL LOC3;
		NI LOC6;
		LOC3 = 0;
		LOC3 = haskey_347076((*d).seenindexterms, refname);
		if (!LOC3) goto LA4;
		LOC6 = 0;
		LOC6 = getordefault_347120((*d).seenindexterms, refname);
		HEX5BHEX5DHEX3D_347152((&(*d).seenindexterms), refname, (NI)(LOC6 + ((NI) 1)));
	}
	goto LA1;
	LA4: ;
	{
		HEX5BHEX5DHEX3D_347152((&(*d).seenindexterms), refname, ((NI) 1));
	}
	LA1: ;
	LOC8 = 0;
	LOC9 = 0;
	LOC9 = getordefault_347120((*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*) &TMP2203));
	renderaux_346734(d, n, (&term));
	setindexterm_346855(d, id, term, (*d).currentsection, ((NimStringDesc*) &TMP2203));
	memset((void*)LOC11, 0, sizeof(LOC11));
	LOC11[0] = copyString(id);
	LOC11[1] = copyString(term);
	dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2543), ((NimStringDesc*) &TMP2544), LOC11, 2);
}

N_NIMCALL(void, rendersmiley_353479)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
	TY191421 LOC1;
	NimStringDesc* LOC2;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC2 = 0;
	LOC2 = getordefault_146020((*d).config, ((NimStringDesc*) &TMP2549));
	LOC1[0] = nsuFormatSingleElem(LOC2, (*n).text);
	dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2547), ((NimStringDesc*) &TMP2548), LOC1, 1);
}

N_NIMCALL(void, renderrsttoout_346724)(Rstgenerator346016* d, Rstnode331011* n, NimStringDesc** result) {
{	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 0):
	{
		renderaux_346734(d, n, result);
	}
	break;
	case ((NU8) 1):
	{
		renderheadline_352861(d, n, result);
	}
	break;
	case ((NU8) 2):
	{
		renderoverline_353045(d, n, result);
	}
	break;
	case ((NU8) 3):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2218), ((NimStringDesc*) &TMP2219), result);
	}
	break;
	case ((NU8) 4):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2220), ((NimStringDesc*) &TMP2221), result);
	}
	break;
	case ((NU8) 5):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2222), ((NimStringDesc*) &TMP2223), result);
	}
	break;
	case ((NU8) 6):
	case ((NU8) 8):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2224), ((NimStringDesc*) &TMP2225), result);
	}
	break;
	case ((NU8) 7):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2226), ((NimStringDesc*) &TMP2227), result);
	}
	break;
	case ((NU8) 9):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2228), ((NimStringDesc*) &TMP2229), result);
	}
	break;
	case ((NU8) 10):
	{
		renderaux_346734(d, n, result);
	}
	break;
	case ((NU8) 11):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2230), ((NimStringDesc*) &TMP2231), result);
	}
	break;
	case ((NU8) 12):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2232), ((NimStringDesc*) &TMP2233), result);
	}
	break;
	case ((NU8) 13):
	{
		NimStringDesc* tmp;
		tmp = copyString(((NimStringDesc*) &TMP2203));
		{
			NI i_354772;
			NI HEX3Atmp_354834;
			NI LOC19;
			NI res_354837;
			i_354772 = 0;
			HEX3Atmp_354834 = 0;
			LOC19 = 0;
			LOC19 = len_331090(n);
			HEX3Atmp_354834 = (NI)(LOC19 - ((NI) 1));
			res_354837 = ((NI) 0);
			{
				while (1) {
					if (!(res_354837 <= HEX3Atmp_354834)) goto LA21;
					i_354772 = res_354837;
					renderrsttoout_346724(d, (*n).sons->data[i_354772], (&tmp));
					res_354837 += ((NI) 1);
				} LA21: ;
			}
		}
		{
			TY191421 LOC26;
			if (!!(((tmp ? tmp->Sup.len : 0) == ((NI) 0)))) goto LA24;
			memset((void*)LOC26, 0, sizeof(LOC26));
			LOC26[0] = copyString(tmp);
			dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2234), ((NimStringDesc*) &TMP2229), LOC26, 1);
		}
		LA24: ;
	}
	break;
	case ((NU8) 14):
	{
		renderfield_354717(d, n, result);
	}
	break;
	case ((NU8) 15):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2260), ((NimStringDesc*) &TMP2261), result);
	}
	break;
	case ((NU8) 16):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2262), ((NimStringDesc*) &TMP2263), result);
	}
	break;
	case ((NU8) 51):
	{
		renderrsttoout_346724(d, (*n).sons->data[((NI) 2)], result);
	}
	break;
	case ((NU8) 17):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2264), ((NimStringDesc*) &TMP2265), result);
	}
	break;
	case ((NU8) 18):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2258), ((NimStringDesc*) &TMP2259), result);
	}
	break;
	case ((NU8) 19):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2266), ((NimStringDesc*) &TMP2267), result);
	}
	break;
	case ((NU8) 23):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2268), ((NimStringDesc*) &TMP2263), result);
	}
	break;
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		{
			if (!NIM_TRUE) goto LA38;
			raiseassert_90971(((NimStringDesc*) &TMP2270));
		}
		LA38: ;
	}
	break;
	case ((NU8) 24):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2271), ((NimStringDesc*) &TMP2272), result);
	}
	break;
	case ((NU8) 25):
	{
		{
			if (!NIM_TRUE) goto LA44;
			raiseassert_90971(((NimStringDesc*) &TMP2270));
		}
		LA44: ;
	}
	break;
	case ((NU8) 26):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2273), ((NimStringDesc*) &TMP2221), result);
	}
	break;
	case ((NU8) 27):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2274), ((NimStringDesc*) &TMP2275), result);
	}
	break;
	case ((NU8) 28):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2276), ((NimStringDesc*) &TMP2277), result);
	}
	break;
	case ((NU8) 29):
	case ((NU8) 30):
	{
		NimStringDesc* LOC50;
		NimStringDesc* LOC51;
		LOC50 = 0;
		LOC51 = 0;
		LOC51 = texcolumns_354677(n);
		LOC50 = rawNewString(LOC51->Sup.len + 63);
appendString(LOC50, ((NimStringDesc*) &TMP2279));
appendString(LOC50, LOC51);
appendString(LOC50, ((NimStringDesc*) &TMP2281));
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2278), LOC50, result);
	}
	break;
	case ((NU8) 31):
	{
		{
			NI LOC55;
			LOC55 = 0;
			LOC55 = len_331090(n);
			if (!(((NI) 1) <= LOC55)) goto LA56;
			{
				if (!((*d).target == ((NU8) 1))) goto LA60;
				renderrsttoout_346724(d, (*n).sons->data[((NI) 0)], result);
				{
					NI i_354797;
					NI HEX3Atmp_354842;
					NI LOC63;
					NI res_354845;
					i_354797 = 0;
					HEX3Atmp_354842 = 0;
					LOC63 = 0;
					LOC63 = len_331090(n);
					HEX3Atmp_354842 = (NI)(LOC63 - ((NI) 1));
					res_354845 = ((NI) 1);
					{
						while (1) {
							if (!(res_354845 <= HEX3Atmp_354842)) goto LA65;
							i_354797 = res_354845;
							(*result) = resizeString((*result), 3);
appendString((*result), ((NimStringDesc*) &TMP2282));
							renderrsttoout_346724(d, (*n).sons->data[i_354797], result);
							res_354845 += ((NI) 1);
						} LA65: ;
					}
				}
				(*result) = resizeString((*result), 10);
appendString((*result), ((NimStringDesc*) &TMP2283));
			}
			goto LA58;
			LA60: ;
			{
				(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP2284));
				renderaux_346734(d, n, result);
				(*result) = resizeString((*result), 6);
appendString((*result), ((NimStringDesc*) &TMP2285));
			}
			LA58: ;
		}
		LA56: ;
	}
	break;
	case ((NU8) 33):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2262), ((NimStringDesc*) &TMP2259), result);
	}
	break;
	case ((NU8) 32):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2286), ((NimStringDesc*) &TMP2287), result);
	}
	break;
	case ((NU8) 34):
	{
		{
			if (!NIM_TRUE) goto LA72;
			raiseassert_90971(((NimStringDesc*) &TMP2270));
		}
		LA72: ;
	}
	break;
	case ((NU8) 35):
	{
		{
			if (!NIM_TRUE) goto LA77;
			raiseassert_90971(((NimStringDesc*) &TMP2270));
		}
		LA77: ;
	}
	break;
	case ((NU8) 36):
	{
		{
			if (!NIM_TRUE) goto LA82;
			raiseassert_90971(((NimStringDesc*) &TMP2270));
		}
		LA82: ;
	}
	break;
	case ((NU8) 39):
	{
		NimStringDesc* tmp;
		TY192306 LOC85;
		tmp = copyString(((NimStringDesc*) &TMP2203));
		renderaux_346734(d, n, (&tmp));
		memset((void*)LOC85, 0, sizeof(LOC85));
		LOC85[0] = copyString(tmp);
		LOC85[1] = rstnodetorefname_332067(n);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2288), ((NimStringDesc*) &TMP2289), LOC85, 2);
	}
	break;
	case ((NU8) 37):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2290), ((NimStringDesc*) &TMP2291), result);
	}
	break;
	case ((NU8) 38):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY192306 LOC88;
		tmp0 = copyString(((NimStringDesc*) &TMP2203));
		tmp1 = copyString(((NimStringDesc*) &TMP2203));
		renderrsttoout_346724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_346724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC88, 0, sizeof(LOC88));
		LOC88[0] = copyString(tmp0);
		LOC88[1] = copyString(tmp1);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2292), ((NimStringDesc*) &TMP2293), LOC88, 2);
	}
	break;
	case ((NU8) 41):
	case ((NU8) 42):
	{
		renderaux_346734(d, n, result);
	}
	break;
	case ((NU8) 48):
	{
		{
			Rstnode331011* LOC95;
			NimStringDesc* LOC96;
			if (!!(((*d).target == ((NU8) 1)))) goto LA93;
			LOC95 = 0;
			LOC95 = lastson_331153(n);
			LOC96 = 0;
			LOC96 = addnodes_332073(LOC95);
			(*result) = resizeString((*result), LOC96->Sup.len + 0);
appendString((*result), LOC96);
		}
		LA93: ;
	}
	break;
	case ((NU8) 49):
	{
		{
			Rstnode331011* LOC102;
			NimStringDesc* LOC103;
			if (!((*d).target == ((NU8) 1))) goto LA100;
			LOC102 = 0;
			LOC102 = lastson_331153(n);
			LOC103 = 0;
			LOC103 = addnodes_332073(LOC102);
			(*result) = resizeString((*result), LOC103->Sup.len + 0);
appendString((*result), LOC103);
		}
		LA100: ;
	}
	break;
	case ((NU8) 45):
	case ((NU8) 46):
	{
		renderimage_353213(d, n, result);
	}
	break;
	case ((NU8) 47):
	{
		rendercodeblock_354233(d, n, result);
	}
	break;
	case ((NU8) 50):
	{
		rendercontainer_354658(d, n, result);
	}
	break;
	case ((NU8) 62):
	case ((NU8) 52):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2530), ((NimStringDesc*) &TMP2530), result);
	}
	break;
	case ((NU8) 40):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2203), ((NimStringDesc*) &TMP2203), result);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY192306 LOC110;
		tmp0 = copyString(((NimStringDesc*) &TMP2203));
		tmp1 = copyString(((NimStringDesc*) &TMP2203));
		renderrsttoout_346724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_346724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC110, 0, sizeof(LOC110));
		LOC110[0] = copyString(tmp0);
		LOC110[1] = copyString(tmp1);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP2491), ((NimStringDesc*) &TMP2492), LOC110, 2);
	}
	break;
	case ((NU8) 54):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2531), ((NimStringDesc*) &TMP2532), result);
	}
	break;
	case ((NU8) 55):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2533), ((NimStringDesc*) &TMP2534), result);
	}
	break;
	case ((NU8) 57):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2535), ((NimStringDesc*) &TMP2536), result);
	}
	break;
	case ((NU8) 58):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2537), ((NimStringDesc*) &TMP2287), result);
	}
	break;
	case ((NU8) 59):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2538), ((NimStringDesc*) &TMP2539), result);
	}
	break;
	case ((NU8) 60):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2540), ((NimStringDesc*) &TMP2536), result);
	}
	break;
	case ((NU8) 56):
	{
		renderindexterm_347068(d, n, result);
	}
	break;
	case ((NU8) 61):
	{
		renderaux_346776(d, n, ((NimStringDesc*) &TMP2545), ((NimStringDesc*) &TMP2546), result);
	}
	break;
	case ((NU8) 63):
	{
		rendersmiley_353479(d, n, result);
	}
	break;
	case ((NU8) 64):
	{
		NimStringDesc* LOC121;
		LOC121 = 0;
		LOC121 = esc_346553((*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*) &TMP2203)));
		renderrsttoout_346724(d, (*n).sons->data[((NI) 0)], (&(*d).meta[(((NU8) 1))- 0]));
	}
	break;
	}
	}BeforeRet: ;
}
N_NIMCALL(void, TMP5017)(void* p, NI op) {
	TY346035* a;
	NI LOC1;
	a = (TY346035*)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_346096)(Rstgenerator346016* g, NU8 target, Stringtableobj145212* config, NimStringDesc* filename, NU8 options, Findfilehandler332023 findfile, Msghandler332021 msghandler) {
	TY123809 fileparts;
	NimStringDesc* s;
	unsureAsgnRef((void**) (&(*g).config), config);
	(*g).target = target;
	unsureAsgnRef((void**) (&(*g).tocpart), (TY346035*) newSeq((&NTI346035), 0));
	unsureAsgnRef((void**) (&(*g).filename), copyString(filename));
	(*g).splitafter = ((NI) 20);
	unsureAsgnRef((void**) (&(*g).theindex), copyString(((NimStringDesc*) &TMP2203)));
	(*g).options = options;
	(*g).findfile = findfile;
	unsureAsgnRef((void**) (&(*g).currentsection), copyString(((NimStringDesc*) &TMP2203)));
	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*) &TMP5021))) goto LA3;
		LOC5 = 0;
		LOC5 = rawNewString(fileparts.Field1->Sup.len + 7);
appendString(LOC5, ((NimStringDesc*) &TMP5022));
appendString(LOC5, fileparts.Field1);
		unsureAsgnRef((void**) (&(*g).currentsection), LOC5);
	}
	LA3: ;
	inittable_346124(((NI) 64), (&(*g).seenindexterms));
	(*g).msghandler = msghandler;
	s = getordefault_146020(config, ((NimStringDesc*) &TMP5023));
	{
		if (!!(((s) && (s)->Sup.len == 0))) goto LA8;
		(*g).splitafter = nsuParseInt(s);
	}
	LA8: ;
	{
		NU8 i_346423;
		NI res_346427;
		i_346423 = 0;
		res_346427 = ((NI) 0);
		{
			while (1) {
				if (!(res_346427 <= ((NI) 4))) goto LA12;
				i_346423 = ((NU8) (res_346427));
				unsureAsgnRef((void**) (&(*g).meta[(i_346423)- 0]), copyString(((NimStringDesc*) &TMP2203)));
				res_346427 += ((NI) 1);
			} LA12: ;
		}
	}
}

N_NIMCALL(void, rendertocentry_353162)(Rstgenerator346016* d, Tocentry346012* e, NimStringDesc** result) {
	TY192306 LOC1;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString((*e).refname);
	LOC1[1] = copyString((*e).header);
	dispa_346689((*d).target, result, ((NimStringDesc*) &TMP5102), ((NimStringDesc*) &TMP5103), LOC1, 2);
}

N_NIMCALL(void, rendertocentries_353176)(Rstgenerator346016* d, NI* j, NI lvl, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2203));
	{
		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_353162(d, (&(*d).tocpart->data[(*j)]), (&tmp));
				(*j) += ((NI) 1);
			}
			goto LA3;
			LA5: ;
			{
				if (!(lvl < a)) goto LA8;
				rendertocentries_353176(d, j, a, (&tmp));
			}
			goto LA3;
			LA8: ;
			{
				goto LA1;
			}
			LA3: ;
		} LA2: ;
	} LA1: ;
	{
		TY191421 LOC15;
		if (!(((NI) 1) < lvl)) goto LA13;
		memset((void*)LOC15, 0, sizeof(LOC15));
		LOC15[0] = copyString(tmp);
		dispa_346689((*d).target, result, ((NimStringDesc*) &TMP5104), ((NimStringDesc*) &TMP5105), LOC15, 1);
	}
	goto LA11;
	LA13: ;
	{
		(*result) = resizeString((*result), tmp->Sup.len + 0);
appendString((*result), tmp);
	}
	LA11: ;
}

N_NIMCALL(void, writeindexfile_346445)(Rstgenerator346016* g, NimStringDesc* outfile) {
	{
		if (!(((NI) 0) < ((*g).theindex ? (*g).theindex->Sup.len : 0))) goto LA3;
		writefile_16875(outfile, (*g).theindex);
	}
	LA3: ;
}
N_NIMCALL(void, TMP5174)(void* p, NI op) {
	TY350507* a;
	NI LOC1;
	a = (TY350507*)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, direxists_127020)(NimStringDesc* dir) {
	NIM_BOOL result;
	result = 0;
	result = nosexistsDir(dir);
	return result;
}

N_NIMCALL(NIM_BOOL, isdocumentationtitle_347979)(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_346845)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2215), ((NimStringDesc*) &TMP2214));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2213), ((NimStringDesc*) &TMP2212));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2211), ((NimStringDesc*) &TMP2210));
	return result;
}

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

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

N_NIMCALL(NI, hash_347447)(Indexentry347397* x) {
	NI result;
	NI LOC1;
	NI LOC2;
	NimStringDesc* LOC3;
	NI LOC4;
	NimStringDesc* LOC5;
	NI LOC6;
	result = 0;
	LOC1 = 0;
	LOC1 = hash_142848((*x).keyword);
	LOC2 = 0;
	LOC2 = hash_142848((*x).link);
	result = HEX21HEX26_142013(LOC1, LOC2);
	LOC3 = 0;
	LOC3 = or_346713((*x).linktitle, ((NimStringDesc*) &TMP2203));
	LOC4 = 0;
	LOC4 = hash_142848(LOC3);
	result = HEX21HEX26_142013(result, LOC4);
	LOC5 = 0;
	LOC5 = or_346713((*x).linkdesc, ((NimStringDesc*) &TMP2203));
	LOC6 = 0;
	LOC6 = hash_142848(LOC5);
	result = HEX21HEX26_142013(result, LOC6);
	result = HEX21HEX24_142042(result);
	return result;
}

N_NIMCALL(void, readindexdir_350501)(NimStringDesc* dir, TY350504* Result) {
	NI L;
	TY351105 LOC169;
	unsureAsgnRef((void**) (&(*Result).Field0), (TY130408*) newSeq((&NTI130408), 0));
	inittable_350529(((NI) 32), (&(*Result).Field2));
	unsureAsgnRef((void**) (&(*Result).Field1), (TY350507*) newSeq((&NTI350507), ((NI) 15000)));
	(*Result).Field1 = (TY350507*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Indexentry347397), ((NI) 0));
	L = ((NI) 0);
	{
		NU8 kind_350636;
		NimStringDesc* path_350637;
		DIR* d_352494;
		kind_350636 = 0;
		path_350637 = 0;
		d_352494 = opendir(dir->data);
		{
			int LOC168;
			if (!!((d_352494 == NIM_NIL))) goto LA4;
			{
				while (1) {
					{
						struct dirent* x_352496;
						NimStringDesc* y_352498;
						x_352496 = readdir(d_352494);
						{
							if (!(x_352496 == NIM_NIL)) goto LA11;
							goto LA6;
						}
						LA11: ;
						y_352498 = cstrToNimstr(((NCSTRING) ((*x_352496).d_name)));
						{
							NIM_BOOL LOC15;
							struct stat s_352500;
							NU8 k_352502;
							LOC15 = 0;
							LOC15 = !(eqStrings(y_352498, ((NimStringDesc*) &TMP5176)));
							if (!(LOC15)) goto LA16;
							LOC15 = !(eqStrings(y_352498, ((NimStringDesc*) &TMP5177)));
							LA16: ;
							if (!LOC15) goto LA17;
							memset((void*)(&s_352500), 0, sizeof(s_352500));
							{
								if (!NIM_TRUE) goto LA21;
								y_352498 = HEX2F_123481(dir, y_352498);
							}
							LA21: ;
							k_352502 = ((NU8) 0);
							{
								if (!!(((*x_352496).d_type == ((NI8) 0)))) goto LA25;
								{
									if (!((*x_352496).d_type == ((NI8) 4))) goto LA29;
									k_352502 = ((NU8) 2);
								}
								LA29: ;
								{
									if (!((*x_352496).d_type == ((NI8) 10))) goto LA33;
									{
										NIM_BOOL LOC37;
										LOC37 = 0;
										LOC37 = direxists_127020(y_352498);
										if (!LOC37) goto LA38;
										k_352502 = ((NU8) 3);
									}
									goto LA35;
									LA38: ;
									{
										k_352502 = (NU8)(k_352502 + ((NI) 1));
									}
									LA35: ;
								}
								LA33: ;
								kind_350636 = k_352502;
								path_350637 = y_352498;
								{
									NIM_BOOL LOC43;
									TY350507* fileentries;
									Indexentry347397 title;
									NI F;
									LOC43 = 0;
									LOC43 = (kind_350636 == ((NU8) 0));
									if (!(LOC43)) goto LA44;
									LOC43 = nsuEndsWith(path_350637, ((NimStringDesc*) &TMP5178));
									LA44: ;
									if (!LOC43) goto LA45;
									fileentries = 0;
									memset((void*)(&title), 0, sizeof(title));
									F = ((NI) 0);
									fileentries = (TY350507*) newSeq((&NTI350507), ((NI) 500));
									fileentries = (TY350507*) setLengthSeq(&(fileentries)->Sup, sizeof(Indexentry347397), ((NI) 0));
									{
										NimStringDesc* line_350672;
										FILE* f_352478;
										NimStringDesc* res_352480;
										line_350672 = 0;
										f_352478 = open_16817(path_350637, ((NU8) 0), ((NI) 8000));
										res_352480 = rawNewString(((NI) 80));
										{
											while (1) {
												NIM_BOOL LOC50;
												LOC50 = 0;
												LOC50 = readline_16919(f_352478, (&res_352480));
												if (!LOC50) goto LA49;
												line_350672 = res_352480;
												{
													NI s;
													s = nsuFindChar(line_350672, 9, ((NI) 0));
													{
														if (!(s < ((NI) 0))) goto LA54;
														goto LA51;
													}
													LA54: ;
													fileentries = (TY350507*) setLengthSeq(&(fileentries)->Sup, sizeof(Indexentry347397), ((NI) ((NI)(F + ((NI) 1)))));
													asgnRefNoCycle((void**) (&fileentries->data[F].keyword), copyStrLast(line_350672, ((NI) 0), (NI)(s - ((NI) 1))));
													asgnRefNoCycle((void**) (&fileentries->data[F].link), copyStr(line_350672, (NI)(s + ((NI) 1))));
													{
														NIM_BOOL LOC58;
														LOC58 = 0;
														LOC58 = title.keyword == 0;
														if (!(LOC58)) goto LA59;
														LOC58 = isdocumentationtitle_347979(fileentries->data[F].link);
														LA59: ;
														if (!LOC58) goto LA60;
														title.keyword = copyString(fileentries->data[F].keyword);
														title.link = copyString(fileentries->data[F].link);
													}
													LA60: ;
													{
														NI LOC64;
														TY130408* extracols;
														NimStringDesc* LOC67;
														LOC64 = 0;
														LOC64 = nsuFindChar(fileentries->data[F].link, 9, ((NI) 0));
														if (!(((NI) 0) < LOC64)) goto LA65;
														extracols = nsuSplitChar(fileentries->data[F].link, 9);
														LOC67 = 0;
														LOC67 = fileentries->data[F].link; fileentries->data[F].link = copyStringRC1(extracols->data[((NI) 0)]);
														if (LOC67) nimGCunrefNoCycle(LOC67);
														asgnRefNoCycle((void**) (&fileentries->data[F].linktitle), unquoteindexcolumn_346845(extracols->data[((NI) 1)]));
														asgnRefNoCycle((void**) (&fileentries->data[F].linkdesc), unquoteindexcolumn_346845(extracols->data[((NI) 2)]));
													}
													goto LA62;
													LA65: ;
													{
														NimStringDesc* LOC69;
														NimStringDesc* LOC70;
														LOC69 = 0;
														LOC69 = fileentries->data[F].linktitle; fileentries->data[F].linktitle = copyStringRC1(NIM_NIL);
														if (LOC69) nimGCunrefNoCycle(LOC69);
														LOC70 = 0;
														LOC70 = fileentries->data[F].linkdesc; fileentries->data[F].linkdesc = copyStringRC1(NIM_NIL);
														if (LOC70) nimGCunrefNoCycle(LOC70);
													}
													LA62: ;
													F += ((NI) 1);
												} LA51: ;
											} LA49: ;
										}
										fclose(f_352478);
									}
									{
										TY123809 LOC91;
										NimStringDesc* LOC92;
										if (!title.keyword == 0) goto LA73;
										{
											NI i_350828;
											NI HEX3Atmp_352484;
											NI res_352487;
											i_350828 = 0;
											HEX3Atmp_352484 = 0;
											HEX3Atmp_352484 = (F - 1);
											res_352487 = ((NI) 0);
											{
												while (1) {
													if (!(res_352487 <= HEX3Atmp_352484)) goto LA77;
													i_350828 = res_352487;
													{
														NimStringDesc* toc;
														NimStringDesc* LOC87;
														NimStringDesc* LOC88;
														NimStringDesc* LOC89;
														NimStringDesc* LOC90;
														toc = fileentries->data[i_350828].linktitle;
														{
															NIM_BOOL LOC81;
															NIM_BOOL LOC82;
															LOC81 = 0;
															LOC82 = 0;
															LOC82 = !(toc == 0);
															if (!(LOC82)) goto LA83;
															LOC82 = (((NI) 0) < (toc ? toc->Sup.len : 0));
															LA83: ;
															LOC81 = LOC82;
															if (!(LOC81)) goto LA84;
															LOC81 = ((NU8)(toc->data[((NI) 0)]) == (NU8)(32));
															LA84: ;
															if (!LOC81) goto LA85;
															goto LA78;
														}
														LA85: ;
														(*Result).Field1 = (TY350507*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Indexentry347397), ((NI) ((NI)(L + ((NI) 1)))));
														LOC87 = 0;
														LOC87 = (*Result).Field1->data[L].keyword; (*Result).Field1->data[L].keyword = copyStringRC1(fileentries->data[i_350828].keyword);
														if (LOC87) nimGCunrefNoCycle(LOC87);
														LOC88 = 0;
														LOC88 = (*Result).Field1->data[L].link; (*Result).Field1->data[L].link = copyStringRC1(fileentries->data[i_350828].link);
														if (LOC88) nimGCunrefNoCycle(LOC88);
														LOC89 = 0;
														LOC89 = (*Result).Field1->data[L].linktitle; (*Result).Field1->data[L].linktitle = copyStringRC1(fileentries->data[i_350828].linktitle);
														if (LOC89) nimGCunrefNoCycle(LOC89);
														LOC90 = 0;
														LOC90 = (*Result).Field1->data[L].linkdesc; (*Result).Field1->data[L].linkdesc = copyStringRC1(fileentries->data[i_350828].linkdesc);
														if (LOC90) nimGCunrefNoCycle(LOC90);
														L += ((NI) 1);
													} LA78: ;
													res_352487 += ((NI) 1);
												} LA77: ;
											}
										}
										memset((void*)(&LOC91), 0, sizeof(LOC91));
										nossplitFile(path_350637, (&LOC91));
										(*Result).Field0 = (TY130408*) incrSeqV2(&((*Result).Field0)->Sup, sizeof(NimStringDesc*));
										LOC92 = 0;
										LOC92 = (*Result).Field0->data[(*Result).Field0->Sup.len]; (*Result).Field0->data[(*Result).Field0->Sup.len] = copyStringRC1(LOC91.Field1);
										if (LOC92) nimGCunrefNoCycle(LOC92);
										++(*Result).Field0->Sup.len;
									}
									goto LA71;
									LA73: ;
									{
										NimStringDesc* LOC94;
										NI LOC95;
										NimStringDesc* LOC96;
										LOC94 = 0;
										LOC95 = 0;
										LOC95 = len_350860((*Result).Field2);
										LOC96 = 0;
										LOC96 = nimIntToStr(LOC95);
										LOC94 = rawNewString(LOC96->Sup.len + 8);
appendString(LOC94, ((NimStringDesc*) &TMP5179));
appendString(LOC94, LOC96);
										title.linktitle = LOC94;
										HEX5BHEX5DHEX3D_350872((&(*Result).Field2), (&title), fileentries);
									}
									LA71: ;
								}
								LA45: ;
								goto LA8;
							}
							LA25: ;
							{
								int LOC99;
								LOC99 = 0;
								LOC99 = lstat(y_352498->data, (&s_352500));
								if (!(LOC99 < ((NI32) 0))) goto LA100;
								goto LA6;
							}
							LA100: ;
							{
								NIM_BOOL LOC104;
								LOC104 = 0;
								LOC104 = S_ISDIR(s_352500.st_mode);
								if (!LOC104) goto LA105;
								k_352502 = ((NU8) 2);
							}
							LA105: ;
							{
								NIM_BOOL LOC109;
								LOC109 = 0;
								LOC109 = S_ISLNK(s_352500.st_mode);
								if (!LOC109) goto LA110;
								k_352502 = (NU8)(k_352502 + ((NI) 1));
							}
							LA110: ;
							kind_350636 = k_352502;
							path_350637 = y_352498;
							{
								NIM_BOOL LOC114;
								TY350507* fileentries_352504;
								Indexentry347397 title_352506;
								NI F_352508;
								LOC114 = 0;
								LOC114 = (kind_350636 == ((NU8) 0));
								if (!(LOC114)) goto LA115;
								LOC114 = nsuEndsWith(path_350637, ((NimStringDesc*) &TMP5178));
								LA115: ;
								if (!LOC114) goto LA116;
								fileentries_352504 = 0;
								memset((void*)(&title_352506), 0, sizeof(title_352506));
								F_352508 = ((NI) 0);
								fileentries_352504 = (TY350507*) newSeq((&NTI350507), ((NI) 500));
								fileentries_352504 = (TY350507*) setLengthSeq(&(fileentries_352504)->Sup, sizeof(Indexentry347397), ((NI) 0));
								{
									NimStringDesc* line_352510;
									FILE* f_352512;
									NimStringDesc* res_352514;
									line_352510 = 0;
									f_352512 = open_16817(path_350637, ((NU8) 0), ((NI) 8000));
									res_352514 = rawNewString(((NI) 80));
									{
										while (1) {
											NIM_BOOL LOC121;
											LOC121 = 0;
											LOC121 = readline_16919(f_352512, (&res_352514));
											if (!LOC121) goto LA120;
											line_352510 = res_352514;
											{
												NI s_352517;
												s_352517 = nsuFindChar(line_352510, 9, ((NI) 0));
												{
													if (!(s_352517 < ((NI) 0))) goto LA125;
													goto LA122;
												}
												LA125: ;
												fileentries_352504 = (TY350507*) setLengthSeq(&(fileentries_352504)->Sup, sizeof(Indexentry347397), ((NI) ((NI)(F_352508 + ((NI) 1)))));
												asgnRefNoCycle((void**) (&fileentries_352504->data[F_352508].keyword), copyStrLast(line_352510, ((NI) 0), (NI)(s_352517 - ((NI) 1))));
												asgnRefNoCycle((void**) (&fileentries_352504->data[F_352508].link), copyStr(line_352510, (NI)(s_352517 + ((NI) 1))));
												{
													NIM_BOOL LOC129;
													LOC129 = 0;
													LOC129 = title_352506.keyword == 0;
													if (!(LOC129)) goto LA130;
													LOC129 = isdocumentationtitle_347979(fileentries_352504->data[F_352508].link);
													LA130: ;
													if (!LOC129) goto LA131;
													title_352506.keyword = copyString(fileentries_352504->data[F_352508].keyword);
													title_352506.link = copyString(fileentries_352504->data[F_352508].link);
												}
												LA131: ;
												{
													NI LOC135;
													TY130408* extracols_352519;
													NimStringDesc* LOC138;
													LOC135 = 0;
													LOC135 = nsuFindChar(fileentries_352504->data[F_352508].link, 9, ((NI) 0));
													if (!(((NI) 0) < LOC135)) goto LA136;
													extracols_352519 = nsuSplitChar(fileentries_352504->data[F_352508].link, 9);
													LOC138 = 0;
													LOC138 = fileentries_352504->data[F_352508].link; fileentries_352504->data[F_352508].link = copyStringRC1(extracols_352519->data[((NI) 0)]);
													if (LOC138) nimGCunrefNoCycle(LOC138);
													asgnRefNoCycle((void**) (&fileentries_352504->data[F_352508].linktitle), unquoteindexcolumn_346845(extracols_352519->data[((NI) 1)]));
													asgnRefNoCycle((void**) (&fileentries_352504->data[F_352508].linkdesc), unquoteindexcolumn_346845(extracols_352519->data[((NI) 2)]));
												}
												goto LA133;
												LA136: ;
												{
													NimStringDesc* LOC140;
													NimStringDesc* LOC141;
													LOC140 = 0;
													LOC140 = fileentries_352504->data[F_352508].linktitle; fileentries_352504->data[F_352508].linktitle = copyStringRC1(NIM_NIL);
													if (LOC140) nimGCunrefNoCycle(LOC140);
													LOC141 = 0;
													LOC141 = fileentries_352504->data[F_352508].linkdesc; fileentries_352504->data[F_352508].linkdesc = copyStringRC1(NIM_NIL);
													if (LOC141) nimGCunrefNoCycle(LOC141);
												}
												LA133: ;
												F_352508 += ((NI) 1);
											} LA122: ;
										} LA120: ;
									}
									fclose(f_352512);
								}
								{
									TY123809 LOC162;
									NimStringDesc* LOC163;
									if (!title_352506.keyword == 0) goto LA144;
									{
										NI i_352521;
										NI HEX3Atmp_352523;
										NI res_352525;
										i_352521 = 0;
										HEX3Atmp_352523 = 0;
										HEX3Atmp_352523 = (F_352508 - 1);
										res_352525 = ((NI) 0);
										{
											while (1) {
												if (!(res_352525 <= HEX3Atmp_352523)) goto LA148;
												i_352521 = res_352525;
												{
													NimStringDesc* toc_352527;
													NimStringDesc* LOC158;
													NimStringDesc* LOC159;
													NimStringDesc* LOC160;
													NimStringDesc* LOC161;
													toc_352527 = fileentries_352504->data[i_352521].linktitle;
													{
														NIM_BOOL LOC152;
														NIM_BOOL LOC153;
														LOC152 = 0;
														LOC153 = 0;
														LOC153 = !(toc_352527 == 0);
														if (!(LOC153)) goto LA154;
														LOC153 = (((NI) 0) < (toc_352527 ? toc_352527->Sup.len : 0));
														LA154: ;
														LOC152 = LOC153;
														if (!(LOC152)) goto LA155;
														LOC152 = ((NU8)(toc_352527->data[((NI) 0)]) == (NU8)(32));
														LA155: ;
														if (!LOC152) goto LA156;
														goto LA149;
													}
													LA156: ;
													(*Result).Field1 = (TY350507*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Indexentry347397), ((NI) ((NI)(L + ((NI) 1)))));
													LOC158 = 0;
													LOC158 = (*Result).Field1->data[L].keyword; (*Result).Field1->data[L].keyword = copyStringRC1(fileentries_352504->data[i_352521].keyword);
													if (LOC158) nimGCunrefNoCycle(LOC158);
													LOC159 = 0;
													LOC159 = (*Result).Field1->data[L].link; (*Result).Field1->data[L].link = copyStringRC1(fileentries_352504->data[i_352521].link);
													if (LOC159) nimGCunrefNoCycle(LOC159);
													LOC160 = 0;
													LOC160 = (*Result).Field1->data[L].linktitle; (*Result).Field1->data[L].linktitle = copyStringRC1(fileentries_352504->data[i_352521].linktitle);
													if (LOC160) nimGCunrefNoCycle(LOC160);
													LOC161 = 0;
													LOC161 = (*Result).Field1->data[L].linkdesc; (*Result).Field1->data[L].linkdesc = copyStringRC1(fileentries_352504->data[i_352521].linkdesc);
													if (LOC161) nimGCunrefNoCycle(LOC161);
													L += ((NI) 1);
												} LA149: ;
												res_352525 += ((NI) 1);
											} LA148: ;
										}
									}
									memset((void*)(&LOC162), 0, sizeof(LOC162));
									nossplitFile(path_350637, (&LOC162));
									(*Result).Field0 = (TY130408*) incrSeqV2(&((*Result).Field0)->Sup, sizeof(NimStringDesc*));
									LOC163 = 0;
									LOC163 = (*Result).Field0->data[(*Result).Field0->Sup.len]; (*Result).Field0->data[(*Result).Field0->Sup.len] = copyStringRC1(LOC162.Field1);
									if (LOC163) nimGCunrefNoCycle(LOC163);
									++(*Result).Field0->Sup.len;
								}
								goto LA142;
								LA144: ;
								{
									NimStringDesc* LOC165;
									NI LOC166;
									NimStringDesc* LOC167;
									LOC165 = 0;
									LOC166 = 0;
									LOC166 = len_350860((*Result).Field2);
									LOC167 = 0;
									LOC167 = nimIntToStr(LOC166);
									LOC165 = rawNewString(LOC167->Sup.len + 8);
appendString(LOC165, ((NimStringDesc*) &TMP5179));
appendString(LOC165, LOC167);
									title_352506.linktitle = LOC165;
									HEX5BHEX5DHEX3D_350872((&(*Result).Field2), (&title_352506), fileentries_352504);
								}
								LA142: ;
							}
							LA116: ;
						}
						LA17: ;
					} LA8: ;
				}
			} LA6: ;
			LOC168 = 0;
			LOC168 = closedir(d_352494);
		}
		LA4: ;
	}
	memset((void*)(&LOC169), 0, sizeof(LOC169));
	LOC169.ClPrc = ((TMP5182) (cmp_6577)); LOC169.ClEnv = NIM_NIL;
	sort_351098((*Result).Field0->data, (*Result).Field0->Sup.len, LOC169, ((NU8) 1));
}

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

N_NIMCALL(void, HEX3CHEX2D_347815)(Indexentry347397* a, Indexentry347397* 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_347436)(Indexentry347397* a, Indexentry347397* 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_349796)(Table347410 docs) {
	NimStringDesc* result_349799;
	TY350507* titles;
	TY350507* result_349803;
	TY349027 LOC14;
	TY130408* chunks;
	NimStringDesc* LOC20;
	NimStringDesc* LOC21;
	result_349799 = 0;
	result_349799 = copyString(((NimStringDesc*) &TMP5183));
	result_349803 = (TY350507*) newSeq((&NTI350507), 0);
	{
		Indexentry347397 x_349807;
		memset((void*)(&x_349807), 0, sizeof(x_349807));
		{
			NI h_350395;
			NI HEX3Atmp_350397;
			NI res_350399;
			h_350395 = 0;
			HEX3Atmp_350397 = 0;
			HEX3Atmp_350397 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_350399 = ((NI) 0);
			{
				while (1) {
					if (!(res_350399 <= HEX3Atmp_350397)) goto LA4;
					h_350395 = res_350399;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_169281(docs.data->data[h_350395].Field0);
						if (!LOC7) goto LA8;
						x_349807.keyword = docs.data->data[h_350395].Field1.keyword;
						x_349807.link = docs.data->data[h_350395].Field1.link;
						x_349807.linktitle = docs.data->data[h_350395].Field1.linktitle;
						x_349807.linkdesc = docs.data->data[h_350395].Field1.linkdesc;
						result_349803 = (TY350507*) incrSeqV2(&(result_349803)->Sup, sizeof(Indexentry347397));
						LOC10 = 0;
						LOC10 = result_349803->data[result_349803->Sup.len].keyword; result_349803->data[result_349803->Sup.len].keyword = copyStringRC1(x_349807.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_349803->data[result_349803->Sup.len].link; result_349803->data[result_349803->Sup.len].link = copyStringRC1(x_349807.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_349803->data[result_349803->Sup.len].linktitle; result_349803->data[result_349803->Sup.len].linktitle = copyStringRC1(x_349807.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_349803->data[result_349803->Sup.len].linkdesc; result_349803->data[result_349803->Sup.len].linkdesc = copyStringRC1(x_349807.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
						++result_349803->Sup.len;
					}
					LA8: ;
					res_350399 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_349803, (&NTI350507));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP5186) (cmp_347436)); LOC14.ClEnv = NIM_NIL;
	sort_349020(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	chunks = (TY130408*) newSeq((&NTI130408), 0);
	{
		Indexentry347397 title_350377;
		NI i_350406;
		NI L_350408;
		memset((void*)(&title_350377), 0, sizeof(title_350377));
		i_350406 = ((NI) 0);
		L_350408 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC18;
				NimStringDesc* LOC19;
				if (!(i_350406 < L_350408)) goto LA17;
				title_350377.keyword = titles->data[i_350406].keyword;
				title_350377.link = titles->data[i_350406].link;
				title_350377.linktitle = titles->data[i_350406].linktitle;
				title_350377.linkdesc = titles->data[i_350406].linkdesc;
				LOC18 = 0;
				LOC18 = rawNewString(title_350377.link->Sup.len + title_350377.keyword->Sup.len + 15);
appendString(LOC18, ((NimStringDesc*) &TMP5187));
appendString(LOC18, title_350377.link);
appendString(LOC18, ((NimStringDesc*) &TMP5188));
appendString(LOC18, title_350377.keyword);
appendString(LOC18, ((NimStringDesc*) &TMP5189));
				chunks = (TY130408*) incrSeqV2(&(chunks)->Sup, sizeof(NimStringDesc*));
				LOC19 = 0;
				LOC19 = chunks->data[chunks->Sup.len]; chunks->data[chunks->Sup.len] = copyStringRC1(LOC18);
				if (LOC19) nimGCunrefNoCycle(LOC19);
				++chunks->Sup.len;
				i_350406 += ((NI) 1);
			} LA17: ;
		}
	}
	LOC20 = 0;
	LOC21 = 0;
	LOC21 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP5190));
	LOC20 = rawNewString(LOC21->Sup.len + 5);
appendString(LOC20, LOC21);
appendString(LOC20, ((NimStringDesc*) &TMP5191));
	result_349799 = resizeString(result_349799, LOC20->Sup.len + 0);
appendString(result_349799, LOC20);
	return result_349799;
}

N_NIMCALL(NimStringDesc*, generatemodulejumps_350436)(TY130408* modules) {
	NimStringDesc* result;
	TY130408* chunks;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP5193));
	chunks = (TY130408*) newSeq((&NTI130408), 0);
	{
		NimStringDesc* name_350468;
		NI i_350483;
		NI L_350485;
		name_350468 = 0;
		i_350483 = ((NI) 0);
		L_350485 = (modules ? modules->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				NimStringDesc* LOC5;
				if (!(i_350483 < L_350485)) goto LA3;
				name_350468 = modules->data[i_350483];
				LOC4 = 0;
				LOC4 = rawNewString(name_350468->Sup.len + name_350468->Sup.len + 20);
appendString(LOC4, ((NimStringDesc*) &TMP5187));
appendString(LOC4, name_350468);
appendString(LOC4, ((NimStringDesc*) &TMP5194));
appendString(LOC4, name_350468);
appendString(LOC4, ((NimStringDesc*) &TMP5189));
				chunks = (TY130408*) incrSeqV2(&(chunks)->Sup, sizeof(NimStringDesc*));
				LOC5 = 0;
				LOC5 = chunks->data[chunks->Sup.len]; chunks->data[chunks->Sup.len] = copyStringRC1(LOC4);
				if (LOC5) nimGCunrefNoCycle(LOC5);
				++chunks->Sup.len;
				i_350483 += ((NI) 1);
			} LA3: ;
		}
	}
	LOC6 = 0;
	LOC7 = 0;
	LOC7 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP5190));
	LOC6 = rawNewString(LOC7->Sup.len + 5);
appendString(LOC6, LOC7);
appendString(LOC6, ((NimStringDesc*) &TMP5191));
	result = resizeString(result, LOC6->Sup.len + 0);
appendString(result, LOC6);
	return result;
}
N_NIMCALL(void, TMP5198)(void* p, NI op) {
	TY348074* a;
	NI LOC1;
	a = (TY348074*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Field1, op);
	}
}

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

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

N_NIMCALL(void, striptoclevel_347989)(NimStringDesc* s, TY348075* Result) {
	Slice90365 LOC8;
	{
		NI c_348014;
		NI HEX3Atmp_348034;
		NI res_348037;
		c_348014 = 0;
		HEX3Atmp_348034 = 0;
		HEX3Atmp_348034 = ((s ? s->Sup.len : 0) - 1);
		res_348037 = ((NI) 0);
		{
			while (1) {
				if (!(res_348037 <= HEX3Atmp_348034)) goto LA3;
				c_348014 = res_348037;
				(*Result).Field0 = c_348014;
				{
					if (!!(((NU8)(s->data[c_348014]) == (NU8)(32)))) goto LA6;
					goto LA1;
				}
				LA6: ;
				res_348037 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	LOC8 = HEX2EHEX2E_105291((*Result).Field0, ((s ? s->Sup.len : 0) - 1));
	unsureAsgnRef((void**) (&(*Result).Field1), HEX5BHEX5D_90358(s, LOC8));
}

N_NIMCALL(NimStringDesc*, indenttolevel_348056)(NI* level, NI newlevel) {
	NimStringDesc* result;
{	result = 0;
	result = copyString(((NimStringDesc*) &TMP2203));
	{
		if (!((*level) == newlevel)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!((*level) < newlevel)) goto LA7;
		result = nsuRepeatStr(((NimStringDesc*) &TMP5200), ((NI) ((NI)(newlevel - (*level)))));
	}
	goto LA5;
	LA7: ;
	{
		result = nsuRepeatStr(((NimStringDesc*) &TMP5201), ((NI) ((NI)((*level) - newlevel))));
	}
	LA5: ;
	(*level) = newlevel;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationtoc_348068)(TY350507* entries) {
	NimStringDesc* result;
	NimStringDesc* titleref;
	TY348074* levels;
	NI L;
	NI level;
	NimStringDesc* LOC23;
	NimStringDesc* LOC24;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2203));
	titleref = 0;
	levels = 0;
	L = ((NI) 0);
	level = ((NI) 1);
	levels = (TY348074*) newSeq((&NTI348074), ((NI) ((entries ? entries->Sup.len : 0))));
	{
		Indexentry347397 entry_348211;
		NI i_348406;
		NI L_348408;
		memset((void*)(&entry_348211), 0, sizeof(entry_348211));
		i_348406 = ((NI) 0);
		L_348408 = (entries ? entries->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				TY348075 LOC5;
				NI rawlevel;
				NimStringDesc* rawtext;
				if (!(i_348406 < L_348408)) goto LA3;
				entry_348211.keyword = entries->data[i_348406].keyword;
				entry_348211.link = entries->data[i_348406].link;
				entry_348211.linktitle = entries->data[i_348406].linktitle;
				entry_348211.linkdesc = entries->data[i_348406].linkdesc;
				LOC4 = 0;
				LOC4 = or_346713(entry_348211.linktitle, entry_348211.keyword);
				memset((void*)(&LOC5), 0, sizeof(LOC5));
				striptoclevel_347989(LOC4, (&LOC5));
				rawlevel = 0;
				rawlevel = LOC5.Field0;
				rawtext = 0;
				rawtext = LOC5.Field1;
				{
					NimStringDesc* LOC10;
					if (!(rawlevel < ((NI) 1))) goto LA8;
					levels->data[L].Field0 = (NI)(level + ((NI) 1));
					LOC10 = 0;
					LOC10 = levels->data[L].Field1; levels->data[L].Field1 = copyStringRC1(entry_348211.keyword);
					if (LOC10) nimGCunrefNoCycle(LOC10);
				}
				goto LA6;
				LA8: ;
				{
					NimStringDesc* LOC12;
					level = rawlevel;
					levels->data[L].Field0 = rawlevel;
					LOC12 = 0;
					LOC12 = levels->data[L].Field1; levels->data[L].Field1 = copyStringRC1(rawtext);
					if (LOC12) nimGCunrefNoCycle(LOC12);
				}
				LA6: ;
				L += ((NI) 1);
				i_348406 += ((NI) 1);
			} LA3: ;
		}
	}
	result = copyString(((NimStringDesc*) &TMP5199));
	level = ((NI) 1);
	L = ((NI) 0);
	{
		while (1) {
			NimStringDesc* link;
			if (!(L < (entries ? entries->Sup.len : 0))) goto LA14;
			link = entries->data[L].link;
			{
				NIM_BOOL LOC17;
				LOC17 = 0;
				LOC17 = isdocumentationtitle_347979(link);
				if (!LOC17) goto LA18;
				titleref = copyString(link);
			}
			goto LA15;
			LA18: ;
			{
				NimStringDesc* LOC21;
				NimStringDesc* LOC22;
				LOC21 = 0;
				LOC21 = indenttolevel_348056((&level), levels->data[L].Field0);
				result = resizeString(result, LOC21->Sup.len + 0);
appendString(result, LOC21);
				LOC22 = 0;
				LOC22 = rawNewString(link->Sup.len + levels->data[L].Field1->Sup.len + 20);
appendString(LOC22, ((NimStringDesc*) &TMP5202));
appendString(LOC22, link);
appendString(LOC22, ((NimStringDesc*) &TMP5188));
appendString(LOC22, levels->data[L].Field1);
appendString(LOC22, ((NimStringDesc*) &TMP5203));
				result = resizeString(result, LOC22->Sup.len + 0);
appendString(result, LOC22);
			}
			LA15: ;
			L += ((NI) 1);
		} LA14: ;
	}
	LOC23 = 0;
	LOC24 = 0;
	LOC24 = indenttolevel_348056((&level), ((NI) 1));
	LOC23 = rawNewString(LOC24->Sup.len + 6);
appendString(LOC23, LOC24);
appendString(LOC23, ((NimStringDesc*) &TMP5204));
	result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationindex_348431)(Table347410 docs) {
	NimStringDesc* result_348434;
	TY350507* titles;
	TY350507* result_348438;
	TY349027 LOC14;
	result_348434 = 0;
	result_348434 = copyString(((NimStringDesc*) &TMP2203));
	result_348438 = (TY350507*) newSeq((&NTI350507), 0);
	{
		Indexentry347397 x_348442;
		memset((void*)(&x_348442), 0, sizeof(x_348442));
		{
			NI h_349756;
			NI HEX3Atmp_349758;
			NI res_349760;
			h_349756 = 0;
			HEX3Atmp_349758 = 0;
			HEX3Atmp_349758 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_349760 = ((NI) 0);
			{
				while (1) {
					if (!(res_349760 <= HEX3Atmp_349758)) goto LA4;
					h_349756 = res_349760;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_169281(docs.data->data[h_349756].Field0);
						if (!LOC7) goto LA8;
						x_348442.keyword = docs.data->data[h_349756].Field1.keyword;
						x_348442.link = docs.data->data[h_349756].Field1.link;
						x_348442.linktitle = docs.data->data[h_349756].Field1.linktitle;
						x_348442.linkdesc = docs.data->data[h_349756].Field1.linkdesc;
						result_348438 = (TY350507*) incrSeqV2(&(result_348438)->Sup, sizeof(Indexentry347397));
						LOC10 = 0;
						LOC10 = result_348438->data[result_348438->Sup.len].keyword; result_348438->data[result_348438->Sup.len].keyword = copyStringRC1(x_348442.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_348438->data[result_348438->Sup.len].link; result_348438->data[result_348438->Sup.len].link = copyStringRC1(x_348442.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_348438->data[result_348438->Sup.len].linktitle; result_348438->data[result_348438->Sup.len].linktitle = copyStringRC1(x_348442.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_348438->data[result_348438->Sup.len].linkdesc; result_348438->data[result_348438->Sup.len].linkdesc = copyStringRC1(x_348442.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
						++result_348438->Sup.len;
					}
					LA8: ;
					res_349760 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_348438, (&NTI350507));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP5196) (cmp_347436)); LOC14.ClEnv = NIM_NIL;
	sort_349020(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	{
		Indexentry347397 title_349681;
		NI i_349766;
		NI L_349768;
		memset((void*)(&title_349681), 0, sizeof(title_349681));
		i_349766 = ((NI) 0);
		L_349768 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* toclist;
				TY350507* LOC18;
				NimStringDesc* LOC19;
				if (!(i_349766 < L_349768)) goto LA17;
				title_349681.keyword = titles->data[i_349766].keyword;
				title_349681.link = titles->data[i_349766].link;
				title_349681.linktitle = titles->data[i_349766].linktitle;
				title_349681.linkdesc = titles->data[i_349766].linkdesc;
				LOC18 = 0;
				LOC18 = getordefault_349683(docs, (&title_349681));
				toclist = generatedocumentationtoc_348068(LOC18);
				LOC19 = 0;
				LOC19 = rawNewString(title_349681.link->Sup.len + title_349681.keyword->Sup.len + toclist->Sup.len + 30);
appendString(LOC19, ((NimStringDesc*) &TMP5205));
appendString(LOC19, title_349681.link);
appendString(LOC19, ((NimStringDesc*) &TMP5188));
appendString(LOC19, title_349681.keyword);
appendString(LOC19, ((NimStringDesc*) &TMP5203));
appendString(LOC19, toclist);
appendString(LOC19, ((NimStringDesc*) &TMP5204));
				result_348434 = resizeString(result_348434, LOC19->Sup.len + 0);
appendString(result_348434, LOC19);
				i_349766 += ((NI) 1);
			} LA17: ;
		}
	}
	return result_348434;
}

N_NIMCALL(void, sortindex_347826)(Indexentry347397* 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_347852;
				NI HEX3Atmp_347863;
				NI res_347866;
				i_347852 = 0;
				HEX3Atmp_347863 = 0;
				HEX3Atmp_347863 = (NI)(n - ((NI) 1));
				res_347866 = h;
				{
					while (1) {
						Indexentry347397 v;
						NI j;
						if (!(res_347866 <= HEX3Atmp_347863)) goto LA11;
						i_347852 = res_347866;
						memset((void*)(&v), 0, sizeof(v));
						HEX3CHEX2D_347815((&v), (&a[i_347852]));
						j = i_347852;
						{
							while (1) {
								NI LOC14;
								LOC14 = 0;
								LOC14 = cmp_347436((&a[(NI)(j - h)]), (&v));
								if (!(((NI) 0) <= LOC14)) goto LA13;
								HEX3CHEX2D_347815((&a[j]), (&a[(NI)(j - h)]));
								j = (NI)(j - h);
								{
									if (!(j < h)) goto LA17;
									goto LA12;
								}
								LA17: ;
							} LA13: ;
						} LA12: ;
						HEX3CHEX2D_347815((&a[j]), (&v));
						res_347866 += ((NI) 1);
					} LA11: ;
				}
			}
			{
				if (!(h == ((NI) 1))) goto LA21;
				goto LA7;
			}
			LA21: ;
		}
	} LA7: ;
}

N_NIMCALL(NimStringDesc*, generatesymbolindex_347903)(TY350507* symbols) {
	NimStringDesc* result;
	NI i;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2203));
	i = ((NI) 0);
	{
		while (1) {
			NimStringDesc* keyword;
			NimStringDesc* cleanedkeyword;
			Slice90365 LOC3;
			TY192306 LOC4;
			NI j;
			if (!(i < (symbols ? symbols->Sup.len : 0))) goto LA2;
			keyword = symbols->data[i].keyword;
			LOC3 = HEX2EHEX2E_105291(((NI) 1), (NI)((keyword ? (keyword->Sup.len-1) : -1) - ((NI) 1)));
			cleanedkeyword = HEX5BHEX5D_90358(keyword, LOC3);
			memset((void*)LOC4, 0, sizeof(LOC4));
			LOC4[0] = copyString(keyword);
			LOC4[1] = copyString(cleanedkeyword);
			nsuAddf((&result), ((NimStringDesc*) &TMP5207), 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*) &TMP2203));
					}
					LA14: ;
					{
						TY192293 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*) &TMP5208), LOC23, 3);
					}
					goto LA19;
					LA21: ;
					{
						TY192306 LOC25;
						memset((void*)LOC25, 0, sizeof(LOC25));
						LOC25[0] = copyString(url);
						LOC25[1] = copyString(text);
						nsuAddf((&result), ((NimStringDesc*) &TMP5209), LOC25, 2);
					}
					LA19: ;
					j += ((NI) 1);
				} LA6: ;
			}
			result = resizeString(result, 11);
appendString(result, ((NimStringDesc*) &TMP5210));
			i = j;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, mergeindexes_352594)(NimStringDesc* dir) {
	NimStringDesc* result;
	TY350504 LOC1;
	TY130408* modules;
	TY350507* symbols;
	Table347410 docs;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	readindexdir_350501(dir, (&LOC1));
	modules = 0;
	genericSeqAssign((&modules), LOC1.Field0, (&NTI130408));
	symbols = 0;
	genericSeqAssign((&symbols), LOC1.Field1, (&NTI350507));
	memset((void*)(&docs), 0, sizeof(docs));
	genericSeqAssign((&docs.data), LOC1.Field2.data, (&NTI347413));
	docs.counter = LOC1.Field2.counter;
	result = copyString(((NimStringDesc*) &TMP2203));
	{
		NI LOC4;
		NimStringDesc* LOC7;
		LOC4 = 0;
		LOC4 = len_350860(docs);
		if (!(((NI) 0) < LOC4)) goto LA5;
		LOC7 = 0;
		LOC7 = generatedocumentationjumps_349796(docs);
		result = resizeString(result, LOC7->Sup.len + 0);
appendString(result, LOC7);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP5192));
	}
	LA5: ;
	{
		NimStringDesc* LOC12;
		if (!(((NI) 0) < (modules ? modules->Sup.len : 0))) goto LA10;
		LOC12 = 0;
		LOC12 = generatemodulejumps_350436(modules);
		result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP5192));
	}
	LA10: ;
	{
		NI LOC15;
		NimStringDesc* LOC18;
		LOC15 = 0;
		LOC15 = len_350860(docs);
		if (!(((NI) 0) < LOC15)) goto LA16;
		result = resizeString(result, 29);
appendString(result, ((NimStringDesc*) &TMP5195));
		LOC18 = 0;
		LOC18 = generatedocumentationindex_348431(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_347826(symbols->data, symbols->Sup.len);
		result = resizeString(result, 21);
appendString(result, ((NimStringDesc*) &TMP5206));
		LOC23 = 0;
		LOC23 = generatesymbolindex_347903(symbols);
		result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	}
	LA21: ;
	return result;
}
NIM_EXTERNC N_NOINLINE(void, docutils_rstgenInit000)(void) {
	NimStringDesc* LOC1;
	LOC1 = 0;
	LOC1 = splitter_346489; splitter_346489 = copyStringRC1(((NimStringDesc*) &TMP977));
	if (LOC1) nimGCunrefNoCycle(LOC1);
}

NIM_EXTERNC N_NOINLINE(void, docutils_rstgenDatInit000)(void) {
static TNimNode* TMP5012[14];
static TNimNode* TMP5013[2];
NI TMP5015;
static char* NIM_CONST TMP5014[2] = {
"outHtml", 
"outLatex"};
static TNimNode* TMP5016[3];
static TNimNode* TMP5173[4];
static TNimNode* TMP5197[2];
static TNimNode TMP969[30];
NTI346016.size = sizeof(Rstgenerator346016);
NTI346016.kind = 17;
NTI346016.base = (&NTI4011);
TMP5012[0] = &TMP969[1];
NTI346010.size = sizeof(NU8);
NTI346010.kind = 14;
NTI346010.base = 0;
NTI346010.flags = 3;
for (TMP5015 = 0; TMP5015 < 2; TMP5015++) {
TMP969[TMP5015+2].kind = 1;
TMP969[TMP5015+2].offset = TMP5015;
TMP969[TMP5015+2].name = TMP5014[TMP5015];
TMP5013[TMP5015] = &TMP969[TMP5015+2];
}
TMP969[4].len = 2; TMP969[4].kind = 2; TMP969[4].sons = &TMP5013[0];
NTI346010.node = &TMP969[4];
TMP969[1].kind = 1;
TMP969[1].offset = offsetof(Rstgenerator346016, target);
TMP969[1].typ = (&NTI346010);
TMP969[1].name = "target";
TMP5012[1] = &TMP969[5];
TMP969[5].kind = 1;
TMP969[5].offset = offsetof(Rstgenerator346016, config);
TMP969[5].typ = (&NTI145214);
TMP969[5].name = "config";
TMP5012[2] = &TMP969[6];
TMP969[6].kind = 1;
TMP969[6].offset = offsetof(Rstgenerator346016, splitafter);
TMP969[6].typ = (&NTI108);
TMP969[6].name = "splitAfter";
TMP5012[3] = &TMP969[7];
TMP969[7].kind = 1;
TMP969[7].offset = offsetof(Rstgenerator346016, listingcounter);
TMP969[7].typ = (&NTI108);
TMP969[7].name = "listingCounter";
TMP5012[4] = &TMP969[8];
NTI346012.size = sizeof(Tocentry346012);
NTI346012.kind = 18;
NTI346012.base = 0;
NTI346012.flags = 2;
TMP5016[0] = &TMP969[10];
TMP969[10].kind = 1;
TMP969[10].offset = offsetof(Tocentry346012, n);
TMP969[10].typ = (&NTI331007);
TMP969[10].name = "n";
TMP5016[1] = &TMP969[11];
TMP969[11].kind = 1;
TMP969[11].offset = offsetof(Tocentry346012, refname);
TMP969[11].typ = (&NTI149);
TMP969[11].name = "refname";
TMP5016[2] = &TMP969[12];
TMP969[12].kind = 1;
TMP969[12].offset = offsetof(Tocentry346012, header);
TMP969[12].typ = (&NTI149);
TMP969[12].name = "header";
TMP969[9].len = 3; TMP969[9].kind = 2; TMP969[9].sons = &TMP5016[0];
NTI346012.node = &TMP969[9];
NTI346035.size = sizeof(TY346035*);
NTI346035.kind = 24;
NTI346035.base = (&NTI346012);
NTI346035.flags = 2;
NTI346035.marker = TMP5017;
TMP969[8].kind = 1;
TMP969[8].offset = offsetof(Rstgenerator346016, tocpart);
TMP969[8].typ = (&NTI346035);
TMP969[8].name = "tocPart";
TMP5012[5] = &TMP969[13];
TMP969[13].kind = 1;
TMP969[13].offset = offsetof(Rstgenerator346016, hastoc);
TMP969[13].typ = (&NTI138);
TMP969[13].name = "hasToc";
TMP5012[6] = &TMP969[14];
TMP969[14].kind = 1;
TMP969[14].offset = offsetof(Rstgenerator346016, theindex);
TMP969[14].typ = (&NTI149);
TMP969[14].name = "theIndex";
TMP5012[7] = &TMP969[15];
TMP969[15].kind = 1;
TMP969[15].offset = offsetof(Rstgenerator346016, options);
TMP969[15].typ = (&NTI332015);
TMP969[15].name = "options";
TMP5012[8] = &TMP969[16];
TMP969[16].kind = 1;
TMP969[16].offset = offsetof(Rstgenerator346016, findfile);
TMP969[16].typ = (&NTI332023);
TMP969[16].name = "findFile";
TMP5012[9] = &TMP969[17];
TMP969[17].kind = 1;
TMP969[17].offset = offsetof(Rstgenerator346016, msghandler);
TMP969[17].typ = (&NTI332021);
TMP969[17].name = "msgHandler";
TMP5012[10] = &TMP969[18];
TMP969[18].kind = 1;
TMP969[18].offset = offsetof(Rstgenerator346016, filename);
TMP969[18].typ = (&NTI149);
TMP969[18].name = "filename";
TMP5012[11] = &TMP969[19];
NTI346045.size = sizeof(TY346045);
NTI346045.kind = 16;
NTI346045.base = (&NTI149);
NTI346045.flags = 2;
TMP969[19].kind = 1;
TMP969[19].offset = offsetof(Rstgenerator346016, meta);
TMP969[19].typ = (&NTI346045);
TMP969[19].name = "meta";
TMP5012[12] = &TMP969[20];
TMP969[20].kind = 1;
TMP969[20].offset = offsetof(Rstgenerator346016, currentsection);
TMP969[20].typ = (&NTI149);
TMP969[20].name = "currentSection";
TMP5012[13] = &TMP969[21];
TMP969[21].kind = 1;
TMP969[21].offset = offsetof(Rstgenerator346016, seenindexterms);
TMP969[21].typ = (&NTI346053);
TMP969[21].name = "seenIndexTerms";
TMP969[0].len = 14; TMP969[0].kind = 2; TMP969[0].sons = &TMP5012[0];
NTI346016.node = &TMP969[0];
NTI347397.size = sizeof(Indexentry347397);
NTI347397.kind = 18;
NTI347397.base = 0;
NTI347397.flags = 2;
TMP5173[0] = &TMP969[23];
TMP969[23].kind = 1;
TMP969[23].offset = offsetof(Indexentry347397, keyword);
TMP969[23].typ = (&NTI149);
TMP969[23].name = "keyword";
TMP5173[1] = &TMP969[24];
TMP969[24].kind = 1;
TMP969[24].offset = offsetof(Indexentry347397, link);
TMP969[24].typ = (&NTI149);
TMP969[24].name = "link";
TMP5173[2] = &TMP969[25];
TMP969[25].kind = 1;
TMP969[25].offset = offsetof(Indexentry347397, linktitle);
TMP969[25].typ = (&NTI149);
TMP969[25].name = "linkTitle";
TMP5173[3] = &TMP969[26];
TMP969[26].kind = 1;
TMP969[26].offset = offsetof(Indexentry347397, linkdesc);
TMP969[26].typ = (&NTI149);
TMP969[26].name = "linkDesc";
TMP969[22].len = 4; TMP969[22].kind = 2; TMP969[22].sons = &TMP5173[0];
NTI347397.node = &TMP969[22];
NTI350507.size = sizeof(TY350507*);
NTI350507.kind = 24;
NTI350507.base = (&NTI347397);
NTI350507.flags = 2;
NTI350507.marker = TMP5174;
NTI348075.size = sizeof(TY348075);
NTI348075.kind = 18;
NTI348075.base = 0;
NTI348075.flags = 2;
TMP5197[0] = &TMP969[28];
TMP969[28].kind = 1;
TMP969[28].offset = offsetof(TY348075, Field0);
TMP969[28].typ = (&NTI108);
TMP969[28].name = "Field0";
TMP5197[1] = &TMP969[29];
TMP969[29].kind = 1;
TMP969[29].offset = offsetof(TY348075, Field1);
TMP969[29].typ = (&NTI149);
TMP969[29].name = "Field1";
TMP969[27].len = 2; TMP969[27].kind = 2; TMP969[27].sons = &TMP5197[0];
NTI348075.node = &TMP969[27];
NTI348074.size = sizeof(TY348074*);
NTI348074.kind = 24;
NTI348074.base = (&NTI348075);
NTI348074.flags = 2;
NTI348074.marker = TMP5198;
}

