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

#include "nimbase.h"
#include <string.h>
#include <stdio.h>
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Cell48946 Cell48946;
typedef struct TNimType TNimType;
typedef struct Cellseq48962 Cellseq48962;
typedef struct Gcheap51018 Gcheap51018;
typedef struct Gcstack51016 Gcstack51016;
typedef struct Cellset48958 Cellset48958;
typedef struct Pagedesc48954 Pagedesc48954;
typedef struct Memregion30890 Memregion30890;
typedef struct Smallchunk30842 Smallchunk30842;
typedef struct Llchunk30884 Llchunk30884;
typedef struct Bigchunk30844 Bigchunk30844;
typedef struct Intset30817 Intset30817;
typedef struct Trunk30813 Trunk30813;
typedef struct Avlnode30888 Avlnode30888;
typedef struct Gcstat51014 Gcstat51014;
typedef struct Rstgenerator349016 Rstgenerator349016;
typedef struct Rstnode334011 Rstnode334011;
typedef struct Rstnodeseq334009 Rstnodeseq334009;
typedef struct TNimObject TNimObject;
typedef struct TNimNode TNimNode;
typedef struct Stringtableobj148212 Stringtableobj148212;
typedef struct TY349035 TY349035;
typedef struct Table349053 Table349053;
typedef struct Keyvaluepairseq349056 Keyvaluepairseq349056;
typedef struct Tocentry349012 Tocentry349012;
typedef struct Codeblockparams349020 Codeblockparams349020;
typedef struct Keyvaluepair148208 Keyvaluepair148208;
typedef struct Generaltokenizer343023 Generaltokenizer343023;
typedef struct TY122218 TY122218;
typedef struct TY353504 TY353504;
typedef struct TY132408 TY132408;
typedef struct TY353507 TY353507;
typedef struct Indexentry350397 Indexentry350397;
typedef struct Table350410 Table350410;
typedef struct Keyvaluepairseq350413 Keyvaluepairseq350413;
typedef struct Win32finddata112219 Win32finddata112219;
typedef struct Filetime111273 Filetime111273;
typedef struct Keyvaluepair350416 Keyvaluepair350416;
typedef struct TY351074 TY351074;
typedef struct TY351075 TY351075;
typedef struct Slice92171 Slice92171;
typedef struct Basechunk30840 Basechunk30840;
typedef struct Freecell30832 Freecell30832;
typedef struct Keyvaluepairseq148210 Keyvaluepairseq148210;
typedef struct Keyvaluepair349059 Keyvaluepair349059;
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct  Cell48946  {
NI refcount;
TNimType* typ;
};
struct  Cellseq48962  {
NI len;
NI cap;
Cell48946** d;
};
struct  Cellset48958  {
NI counter;
NI max;
Pagedesc48954* head;
Pagedesc48954** data;
};
typedef Smallchunk30842* TY30905[512];
typedef Trunk30813* Trunkbuckets30815[256];
struct  Intset30817  {
Trunkbuckets30815 data;
};
struct  Memregion30890  {
NI minlargeobj;
NI maxlargeobj;
TY30905 freesmallchunks;
Llchunk30884* llmem;
NI currmem;
NI maxmem;
NI freemem;
NI lastsize;
Bigchunk30844* freechunkslist;
Intset30817 chunkstarts;
Avlnode30888* root;
Avlnode30888* deleted;
Avlnode30888* last;
Avlnode30888* 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;
Cellseq48962 zct;
Cellseq48962 decstack;
Cellset48958 cycleroots;
Cellseq48962 tempstack;
NI recgclock;
Memregion30890 region;
Gcstat51014 stat;
};
struct  Rstnode334011  {
NU8 kind;
NimStringDesc* text;
NI level;
Rstnodeseq334009* 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*, Findfilehandler335023) (NimStringDesc* filename);
typedef N_NIMCALL_PTR(void, Msghandler335021) (NimStringDesc* filename, NI line, NI col, NU8 msgkind, NimStringDesc* arg);
typedef NimStringDesc* TY349045[5];
struct  Table349053  {
Keyvaluepairseq349056* data;
NI counter;
};
struct  Rstgenerator349016  {
  TNimObject Sup;
NU8 target;
Stringtableobj148212* config;
NI splitafter;
NI listingcounter;
TY349035* tocpart;
NIM_BOOL hastoc;
NimStringDesc* theindex;
NU8 options;
Findfilehandler335023 findfile;
Msghandler335021 msghandler;
NimStringDesc* filename;
TY349045 meta;
NimStringDesc* currentsection;
Table349053 seenindexterms;
};
struct  Tocentry349012  {
Rstnode334011* n;
NimStringDesc* refname;
NimStringDesc* header;
};
typedef NimStringDesc* TY196829[4];
typedef NimStringDesc* TY194421[1];
typedef NU8 TY215407[32];
typedef NimStringDesc* TY195306[2];
struct  Codeblockparams349020  {
NIM_BOOL numberlines;
NI startline;
NimStringDesc* langstr;
NU8 lang;
};
struct Keyvaluepair148208 {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
typedef NimStringDesc* TY255724[1];
struct  Generaltokenizer343023  {
  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* TY343090[33];
struct TY122218 {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
};
struct  Indexentry350397  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
struct  Table350410  {
Keyvaluepairseq350413* data;
NI counter;
};
struct TY353504 {
TY132408* Field0;
TY353507* Field1;
Table350410 Field2;
};
struct  Filetime111273  {
NI32 dwlowdatetime;
NI32 dwhighdatetime;
};
typedef NI16 TY112230[260];
typedef NI16 TY112234[14];
struct  Win32finddata112219  {
NI32 dwfileattributes;
Filetime111273 ftcreationtime;
Filetime111273 ftlastaccesstime;
Filetime111273 ftlastwritetime;
NI32 nfilesizehigh;
NI32 nfilesizelow;
NI32 dwreserved0;
NI32 dwreserved1;
TY112230 cfilename;
TY112234 calternatefilename;
};
typedef N_STDCALL_PTR(NI32, TY112249) (NI hfindfile, Win32finddata112219* lpfindfiledata);
typedef N_STDCALL_PTR(void, TY112405) (NI hfindfile);
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (NimStringDesc* x_354107, NimStringDesc* y_354109, void* ClEnv);
void* ClEnv;
} TY354105;
typedef N_CLOSURE_PTR(NI, TMP5180) (NimStringDesc* x_354094, NimStringDesc* y_354096, void* ClEnv);
struct Keyvaluepair350416 {
NI Field0;
Indexentry350397 Field1;
TY353507* Field2;
};
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Indexentry350397 x_352029, Indexentry350397 y_352031, void* ClEnv);
void* ClEnv;
} TY352027;
typedef N_CLOSURE_PTR(NI, TMP5184) (Indexentry350397 x_353330, Indexentry350397 y_353332, void* ClEnv);
typedef N_CLOSURE_PTR(NI, TMP5194) (Indexentry350397 x_352016, Indexentry350397 y_352018, void* ClEnv);
struct TY351075 {
NI Field0;
NimStringDesc* Field1;
};
struct  Slice92171  {
NI a;
NI b;
};
typedef NimStringDesc* TY195293[3];
struct  Gcstack51016  {
Gcstack51016* prev;
Gcstack51016* next;
void* starts;
void* pos;
NI maxstacksize;
};
typedef NI TY30821[16];
struct  Pagedesc48954  {
Pagedesc48954* next;
NI key;
TY30821 bits;
};
struct  Basechunk30840  {
NI prevsize;
NI size;
NIM_BOOL used;
};
struct  Smallchunk30842  {
  Basechunk30840 Sup;
Smallchunk30842* next;
Smallchunk30842* prev;
Freecell30832* freelist;
NI free;
NI acc;
NF data;
};
struct  Llchunk30884  {
NI size;
NI acc;
Llchunk30884* next;
};
struct  Bigchunk30844  {
  Basechunk30840 Sup;
Bigchunk30844* next;
Bigchunk30844* prev;
NI align;
NF data;
};
struct  Trunk30813  {
Trunk30813* next;
NI key;
TY30821 bits;
};
typedef Avlnode30888* TY30895[2];
struct  Avlnode30888  {
TY30895 link;
NI key;
NI upperbound;
NI level;
};
struct  Stringtableobj148212  {
  TNimObject Sup;
NI counter;
Keyvaluepairseq148210* data;
NU8 mode;
};
struct Keyvaluepair349059 {
NI Field0;
NimStringDesc* Field1;
NI Field2;
};
struct  Freecell30832  {
Freecell30832* next;
NI zerofield;
};
struct TY349035 {
  TGenericSeq Sup;
  Tocentry349012 data[SEQ_DECL_SIZE];
};
struct Rstnodeseq334009 {
  TGenericSeq Sup;
  Rstnode334011* data[SEQ_DECL_SIZE];
};
struct TY132408 {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct TY353507 {
  TGenericSeq Sup;
  Indexentry350397 data[SEQ_DECL_SIZE];
};
struct TY351074 {
  TGenericSeq Sup;
  TY351075 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq349056 {
  TGenericSeq Sup;
  Keyvaluepair349059 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq350413 {
  TGenericSeq Sup;
  Keyvaluepair350416 data[SEQ_DECL_SIZE];
};
struct Keyvaluepairseq148210 {
  TGenericSeq Sup;
  Keyvaluepair148208 data[SEQ_DECL_SIZE];
};
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(Cell48946*, usrtocell_52646)(void* usr);
static N_INLINE(void, rtladdzct_54204)(Cell48946* c);
N_NOINLINE(void, addzct_52617)(Cellseq48962* s, Cell48946* c);
N_NIMCALL(void, renderaux_349734)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(NI, len_334090)(Rstnode334011* n);
N_NIMCALL(void, renderrsttoout_349724)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(void, renderheadline_355661)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_NIMCALL(NimStringDesc*, rstnodetorefname_335067)(Rstnode334011* 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_349689)(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_349855)(Rstgenerator349016* 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_349835)(NimStringDesc* text);
N_NIMCALL(NimStringDesc*, nsuReplaceStr)(NimStringDesc* s, NimStringDesc* sub, NimStringDesc* by);
N_NIMCALL(void, insert_93801)(NimStringDesc** x, NimStringDesc* item, NI i);
N_NIMCALL(NimStringDesc*, striptochtml_355641)(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_355845)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(void, renderaux_349776)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result);
N_NIMCALL(void, renderfield_357517)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, addnodes_335073)(Rstnode334011* n);
N_NIMCALL(NimStringDesc*, esc_349553)(NU8 target, NimStringDesc* s, NI splitafter);
N_NIMCALL(NI, nextsplitpoint_349506)(NimStringDesc* s, NI start);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringDesc* a, NimStringDesc* b);
static N_INLINE(void, escchar_349494)(NU8 target, NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addxmlchar_349456)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(void, addtexchar_349478)(NimStringDesc** dest, NIM_CHAR c);
N_NIMCALL(NimStringDesc*, nsuStrip)(NimStringDesc* s, NIM_BOOL leading, NIM_BOOL trailing, TY215407 chars);
N_NIMCALL(NI, nsuCmpIgnoreStyle)(NimStringDesc* a, NimStringDesc* b);
N_NOINLINE(void, raiseassert_92771)(NimStringDesc* msg);
N_NIMCALL(NimStringDesc*, texcolumns_357477)(Rstnode334011* n);
N_NIMCALL(Rstnode334011*, lastson_334153)(Rstnode334011* n);
N_NIMCALL(void, renderimage_356013)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(NimStringDesc*, getfieldvalue_335079)(Rstnode334011* n, NimStringDesc* fieldname);
N_NIMCALL(NIM_BOOL, allcharsinset_106130)(NimStringDesc* s, TY215407 theset);
N_NIMCALL(NimStringDesc*, dispf_349666)(NU8 target, NimStringDesc* xml, NimStringDesc* tex, NimStringDesc** args, NI argsLen0);
N_NIMCALL(NimStringDesc*, nsuFormatOpenArray)(NimStringDesc* formatstr, NimStringDesc** a, NI aLen0);
N_NIMCALL(NimStringDesc*, getargument_335086)(Rstnode334011* n);
N_NIMCALL(void, rendercodeblock_357033)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(void, parsecodeblockparams_356308)(Rstgenerator349016* d, Rstnode334011* n, Codeblockparams349020* Result);
N_NIMCALL(void, init_349086)(Codeblockparams349020* p);
N_NIMCALL(void, parsecodeblockfield_356293)(Rstgenerator349016* d, Rstnode334011* n, Codeblockparams349020* params);
N_NIMCALL(NimStringDesc*, nsuToLowerStr)(NimStringDesc* s);
N_NIMCALL(NI, npuParseInt)(NimStringDesc* s, NI* number, NI start);
N_NIMCALL(NimStringDesc*, getfieldvalue_338314)(Rstnode334011* n);
N_NIMCALL(NU8, getsourcelanguage_343099)(NimStringDesc* name);
N_NOINLINE(void, chckNil)(void* p);
N_NIMCALL(void, buildlineshtmltable_356835)(Rstgenerator349016* d, Codeblockparams349020 params, NimStringDesc* code, Keyvaluepair148208* Result);
N_NIMCALL(NimStringDesc*, nsuFormatSingleElem)(NimStringDesc* formatstr, NimStringDesc* a);
N_NIMCALL(NimStringDesc*, getordefault_149020)(Stringtableobj148212* t, NimStringDesc* key);
N_NIMCALL(NI, nsuCountLines)(NimStringDesc* s);
N_NIMCALL(void, initgeneraltokenizer_343289)(Generaltokenizer343023* g, NimStringDesc* buf);
N_NIMCALL(void, getnexttoken_345766)(Generaltokenizer343023* 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_343300)(Generaltokenizer343023* g);
N_NIMCALL(void, rendercontainer_357458)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(void, renderindexterm_350068)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(NIM_BOOL, haskey_350076)(Table349053 t, NimStringDesc* key);
N_NIMCALL(void, HEX5BHEX5DHEX3D_350152)(Table349053* t, NimStringDesc* key, NI val);
N_NIMCALL(NI, getordefault_350120)(Table349053 t, NimStringDesc* key);
N_NIMCALL(void, rendersmiley_356279)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
N_NIMCALL(void, TMP5016)(void* p, NI op);
N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_NIMCALL(void, nossplitFile)(NimStringDesc* path, TY122218* Result);
N_NIMCALL(void, inittable_349124)(NI initialsize, Table349053* Result);
N_NIMCALL(NI, nsuParseInt)(NimStringDesc* s);
N_NIMCALL(void, rendertocentry_355962)(Rstgenerator349016* d, Tocentry349012 e, NimStringDesc** result);
N_NIMCALL(void, rendertocentries_355976)(Rstgenerator349016* d, NI* j, NI lvl, NimStringDesc** result);
N_NIMCALL(void, writefile_16875)(NimStringDesc* filename, NimStringDesc* content);
N_NIMCALL(void, readindexdir_353501)(NimStringDesc* dir, TY353504* Result);
N_NIMCALL(void, inittable_353529)(NI initialsize, Table350410* Result);
N_NIMCALL(void, TMP5173)(void* p, NI op);
N_NIMCALL(NI, findfirstfile_125416)(NimStringDesc* a, Win32finddata112219* b);
N_NIMCALL(NimStringDesc*, HEX2F_121890)(NimStringDesc* head, NimStringDesc* tail);
static N_INLINE(NIM_BOOL, skipfinddata_125437)(Win32finddata112219* f);
N_NIMCALL(NimStringDesc*, HEX24_85487)(NI16* s);
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_350979)(NimStringDesc* hyperlink);
N_NIMCALL(TY132408*, nsuSplitChar)(NimStringDesc* s, NIM_CHAR sep);
N_NIMCALL(NimStringDesc*, unquoteindexcolumn_349845)(NimStringDesc* text);
N_NIMCALL(TGenericSeq*, incrSeqV2)(TGenericSeq* seq, NI elemsize);
N_NIMCALL(NI, len_353860)(Table350410 t);
N_NIMCALL(void, HEX5BHEX5DHEX3D_353872)(Table350410* t, Indexentry350397 key, TY353507* val);
static N_INLINE(NI, HEX21HEX26_145013)(NI h, NI val);
N_NIMCALL(NI, hash_145848)(NimStringDesc* x);
static N_INLINE(NimStringDesc*, or_349713)(NimStringDesc* x, NimStringDesc* y);
static N_INLINE(NI, HEX21HEX24_145042)(NI h);
N_NIMCALL(void, sort_354098)(NimStringDesc** a, NI aLen0, TY354105 cmp, NU8 order);
N_NIMCALL(NI, cmp_6577)(NimStringDesc* x, NimStringDesc* y);
N_NIMCALL(void, genericSeqAssign)(void* dest, void* src_87604, TNimType* mt);
N_NIMCALL(NimStringDesc*, generatedocumentationjumps_352796)(Table350410 docs);
static N_INLINE(NIM_BOOL, isfilled_172281)(NI hcode);
N_NIMCALL(void, sort_352020)(Indexentry350397* a, NI aLen0, TY352027 cmp, NU8 order);
N_NIMCALL(NI, cmp_350436)(Indexentry350397 a, Indexentry350397 b);
N_NIMCALL(NimStringDesc*, nsuJoinSep)(NimStringDesc** a, NI aLen0, NimStringDesc* sep);
N_NIMCALL(NimStringDesc*, generatemodulejumps_353436)(TY132408* modules);
N_NIMCALL(NimStringDesc*, generatedocumentationindex_351431)(Table350410 docs);
N_NIMCALL(NimStringDesc*, generatedocumentationtoc_351068)(TY353507* entries);
N_NIMCALL(void, TMP5196)(void* p, NI op);
N_NIMCALL(void, striptoclevel_350989)(NimStringDesc* s, TY351075* Result);
static N_INLINE(NimStringDesc*, HEX5BHEX5D_92164)(NimStringDesc* s, Slice92171 x);
static N_INLINE(Slice92171, HEX2EHEX2E_108290)(NI a, NI b);
N_NIMCALL(NimStringDesc*, indenttolevel_351056)(NI* level, NI newlevel);
N_NIMCALL(NimStringDesc*, nsuRepeatStr)(NimStringDesc* s, NI n);
N_NIMCALL(TY353507*, getordefault_352683)(Table350410 t, Indexentry350397 key);
N_NIMCALL(void, sortindex_350826)(Indexentry350397* a, NI aLen0);
N_NIMCALL(void, HEX3CHEX2D_350815)(Indexentry350397* a, Indexentry350397 b);
N_NIMCALL(NimStringDesc*, generatesymbolindex_350903)(TY353507* symbols);
STRING_LITERAL(TMP984, "<wbr />", 7);
STRING_LITERAL(TMP2206, "", 0);
STRING_LITERAL(TMP2208, "-", 1);
STRING_LITERAL(TMP2209, "\015\012<h$1><a class=\"toc-backref\" id=\"$2\" href=\"#$2\">$3</a></h$1>", 61);
STRING_LITERAL(TMP2210, "\\rsth$4{$3}\\label{$2}\015\012", 23);
STRING_LITERAL(TMP2211, "\015\012<h$1 id=\"$2\">$3</h$1>", 23);
STRING_LITERAL(TMP2212, "html", 4);
STRING_LITERAL(TMP2213, "\\", 1);
STRING_LITERAL(TMP2214, "\\\\", 2);
STRING_LITERAL(TMP2215, "\015\012", 2);
STRING_LITERAL(TMP2216, "\\n", 2);
STRING_LITERAL(TMP2217, "\011", 1);
STRING_LITERAL(TMP2218, "\\t", 2);
STRING_LITERAL(TMP2219, "<h$1 id=\"$2\"><center>$3</center></h$1>", 38);
STRING_LITERAL(TMP2220, "\\rstov$4{$3}\\label{$2}\015\012", 24);
STRING_LITERAL(TMP2221, "<hr />\015\012", 8);
STRING_LITERAL(TMP2222, "\\hrule\015\012", 8);
STRING_LITERAL(TMP2223, "<p>$1</p>\015\012", 11);
STRING_LITERAL(TMP2224, "$1\015\012\015\012", 6);
STRING_LITERAL(TMP2225, "<ul class=\"simple\">$1</ul>\015\012", 28);
STRING_LITERAL(TMP2226, "\\begin{itemize}$1\\end{itemize}\015\012", 32);
STRING_LITERAL(TMP2227, "<li>$1</li>\015\012", 13);
STRING_LITERAL(TMP2228, "\\item $1\015\012", 10);
STRING_LITERAL(TMP2229, "<ol class=\"simple\">$1</ol>\015\012", 28);
STRING_LITERAL(TMP2230, "\\begin{enumerate}$1\\end{enumerate}\015\012", 36);
STRING_LITERAL(TMP2231, "<dl class=\"docutils\">$1</dl>\015\012", 30);
STRING_LITERAL(TMP2232, "\\begin{description}$1\\end{description}\015\012", 40);
STRING_LITERAL(TMP2233, "<dt>$1</dt>\015\012", 13);
STRING_LITERAL(TMP2234, "\\item[$1] ", 10);
STRING_LITERAL(TMP2235, "<dd>$1</dd>\015\012", 13);
STRING_LITERAL(TMP2236, "$1\015\012", 4);
STRING_LITERAL(TMP2237, "<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(TMP2238, " ", 1);
STRING_LITERAL(TMP2239, "&amp;", 5);
STRING_LITERAL(TMP2240, "&lt;", 4);
STRING_LITERAL(TMP2241, "&gt;", 4);
STRING_LITERAL(TMP2242, "&quot;", 6);
STRING_LITERAL(TMP2243, "\\_", 2);
STRING_LITERAL(TMP2244, "\\symbol{123}", 12);
STRING_LITERAL(TMP2245, "\\symbol{125}", 12);
STRING_LITERAL(TMP2246, "\\symbol{91}", 11);
STRING_LITERAL(TMP2247, "\\symbol{93}", 11);
STRING_LITERAL(TMP2248, "\\symbol{92}", 11);
STRING_LITERAL(TMP2249, "\\$", 2);
STRING_LITERAL(TMP2250, "\\&", 2);
STRING_LITERAL(TMP2251, "\\#", 2);
STRING_LITERAL(TMP2252, "\\%", 2);
STRING_LITERAL(TMP2253, "\\symbol{126}", 12);
STRING_LITERAL(TMP2254, "\\symbol{64}", 11);
STRING_LITERAL(TMP2255, "\\symbol{94}", 11);
STRING_LITERAL(TMP2256, "\\symbol{96}", 11);
static NIM_CONST TY215407 TMP2257 = {
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(TMP2258, "author", 6);
STRING_LITERAL(TMP2259, "authors", 7);
STRING_LITERAL(TMP2260, "version", 7);
STRING_LITERAL(TMP2261, "<tr>$1</tr>\015\012", 13);
STRING_LITERAL(TMP2262, "$1", 2);
STRING_LITERAL(TMP2263, "<th class=\"docinfo-name\">$1:</th>", 33);
STRING_LITERAL(TMP2264, "\\item[$1:]", 10);
STRING_LITERAL(TMP2265, "<td>$1</td>", 11);
STRING_LITERAL(TMP2266, " $1\015\012", 5);
STRING_LITERAL(TMP2267, "<table frame=\"void\">$1</table>", 30);
STRING_LITERAL(TMP2268, "\\begin{description}\015\012$1\\end{description}\015\012", 42);
STRING_LITERAL(TMP2269, "<th align=\"left\">$1</th>", 24);
STRING_LITERAL(TMP2270, "\\item[$1]", 9);
STRING_LITERAL(TMP2271, "<td align=\"left\">$1</td>\015\012", 26);
STRING_LITERAL(TMP2273, "false renderRstToOut", 20);
STRING_LITERAL(TMP2274, "<pre>$1</pre>\015\012", 15);
STRING_LITERAL(TMP2275, "\\begin{rstpre}\015\012$1\015\012\\end{rstpre}\015\012", 34);
STRING_LITERAL(TMP2276, "<p>$1</p>", 9);
STRING_LITERAL(TMP2277, "$1<br />", 8);
STRING_LITERAL(TMP2278, "$1\\\\\015\012", 6);
STRING_LITERAL(TMP2279, "<blockquote><p>$1</p></blockquote>\015\012", 36);
STRING_LITERAL(TMP2280, "\\begin{quote}$1\\end{quote}\015\012", 28);
STRING_LITERAL(TMP2281, "<table border=\"1\" class=\"docutils\">$1</table>", 45);
STRING_LITERAL(TMP2282, "\\begin{table}\\begin{rsttab}{", 28);
STRING_LITERAL(TMP2283, "|X", 2);
STRING_LITERAL(TMP2284, "|}\015\012\\hline\015\012$1\\end{rsttab}\\end{table}", 37);
STRING_LITERAL(TMP2285, " & ", 3);
STRING_LITERAL(TMP2286, "\\\\\015\012\\hline\015\012", 12);
STRING_LITERAL(TMP2287, "<tr>", 4);
STRING_LITERAL(TMP2288, "</tr>\015\012", 7);
STRING_LITERAL(TMP2289, "<th>$1</th>", 11);
STRING_LITERAL(TMP2290, "\\textbf{$1}", 11);
STRING_LITERAL(TMP2291, "<a class=\"reference external\" href=\"#$2\">$1</a>", 47);
STRING_LITERAL(TMP2292, "$1\\ref{$2}", 10);
STRING_LITERAL(TMP2293, "<a class=\"reference external\" href=\"$1\">$1</a>", 46);
STRING_LITERAL(TMP2294, "\\href{$1}{$1}", 13);
STRING_LITERAL(TMP2295, "<a class=\"reference external\" href=\"$2\">$1</a>", 46);
STRING_LITERAL(TMP2296, "\\href{$2}{$1}", 13);
STRING_LITERAL(TMP2298, "scale", 5);
static NIM_CONST TY215407 TMP2299 = {
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(TMP2300, " scale=\"$1\"", 11);
STRING_LITERAL(TMP2301, " scale=$1", 9);
STRING_LITERAL(TMP2302, "height", 6);
STRING_LITERAL(TMP2303, " height=\"$1\"", 12);
STRING_LITERAL(TMP2304, " height=$1", 10);
STRING_LITERAL(TMP2305, "width", 5);
STRING_LITERAL(TMP2306, " width=\"$1\"", 11);
STRING_LITERAL(TMP2307, " width=$1", 9);
STRING_LITERAL(TMP2308, "alt", 3);
STRING_LITERAL(TMP2309, " alt=\"$1\"", 9);
STRING_LITERAL(TMP2310, "align", 5);
STRING_LITERAL(TMP2311, " align=\"$1\"", 11);
STRING_LITERAL(TMP2312, "[$1]", 4);
STRING_LITERAL(TMP2313, "<img src=\"$1\"$2 />", 18);
STRING_LITERAL(TMP2314, "\\includegraphics$2{$1}", 22);
STRING_LITERAL(TMP2315, "number-lines", 12);
STRING_LITERAL(TMP2316, "file", 4);
STRING_LITERAL(TMP2317, "default-language", 16);
STRING_LITERAL(TMP2326, "doc.listing_start", 17);
STRING_LITERAL(TMP2327, "doc.listing_end", 15);
STRING_LITERAL(TMP2328, "<table class=\"line-nums-table\"><tbody><tr><td class=\"blob-line-"
"nums\"><pre class=\"line-nums\">", 92);
STRING_LITERAL(TMP2329, "</pre></td><td>", 15);
STRING_LITERAL(TMP2330, "</td></tr></tbody></table>", 26);
STRING_LITERAL(TMP2331, "doc.listing_button", 18);
STRING_LITERAL(TMP2332, "\\begin{rstpre}\015\012", 16);
STRING_LITERAL(TMP2494, "<span class=\"$2\">$1</span>", 26);
STRING_LITERAL(TMP2495, "\\span$2{$1}", 11);
extern NIM_CONST TY343090 tokenclasstostr_343087;
STRING_LITERAL(TMP2529, "\015\012\\end{rstpre}\015\012", 16);
STRING_LITERAL(TMP2530, "<div>$1</div>", 13);
STRING_LITERAL(TMP2531, "<div class=\"$1\">$2</div>", 24);
STRING_LITERAL(TMP2532, "$2", 2);
STRING_LITERAL(TMP2533, "|$1|", 4);
STRING_LITERAL(TMP2534, "<sub>$1</sub>", 13);
STRING_LITERAL(TMP2535, "\\rstsub{$1}", 11);
STRING_LITERAL(TMP2536, "<sup>$1</sup>", 13);
STRING_LITERAL(TMP2537, "\\rstsup{$1}", 11);
STRING_LITERAL(TMP2538, "<em>$1</em>", 11);
STRING_LITERAL(TMP2539, "\\emph{$1}", 9);
STRING_LITERAL(TMP2540, "<strong>$1</strong>", 19);
STRING_LITERAL(TMP2541, "<strong><em>$1</em></strong>", 28);
STRING_LITERAL(TMP2542, "\\textbf{emph{$1}}", 17);
STRING_LITERAL(TMP2543, "<cite>$1</cite>", 15);
STRING_LITERAL(TMP2546, "<span id=\"$1\">$2</span>", 23);
STRING_LITERAL(TMP2547, "$2\\label{$1}", 12);
STRING_LITERAL(TMP2548, "<tt class=\"docutils literal\"><span class=\"pre\">$1</span></tt>", 61);
STRING_LITERAL(TMP2549, "\\texttt{$1}", 11);
STRING_LITERAL(TMP2550, "<img src=\"$1\" width=\"15\"\015\012        height=\"17\" hspace=\"2\" vspace"
"=\"2\" class=\"smiley\" />", 85);
STRING_LITERAL(TMP2551, "\\includegraphics{$1}", 20);
STRING_LITERAL(TMP2552, "doc.smiley_format", 17);
STRING_LITERAL(TMP5020, ".nim", 4);
STRING_LITERAL(TMP5021, "Module ", 7);
STRING_LITERAL(TMP5022, "split.item.toc", 14);
STRING_LITERAL(TMP5101, "<li><a class=\"reference\" id=\"$1_toc\" href=\"#$1\">$2</a></li>\015\012", 61);
STRING_LITERAL(TMP5102, "\\item\\label{$1_toc} $2\\ref{$1}\015\012", 32);
STRING_LITERAL(TMP5103, "<ul class=\"simple\">$1</ul>", 26);
STRING_LITERAL(TMP5104, "\\begin{enumerate}$1\\end{enumerate}", 34);
STRING_LITERAL(TMP5175, "*", 1);
STRING_LITERAL(TMP5176, ".idx", 4);
STRING_LITERAL(TMP5177, "doc_toc_", 8);
STRING_LITERAL(TMP5181, "Documents: ", 11);
STRING_LITERAL(TMP5185, "<a href=\"", 9);
STRING_LITERAL(TMP5186, "\">", 2);
STRING_LITERAL(TMP5187, "</a>", 4);
STRING_LITERAL(TMP5188, ", ", 2);
STRING_LITERAL(TMP5189, ".<br>", 5);
STRING_LITERAL(TMP5190, "<p />", 5);
STRING_LITERAL(TMP5191, "Modules: ", 9);
STRING_LITERAL(TMP5192, ".html\">", 7);
STRING_LITERAL(TMP5193, "<h2>Documentation files</h2>\015\012", 30);
STRING_LITERAL(TMP5197, "<ul>\015\012", 6);
STRING_LITERAL(TMP5198, "<ul>", 4);
STRING_LITERAL(TMP5199, "</ul>", 5);
STRING_LITERAL(TMP5200, "<li><a href=\"", 13);
STRING_LITERAL(TMP5201, "</a>\015\012", 6);
STRING_LITERAL(TMP5202, "</ul>\015\012", 7);
STRING_LITERAL(TMP5203, "<ul><li><a href=\"", 17);
STRING_LITERAL(TMP5204, "<h2>API symbols</h2>\015\012", 22);
STRING_LITERAL(TMP5205, "<dt><a name=\"$2\" href=\"#$2\"><span>$1:</span></a></dt><ul class="
"\"simple\"><dd>\015\012", 78);
STRING_LITERAL(TMP5206, "<li><a class=\"reference external\"\015\012          title=\"$3\" href=\"$"
"1\">$2</a></li>\015\012          ", 89);
STRING_LITERAL(TMP5207, "<li><a class=\"reference external\" href=\"$1\">$2</a></li>\015\012      "
"    ", 67);
STRING_LITERAL(TMP5208, "</ul></dd>\015\012", 12);
NimStringDesc* splitter_349489;
extern Gcheap51018 gch_51059;
extern TNimType NTI343023; /* GeneralTokenizer */
extern TNimType NTI4011; /* RootObj */
TNimType NTI349016; /* RstGenerator */
TNimType NTI349010; /* OutputTarget */
extern TNimType NTI148214; /* StringTableRef */
extern TNimType NTI108; /* int */
TNimType NTI349012; /* TocEntry */
extern TNimType NTI334007; /* PRstNode */
extern TNimType NTI149; /* string */
TNimType NTI349035; /* seq[TocEntry] */
extern TNimType NTI138; /* bool */
extern TNimType NTI335015; /* RstParseOptions */
extern TNimType NTI335023; /* FindFileHandler */
extern TNimType NTI335021; /* MsgHandler */
TNimType NTI349045; /* array[MetaEnum, string] */
extern TNimType NTI349053; /* Table */
extern TNimType NTI132408; /* seq[string] */
TNimType NTI350397; /* IndexEntry */
TNimType NTI353507; /* seq[IndexEntry] */
extern TY112249 Dl_112248;
extern TY112405 Dl_112404;
extern TNimType NTI350413; /* KeyValuePairSeq */
TNimType NTI351075; /* tuple[level: int, text: string] */
TNimType NTI351074; /* seq[tuple[level: int, text: string]] */

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

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

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

N_NIMCALL(void, renderaux_349734)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	{
		NI i_349752;
		NI HEX3Atmp_349754;
		NI LOC2;
		NI res_349757;
		i_349752 = 0;
		HEX3Atmp_349754 = 0;
		LOC2 = 0;
		LOC2 = len_334090(n);
		HEX3Atmp_349754 = (NI)(LOC2 - ((NI) 1));
		res_349757 = ((NI) 0);
		{
			while (1) {
				if (!(res_349757 <= HEX3Atmp_349754)) goto LA4;
				i_349752 = res_349757;
				renderrsttoout_349724(d, (*n).sons->data[i_349752], result);
				res_349757 += ((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) {
	{
		Cell48946* c;
		if (!!((src == NIM_NIL))) goto LA3;
		c = usrtocell_52646(src);
		(*c).refcount += ((NI) 8);
	}
	LA3: ;
	{
		Cell48946* c;
		if (!!(((*dest) == NIM_NIL))) goto LA7;
		c = usrtocell_52646((*dest));
		{
			(*c).refcount -= ((NI) 8);
			if (!((NU32)((*c).refcount) < (NU32)(((NI) 8)))) goto LA11;
			rtladdzct_54204(c);
		}
		LA11: ;
	}
	LA7: ;
	(*dest) = src;
}

N_NIMCALL(void, dispa_349689)(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_349835)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2213), ((NimStringDesc*) &TMP2214));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2215), ((NimStringDesc*) &TMP2216));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2217), ((NimStringDesc*) &TMP2218));
	return result;
}

N_NIMCALL(void, setindexterm_349855)(Rstgenerator349016* 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*) &TMP2212));
	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_349835(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_349835(linkdesc);
		LOC15 = rawNewString(LOC16->Sup.len + 1);
appendChar(LOC15, 9);
appendString(LOC15, LOC16);
		entry = resizeString(entry, LOC15->Sup.len + 0);
appendString(entry, LOC15);
	}
	LA11: ;
	entry = resizeString(entry, 2);
appendString(entry, ((NimStringDesc*) &TMP2215));
	{
		if (!istitle) goto LA19;
		insert_93801((&(*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_355641)(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_355661)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* sectionprefix;
	NimStringDesc* refname;
	NimStringDesc* LOC14;
	NimStringDesc* LOC15;
	NimStringDesc* LOC25;
	NimStringDesc* LOC26;
	NimStringDesc* LOC27;
	tmp = copyString(((NimStringDesc*) &TMP2206));
	{
		NI i_355680;
		NI HEX3Atmp_355806;
		NI LOC2;
		NI res_355809;
		i_355680 = 0;
		HEX3Atmp_355806 = 0;
		LOC2 = 0;
		LOC2 = len_334090(n);
		HEX3Atmp_355806 = (NI)(LOC2 - ((NI) 1));
		res_355809 = ((NI) 0);
		{
			while (1) {
				if (!(res_355809 <= HEX3Atmp_355806)) goto LA4;
				i_355680 = res_355809;
				renderrsttoout_349724(d, (*n).sons->data[i_355680], (&tmp));
				res_355809 += ((NI) 1);
			} LA4: ;
		}
	}
	unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
	sectionprefix = copyString(((NimStringDesc*) &TMP2206));
	{
		NI i_355694;
		NI HEX3Atmp_355814;
		NI res_355817;
		i_355694 = 0;
		HEX3Atmp_355814 = 0;
		HEX3Atmp_355814 = ((*d).tocpart ? ((*d).tocpart->Sup.len-1) : -1);
		res_355817 = HEX3Atmp_355814;
		{
			while (1) {
				Rstnode334011* n2;
				if (!(((NI) 0) <= res_355817)) goto LA7;
				i_355694 = res_355817;
				n2 = (*d).tocpart->data[i_355694].n;
				{
					NimStringDesc* LOC12;
					NimStringDesc* LOC13;
					if (!((*n2).level < (*n).level)) goto LA10;
					LOC12 = 0;
					LOC13 = 0;
					LOC13 = rstnodetorefname_335067(n2);
					LOC12 = rawNewString(LOC13->Sup.len + 1);
appendString(LOC12, LOC13);
appendString(LOC12, ((NimStringDesc*) &TMP2208));
					sectionprefix = LOC12;
					goto LA5;
				}
				LA10: ;
				res_355817 -= ((NI) 1);
			} LA7: ;
		}
	} LA5: ;
	LOC14 = 0;
	LOC15 = 0;
	LOC15 = rstnodetorefname_335067(n);
	LOC14 = rawNewString(sectionprefix->Sup.len + LOC15->Sup.len + 0);
appendString(LOC14, sectionprefix);
appendString(LOC14, LOC15);
	refname = LOC14;
	{
		NI length;
		NimStringDesc* LOC20;
		NimStringDesc* LOC21;
		TY196829 LOC22;
		if (!(*d).hastoc) goto LA18;
		length = ((*d).tocpart ? (*d).tocpart->Sup.len : 0);
		(*d).tocpart = (TY349035*) setLengthSeq(&((*d).tocpart)->Sup, sizeof(Tocentry349012), ((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_349689((*d).target, result, ((NimStringDesc*) &TMP2209), ((NimStringDesc*) &TMP2210), LOC22, 4);
	}
	goto LA16;
	LA18: ;
	{
		TY196829 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_349689((*d).target, result, ((NimStringDesc*) &TMP2211), ((NimStringDesc*) &TMP2210), LOC24, 4);
	}
	LA16: ;
	LOC25 = 0;
	LOC25 = striptochtml_355641(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_349855(d, refname, LOC25, LOC26, ((NimStringDesc*) &TMP2206));
}

N_NIMCALL(void, renderoverline_355845)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	{
		if (!(((*d).meta[(((NU8) 1))- 0] ? (*d).meta[(((NU8) 1))- 0]->Sup.len : 0) == ((NI) 0))) goto LA3;
		{
			NI i_355863;
			NI HEX3Atmp_355906;
			NI LOC6;
			NI res_355909;
			i_355863 = 0;
			HEX3Atmp_355906 = 0;
			LOC6 = 0;
			LOC6 = len_334090(n);
			HEX3Atmp_355906 = (NI)(LOC6 - ((NI) 1));
			res_355909 = ((NI) 0);
			{
				while (1) {
					if (!(res_355909 <= HEX3Atmp_355906)) goto LA8;
					i_355863 = res_355909;
					renderrsttoout_349724(d, (*n).sons->data[i_355863], (&(*d).meta[(((NU8) 1))- 0]));
					res_355909 += ((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_355877;
			NI HEX3Atmp_355914;
			NI LOC13;
			NI res_355917;
			i_355877 = 0;
			HEX3Atmp_355914 = 0;
			LOC13 = 0;
			LOC13 = len_334090(n);
			HEX3Atmp_355914 = (NI)(LOC13 - ((NI) 1));
			res_355917 = ((NI) 0);
			{
				while (1) {
					if (!(res_355917 <= HEX3Atmp_355914)) goto LA15;
					i_355877 = res_355917;
					renderrsttoout_349724(d, (*n).sons->data[i_355877], (&(*d).meta[(((NU8) 2))- 0]));
					res_355917 += ((NI) 1);
				} LA15: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString((*d).meta[(((NU8) 2))- 0]));
	}
	goto LA1;
	LA10: ;
	{
		NimStringDesc* tmp;
		TY196829 LOC21;
		tmp = copyString(((NimStringDesc*) &TMP2206));
		{
			NI i_355892;
			NI HEX3Atmp_355922;
			NI LOC18;
			NI res_355925;
			i_355892 = 0;
			HEX3Atmp_355922 = 0;
			LOC18 = 0;
			LOC18 = len_334090(n);
			HEX3Atmp_355922 = (NI)(LOC18 - ((NI) 1));
			res_355925 = ((NI) 0);
			{
				while (1) {
					if (!(res_355925 <= HEX3Atmp_355922)) goto LA20;
					i_355892 = res_355925;
					renderrsttoout_349724(d, (*n).sons->data[i_355892], (&tmp));
					res_355925 += ((NI) 1);
				} LA20: ;
			}
		}
		unsureAsgnRef((void**) (&(*d).currentsection), copyString(tmp));
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nimIntToStr((*n).level);
		LOC21[1] = rstnodetorefname_335067(n);
		LOC21[2] = copyString(tmp);
		LOC21[3] = nimCharToStr(((NIM_CHAR) (((NI) ((NI)((NI)((*n).level - ((NI) 1)) + ((NI) 65)))))));
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2219), ((NimStringDesc*) &TMP2220), LOC21, 4);
	}
	LA1: ;
}

N_NIMCALL(void, renderaux_349776)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc* frmta, NimStringDesc* frmtb, NimStringDesc** result) {
	NimStringDesc* tmp;
	tmp = copyString(((NimStringDesc*) &TMP2206));
	{
		NI i_349797;
		NI HEX3Atmp_349813;
		NI LOC2;
		NI res_349816;
		i_349797 = 0;
		HEX3Atmp_349813 = 0;
		LOC2 = 0;
		LOC2 = len_334090(n);
		HEX3Atmp_349813 = (NI)(LOC2 - ((NI) 1));
		res_349816 = ((NI) 0);
		{
			while (1) {
				if (!(res_349816 <= HEX3Atmp_349813)) goto LA4;
				i_349797 = res_349816;
				renderrsttoout_349724(d, (*n).sons->data[i_349797], (&tmp));
				res_349816 += ((NI) 1);
			} LA4: ;
		}
	}
	{
		TY194421 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: ;
	{
		TY194421 LOC11;
		memset((void*)LOC11, 0, sizeof(LOC11));
		LOC11[0] = copyString(tmp);
		nsuAddf(result, frmtb, LOC11, 1);
	}
	LA5: ;
}

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

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

static N_INLINE(void, escchar_349494)(NU8 target, NimStringDesc** dest, NIM_CHAR c) {
	switch (target) {
	case ((NU8) 0):
	{
		addxmlchar_349456(dest, c);
	}
	break;
	case ((NU8) 1):
	{
		addtexchar_349478(dest, c);
	}
	break;
	}
}

N_NIMCALL(NimStringDesc*, esc_349553)(NU8 target, NimStringDesc* s, NI splitafter) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2206));
	{
		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_349506(s, j);
				{
					NIM_BOOL LOC9;
					LOC9 = 0;
					LOC9 = !(eqStrings(splitter_349489, ((NimStringDesc*) &TMP2238)));
					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_349489->Sup.len + 0);
appendString(result, splitter_349489);
				}
				LA11: ;
				{
					NI i_349574;
					NI res_349603;
					i_349574 = 0;
					res_349603 = j;
					{
						while (1) {
							if (!(res_349603 <= k)) goto LA15;
							i_349574 = res_349603;
							escchar_349494(target, (&result), s->data[i_349574]);
							res_349603 += ((NI) 1);
						} LA15: ;
					}
				}
				partlen += (NI)((NI)(k - j) + ((NI) 1));
				j = (NI)(k + ((NI) 1));
			} LA6: ;
		}
	}
	goto LA1;
	LA3: ;
	{
		{
			NI i_349597;
			NI HEX3Atmp_349608;
			NI res_349611;
			i_349597 = 0;
			HEX3Atmp_349608 = 0;
			HEX3Atmp_349608 = (NI)((s ? s->Sup.len : 0) - ((NI) 1));
			res_349611 = ((NI) 0);
			{
				while (1) {
					if (!(res_349611 <= HEX3Atmp_349608)) goto LA19;
					i_349597 = res_349611;
					escchar_349494(target, (&result), s->data[i_349597]);
					res_349611 += ((NI) 1);
				} LA19: ;
			}
		}
	}
	LA1: ;
	return result;
}

N_NIMCALL(void, renderfield_357517)(Rstgenerator349016* d, Rstnode334011* 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_335073((*n).sons->data[((NI) 0)]);
		LOC5 = 0;
		LOC5 = addnodes_335073((*n).sons->data[((NI) 1)]);
		LOC6 = 0;
		LOC6 = nsuStrip(LOC5, NIM_TRUE, NIM_TRUE, TMP2257);
		fieldval = esc_349553((*d).target, LOC6, ((NI) -1));
		{
			NIM_BOOL LOC9;
			NI LOC10;
			NI LOC12;
			LOC9 = 0;
			LOC10 = 0;
			LOC10 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2258));
			LOC9 = (LOC10 == ((NI) 0));
			if (LOC9) goto LA11;
			LOC12 = 0;
			LOC12 = nsuCmpIgnoreStyle(fieldname, ((NimStringDesc*) &TMP2259));
			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*) &TMP2260));
			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_349776(d, n, ((NimStringDesc*) &TMP2261), ((NimStringDesc*) &TMP2262), result);
	}
	LA29: ;
}

N_NIMCALL(NimStringDesc*, texcolumns_357477)(Rstnode334011* n) {
	NimStringDesc* result;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2206));
	{
		NI i_357493;
		NI HEX3Atmp_357495;
		NI res_357498;
		i_357493 = 0;
		HEX3Atmp_357495 = 0;
		HEX3Atmp_357495 = len_334090(n);
		res_357498 = ((NI) 1);
		{
			while (1) {
				if (!(res_357498 <= HEX3Atmp_357495)) goto LA3;
				i_357493 = res_357498;
				result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TMP2283));
				res_357498 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}

N_NIMCALL(NimStringDesc*, dispf_349666)(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_356013)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	NimStringDesc* options;
	NimStringDesc* s;
	NimStringDesc* arg;
	options = copyString(((NimStringDesc*) &TMP2206));
	s = getfieldvalue_335079(n, ((NimStringDesc*) &TMP2298));
	{
		NIM_BOOL LOC3;
		TY194421 LOC7;
		LOC3 = 0;
		LOC3 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC3)) goto LA4;
		LOC3 = allcharsinset_106130(s, TMP2299);
		LA4: ;
		if (!LOC3) goto LA5;
		memset((void*)LOC7, 0, sizeof(LOC7));
		LOC7[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2257);
		dispa_349689((*d).target, (&options), ((NimStringDesc*) &TMP2300), ((NimStringDesc*) &TMP2301), LOC7, 1);
	}
	LA5: ;
	s = getfieldvalue_335079(n, ((NimStringDesc*) &TMP2302));
	{
		NIM_BOOL LOC10;
		TY194421 LOC14;
		LOC10 = 0;
		LOC10 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC10)) goto LA11;
		LOC10 = allcharsinset_106130(s, TMP2299);
		LA11: ;
		if (!LOC10) goto LA12;
		memset((void*)LOC14, 0, sizeof(LOC14));
		LOC14[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2257);
		dispa_349689((*d).target, (&options), ((NimStringDesc*) &TMP2303), ((NimStringDesc*) &TMP2304), LOC14, 1);
	}
	LA12: ;
	s = getfieldvalue_335079(n, ((NimStringDesc*) &TMP2305));
	{
		NIM_BOOL LOC17;
		TY194421 LOC21;
		LOC17 = 0;
		LOC17 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC17)) goto LA18;
		LOC17 = allcharsinset_106130(s, TMP2299);
		LA18: ;
		if (!LOC17) goto LA19;
		memset((void*)LOC21, 0, sizeof(LOC21));
		LOC21[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2257);
		dispa_349689((*d).target, (&options), ((NimStringDesc*) &TMP2306), ((NimStringDesc*) &TMP2307), LOC21, 1);
	}
	LA19: ;
	s = getfieldvalue_335079(n, ((NimStringDesc*) &TMP2308));
	{
		NIM_BOOL LOC24;
		TY194421 LOC28;
		LOC24 = 0;
		LOC24 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC24)) goto LA25;
		LOC24 = allcharsinset_106130(s, TMP2299);
		LA25: ;
		if (!LOC24) goto LA26;
		memset((void*)LOC28, 0, sizeof(LOC28));
		LOC28[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2257);
		dispa_349689((*d).target, (&options), ((NimStringDesc*) &TMP2309), ((NimStringDesc*) &TMP2206), LOC28, 1);
	}
	LA26: ;
	s = getfieldvalue_335079(n, ((NimStringDesc*) &TMP2310));
	{
		NIM_BOOL LOC31;
		TY194421 LOC35;
		LOC31 = 0;
		LOC31 = (((NI) 0) < (s ? s->Sup.len : 0));
		if (!(LOC31)) goto LA32;
		LOC31 = allcharsinset_106130(s, TMP2299);
		LA32: ;
		if (!LOC31) goto LA33;
		memset((void*)LOC35, 0, sizeof(LOC35));
		LOC35[0] = nsuStrip(s, NIM_TRUE, NIM_TRUE, TMP2257);
		dispa_349689((*d).target, (&options), ((NimStringDesc*) &TMP2311), ((NimStringDesc*) &TMP2206), LOC35, 1);
	}
	LA33: ;
	{
		TY194421 LOC40;
		if (!(((NI) 0) < (options ? options->Sup.len : 0))) goto LA38;
		memset((void*)LOC40, 0, sizeof(LOC40));
		LOC40[0] = copyString(options);
		options = dispf_349666((*d).target, ((NimStringDesc*) &TMP2262), ((NimStringDesc*) &TMP2312), LOC40, 1);
	}
	LA38: ;
	arg = getargument_335086(n);
	{
		NIM_BOOL LOC43;
		TY195306 LOC47;
		LOC43 = 0;
		LOC43 = (((NI) 0) < (arg ? arg->Sup.len : 0));
		if (!(LOC43)) goto LA44;
		LOC43 = allcharsinset_106130(arg, TMP2299);
		LA44: ;
		if (!LOC43) goto LA45;
		memset((void*)LOC47, 0, sizeof(LOC47));
		LOC47[0] = copyString(arg);
		LOC47[1] = copyString(options);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2313), ((NimStringDesc*) &TMP2314), LOC47, 2);
	}
	LA45: ;
	{
		NI LOC50;
		LOC50 = 0;
		LOC50 = len_334090(n);
		if (!(((NI) 3) <= LOC50)) goto LA51;
		renderrsttoout_349724(d, (*n).sons->data[((NI) 2)], result);
	}
	LA51: ;
}

N_NIMCALL(void, init_349086)(Codeblockparams349020* p) {
	(*p).startline = ((NI) 1);
	(*p).lang = ((NU8) 0);
	unsureAsgnRef((void**) (&(*p).langstr), copyString(((NimStringDesc*) &TMP2206)));
}

N_NIMCALL(void, parsecodeblockfield_356293)(Rstgenerator349016* d, Rstnode334011* n, Codeblockparams349020* params) {
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	LOC1 = 0;
	LOC1 = getargument_335086(n);
	LOC2 = 0;
	LOC2 = nsuToLowerStr(LOC1);
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2315))) goto LA3;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2316))) goto LA4;
	if (eqStrings(LOC2, ((NimStringDesc*) &TMP2317))) goto LA5;
	goto LA6;
	LA3: ;
	{
		NI number;
		(*params).numberlines = NIM_TRUE;
		number = 0;
		{
			NimStringDesc* LOC11;
			NI LOC12;
			LOC11 = 0;
			LOC11 = getfieldvalue_338314(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_338314(n);
		unsureAsgnRef((void**) (&(*params).langstr), nsuStrip(LOC17, NIM_TRUE, NIM_TRUE, TMP2257));
		(*params).lang = getsourcelanguage_343099((*params).langstr);
	}
	goto LA7;
	LA6: ;
	{
		NimStringDesc* LOC19;
		LOC19 = 0;
		LOC19 = getargument_335086(n);
		(*d).msghandler((*d).filename, ((NI) 1), ((NI) 0), ((NU8) 9), LOC19);
	}
	LA7: ;
}

N_NIMCALL(void, parsecodeblockparams_356308)(Rstgenerator349016* d, Rstnode334011* n, Codeblockparams349020* Result) {
	NimStringDesc* LOC12;
{	init_349086(Result);
	{
		if (!n == 0) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!!((*n).sons->data[((NI) 1)] == 0)) goto LA7;
		{
			Rstnode334011* son_356811;
			Rstnodeseq334009* HEX3Atmp_356814;
			NI i_356817;
			NI L_356819;
			son_356811 = 0;
			HEX3Atmp_356814 = 0;
			HEX3Atmp_356814 = (*(*n).sons->data[((NI) 1)]).sons;
			i_356817 = ((NI) 0);
			L_356819 = (HEX3Atmp_356814 ? HEX3Atmp_356814->Sup.len : 0);
			{
				while (1) {
					if (!(i_356817 < L_356819)) goto LA11;
					son_356811 = HEX3Atmp_356814->data[i_356817];
					parsecodeblockfield_356293(d, son_356811, Result);
					i_356817 += ((NI) 1);
				} LA11: ;
			}
		}
	}
	LA7: ;
	LOC12 = 0;
	LOC12 = getargument_335086(n);
	unsureAsgnRef((void**) (&(*Result).langstr), nsuStrip(LOC12, NIM_TRUE, NIM_TRUE, TMP2257));
	{
		if (!!((((*Result).langstr) && ((*Result).langstr)->Sup.len == 0))) goto LA15;
		(*Result).lang = getsourcelanguage_343099((*Result).langstr);
	}
	LA15: ;
	}BeforeRet: ;
}

N_NIMCALL(void, buildlineshtmltable_356835)(Rstgenerator349016* d, Codeblockparams349020 params, NimStringDesc* code, Keyvaluepair148208* 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_149020((*d).config, ((NimStringDesc*) &TMP2326));
		unsureAsgnRef((void**) (&(*Result).Field0), nsuFormatSingleElem(LOC5, id));
		LOC6 = 0;
		LOC6 = getordefault_149020((*d).config, ((NimStringDesc*) &TMP2327));
		unsureAsgnRef((void**) (&(*Result).Field1), nsuFormatSingleElem(LOC6, id));
		goto BeforeRet;
	}
	LA3: ;
	LOC7 = 0;
	LOC7 = nsuStrip(code, NIM_TRUE, NIM_TRUE, TMP2257);
	LOC8 = 0;
	LOC8 = nsuCountLines(LOC7);
	codelines = (NI)(((NI) 1) + LOC8);
	unsureAsgnRef((void**) (&(*Result).Field0), copyString(((NimStringDesc*) &TMP2328)));
	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 + 2);
appendString(LOC11, LOC12);
appendString(LOC11, ((NimStringDesc*) &TMP2215));
			(*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_149020((*d).config, ((NimStringDesc*) &TMP2326));
	LOC15 = 0;
	LOC15 = nsuFormatSingleElem(LOC14, id);
	LOC13 = rawNewString(LOC15->Sup.len + 15);
appendString(LOC13, ((NimStringDesc*) &TMP2329));
appendString(LOC13, LOC15);
	(*Result).Field0 = resizeString((*Result).Field0, LOC13->Sup.len + 0);
appendString((*Result).Field0, LOC13);
	LOC16 = 0;
	LOC17 = 0;
	LOC17 = getordefault_149020((*d).config, ((NimStringDesc*) &TMP2327));
	LOC18 = 0;
	LOC18 = nsuFormatSingleElem(LOC17, id);
	LOC19 = 0;
	LOC19 = getordefault_149020((*d).config, ((NimStringDesc*) &TMP2331));
	LOC20 = 0;
	LOC20 = nsuFormatSingleElem(LOC19, id);
	LOC16 = rawNewString(LOC18->Sup.len + LOC20->Sup.len + 26);
appendString(LOC16, LOC18);
appendString(LOC16, ((NimStringDesc*) &TMP2330));
appendString(LOC16, LOC20);
	unsureAsgnRef((void**) (&(*Result).Field1), LOC16);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercodeblock_357033)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	Codeblockparams349020 params;
	Rstnode334011* m;
	Keyvaluepair148208 LOC5;
	NimStringDesc* blockstart;
	NimStringDesc* blockend;
	TY255724 LOC6;
	TY255724 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_356308(d, n, (&params));
	m = (*(*n).sons->data[((NI) 2)]).sons->data[((NI) 0)];
	memset((void*)(&LOC5), 0, sizeof(LOC5));
	buildlineshtmltable_356835(d, params, (*m).text, (&LOC5));
	blockstart = 0;
	blockstart = LOC5.Field0;
	blockend = 0;
	blockend = LOC5.Field1;
	memset((void*)LOC6, 0, sizeof(LOC6));
	dispa_349689((*d).target, result, blockstart, ((NimStringDesc*) &TMP2332), 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_357416;
			NimStringDesc* HEX3Atmp_357428;
			NI i_357431;
			NI L_357433;
			letter_357416 = 0;
			HEX3Atmp_357428 = 0;
			HEX3Atmp_357428 = (*m).text;
			i_357431 = ((NI) 0);
			L_357433 = (HEX3Atmp_357428 ? HEX3Atmp_357428->Sup.len : 0);
			{
				while (1) {
					if (!(i_357431 < L_357433)) goto LA17;
					letter_357416 = HEX3Atmp_357428->data[i_357431];
					escchar_349494((*d).target, result, letter_357416);
					i_357431 += ((NI) 1);
				} LA17: ;
			}
		}
	}
	goto LA7;
	LA9: ;
	{
		Generaltokenizer343023 g;
		memset((void*)(&g), 0, sizeof(g));
		g.Sup.m_type = (&NTI343023);
		initgeneraltokenizer_343289((&g), (*m).text);
		{
			while (1) {
				getnexttoken_345766((&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:
				{
					TY195306 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_349553((*d).target, LOC26, ((NI) -1));
					LOC25[1] = copyString(tokenclasstostr_343087[(g.kind)- 0]);
					dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2494), ((NimStringDesc*) &TMP2495), LOC25, 2);
				}
				break;
				}
			}
		} LA19: ;
		deinitgeneraltokenizer_343300((&g));
	}
	LA7: ;
	memset((void*)LOC27, 0, sizeof(LOC27));
	dispa_349689((*d).target, result, blockend, ((NimStringDesc*) &TMP2529), LOC27, 0);
	}BeforeRet: ;
}

N_NIMCALL(void, rendercontainer_357458)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	NimStringDesc* tmp;
	NimStringDesc* arg;
	NimStringDesc* LOC1;
	tmp = copyString(((NimStringDesc*) &TMP2206));
	renderrsttoout_349724(d, (*n).sons->data[((NI) 2)], (&tmp));
	LOC1 = 0;
	LOC1 = getargument_335086(n);
	arg = nsuStrip(LOC1, NIM_TRUE, NIM_TRUE, TMP2257);
	{
		TY194421 LOC6;
		if (!((arg) && (arg)->Sup.len == 0)) goto LA4;
		memset((void*)LOC6, 0, sizeof(LOC6));
		LOC6[0] = copyString(tmp);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2530), ((NimStringDesc*) &TMP2262), LOC6, 1);
	}
	goto LA2;
	LA4: ;
	{
		TY195306 LOC8;
		memset((void*)LOC8, 0, sizeof(LOC8));
		LOC8[0] = copyString(arg);
		LOC8[1] = copyString(tmp);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2531), ((NimStringDesc*) &TMP2532), LOC8, 2);
	}
	LA2: ;
}

N_NIMCALL(void, renderindexterm_350068)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	NimStringDesc* refname;
	NimStringDesc* id;
	NimStringDesc* LOC8;
	NI LOC9;
	NimStringDesc* LOC10;
	NimStringDesc* term;
	TY195306 LOC11;
	refname = rstnodetorefname_335067(n);
	{
		NIM_BOOL LOC3;
		NI LOC6;
		LOC3 = 0;
		LOC3 = haskey_350076((*d).seenindexterms, refname);
		if (!LOC3) goto LA4;
		LOC6 = 0;
		LOC6 = getordefault_350120((*d).seenindexterms, refname);
		HEX5BHEX5DHEX3D_350152((&(*d).seenindexterms), refname, (NI)(LOC6 + ((NI) 1)));
	}
	goto LA1;
	LA4: ;
	{
		HEX5BHEX5DHEX3D_350152((&(*d).seenindexterms), refname, ((NI) 1));
	}
	LA1: ;
	LOC8 = 0;
	LOC9 = 0;
	LOC9 = getordefault_350120((*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*) &TMP2206));
	renderaux_349734(d, n, (&term));
	setindexterm_349855(d, id, term, (*d).currentsection, ((NimStringDesc*) &TMP2206));
	memset((void*)LOC11, 0, sizeof(LOC11));
	LOC11[0] = copyString(id);
	LOC11[1] = copyString(term);
	dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2546), ((NimStringDesc*) &TMP2547), LOC11, 2);
}

N_NIMCALL(void, rendersmiley_356279)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
	TY194421 LOC1;
	NimStringDesc* LOC2;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC2 = 0;
	LOC2 = getordefault_149020((*d).config, ((NimStringDesc*) &TMP2552));
	LOC1[0] = nsuFormatSingleElem(LOC2, (*n).text);
	dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2550), ((NimStringDesc*) &TMP2551), LOC1, 1);
}

N_NIMCALL(void, renderrsttoout_349724)(Rstgenerator349016* d, Rstnode334011* n, NimStringDesc** result) {
{	{
		if (!(n == NIM_NIL)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	switch ((*n).kind) {
	case ((NU8) 0):
	{
		renderaux_349734(d, n, result);
	}
	break;
	case ((NU8) 1):
	{
		renderheadline_355661(d, n, result);
	}
	break;
	case ((NU8) 2):
	{
		renderoverline_355845(d, n, result);
	}
	break;
	case ((NU8) 3):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2221), ((NimStringDesc*) &TMP2222), result);
	}
	break;
	case ((NU8) 4):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2223), ((NimStringDesc*) &TMP2224), result);
	}
	break;
	case ((NU8) 5):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2225), ((NimStringDesc*) &TMP2226), result);
	}
	break;
	case ((NU8) 6):
	case ((NU8) 8):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2227), ((NimStringDesc*) &TMP2228), result);
	}
	break;
	case ((NU8) 7):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2229), ((NimStringDesc*) &TMP2230), result);
	}
	break;
	case ((NU8) 9):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2231), ((NimStringDesc*) &TMP2232), result);
	}
	break;
	case ((NU8) 10):
	{
		renderaux_349734(d, n, result);
	}
	break;
	case ((NU8) 11):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2233), ((NimStringDesc*) &TMP2234), result);
	}
	break;
	case ((NU8) 12):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2235), ((NimStringDesc*) &TMP2236), result);
	}
	break;
	case ((NU8) 13):
	{
		NimStringDesc* tmp;
		tmp = copyString(((NimStringDesc*) &TMP2206));
		{
			NI i_357572;
			NI HEX3Atmp_357634;
			NI LOC19;
			NI res_357637;
			i_357572 = 0;
			HEX3Atmp_357634 = 0;
			LOC19 = 0;
			LOC19 = len_334090(n);
			HEX3Atmp_357634 = (NI)(LOC19 - ((NI) 1));
			res_357637 = ((NI) 0);
			{
				while (1) {
					if (!(res_357637 <= HEX3Atmp_357634)) goto LA21;
					i_357572 = res_357637;
					renderrsttoout_349724(d, (*n).sons->data[i_357572], (&tmp));
					res_357637 += ((NI) 1);
				} LA21: ;
			}
		}
		{
			TY194421 LOC26;
			if (!!(((tmp ? tmp->Sup.len : 0) == ((NI) 0)))) goto LA24;
			memset((void*)LOC26, 0, sizeof(LOC26));
			LOC26[0] = copyString(tmp);
			dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2237), ((NimStringDesc*) &TMP2232), LOC26, 1);
		}
		LA24: ;
	}
	break;
	case ((NU8) 14):
	{
		renderfield_357517(d, n, result);
	}
	break;
	case ((NU8) 15):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2263), ((NimStringDesc*) &TMP2264), result);
	}
	break;
	case ((NU8) 16):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2265), ((NimStringDesc*) &TMP2266), result);
	}
	break;
	case ((NU8) 51):
	{
		renderrsttoout_349724(d, (*n).sons->data[((NI) 2)], result);
	}
	break;
	case ((NU8) 17):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2267), ((NimStringDesc*) &TMP2268), result);
	}
	break;
	case ((NU8) 18):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2261), ((NimStringDesc*) &TMP2262), result);
	}
	break;
	case ((NU8) 19):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2269), ((NimStringDesc*) &TMP2270), result);
	}
	break;
	case ((NU8) 23):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2271), ((NimStringDesc*) &TMP2266), result);
	}
	break;
	case ((NU8) 20):
	case ((NU8) 21):
	case ((NU8) 22):
	{
		{
			if (!NIM_TRUE) goto LA38;
			raiseassert_92771(((NimStringDesc*) &TMP2273));
		}
		LA38: ;
	}
	break;
	case ((NU8) 24):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2274), ((NimStringDesc*) &TMP2275), result);
	}
	break;
	case ((NU8) 25):
	{
		{
			if (!NIM_TRUE) goto LA44;
			raiseassert_92771(((NimStringDesc*) &TMP2273));
		}
		LA44: ;
	}
	break;
	case ((NU8) 26):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2276), ((NimStringDesc*) &TMP2224), result);
	}
	break;
	case ((NU8) 27):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2277), ((NimStringDesc*) &TMP2278), result);
	}
	break;
	case ((NU8) 28):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2279), ((NimStringDesc*) &TMP2280), result);
	}
	break;
	case ((NU8) 29):
	case ((NU8) 30):
	{
		NimStringDesc* LOC50;
		NimStringDesc* LOC51;
		LOC50 = 0;
		LOC51 = 0;
		LOC51 = texcolumns_357477(n);
		LOC50 = rawNewString(LOC51->Sup.len + 65);
appendString(LOC50, ((NimStringDesc*) &TMP2282));
appendString(LOC50, LOC51);
appendString(LOC50, ((NimStringDesc*) &TMP2284));
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2281), LOC50, result);
	}
	break;
	case ((NU8) 31):
	{
		{
			NI LOC55;
			LOC55 = 0;
			LOC55 = len_334090(n);
			if (!(((NI) 1) <= LOC55)) goto LA56;
			{
				if (!((*d).target == ((NU8) 1))) goto LA60;
				renderrsttoout_349724(d, (*n).sons->data[((NI) 0)], result);
				{
					NI i_357597;
					NI HEX3Atmp_357642;
					NI LOC63;
					NI res_357645;
					i_357597 = 0;
					HEX3Atmp_357642 = 0;
					LOC63 = 0;
					LOC63 = len_334090(n);
					HEX3Atmp_357642 = (NI)(LOC63 - ((NI) 1));
					res_357645 = ((NI) 1);
					{
						while (1) {
							if (!(res_357645 <= HEX3Atmp_357642)) goto LA65;
							i_357597 = res_357645;
							(*result) = resizeString((*result), 3);
appendString((*result), ((NimStringDesc*) &TMP2285));
							renderrsttoout_349724(d, (*n).sons->data[i_357597], result);
							res_357645 += ((NI) 1);
						} LA65: ;
					}
				}
				(*result) = resizeString((*result), 12);
appendString((*result), ((NimStringDesc*) &TMP2286));
			}
			goto LA58;
			LA60: ;
			{
				(*result) = resizeString((*result), 4);
appendString((*result), ((NimStringDesc*) &TMP2287));
				renderaux_349734(d, n, result);
				(*result) = resizeString((*result), 7);
appendString((*result), ((NimStringDesc*) &TMP2288));
			}
			LA58: ;
		}
		LA56: ;
	}
	break;
	case ((NU8) 33):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2265), ((NimStringDesc*) &TMP2262), result);
	}
	break;
	case ((NU8) 32):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2289), ((NimStringDesc*) &TMP2290), result);
	}
	break;
	case ((NU8) 34):
	{
		{
			if (!NIM_TRUE) goto LA72;
			raiseassert_92771(((NimStringDesc*) &TMP2273));
		}
		LA72: ;
	}
	break;
	case ((NU8) 35):
	{
		{
			if (!NIM_TRUE) goto LA77;
			raiseassert_92771(((NimStringDesc*) &TMP2273));
		}
		LA77: ;
	}
	break;
	case ((NU8) 36):
	{
		{
			if (!NIM_TRUE) goto LA82;
			raiseassert_92771(((NimStringDesc*) &TMP2273));
		}
		LA82: ;
	}
	break;
	case ((NU8) 39):
	{
		NimStringDesc* tmp;
		TY195306 LOC85;
		tmp = copyString(((NimStringDesc*) &TMP2206));
		renderaux_349734(d, n, (&tmp));
		memset((void*)LOC85, 0, sizeof(LOC85));
		LOC85[0] = copyString(tmp);
		LOC85[1] = rstnodetorefname_335067(n);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2291), ((NimStringDesc*) &TMP2292), LOC85, 2);
	}
	break;
	case ((NU8) 37):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2293), ((NimStringDesc*) &TMP2294), result);
	}
	break;
	case ((NU8) 38):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY195306 LOC88;
		tmp0 = copyString(((NimStringDesc*) &TMP2206));
		tmp1 = copyString(((NimStringDesc*) &TMP2206));
		renderrsttoout_349724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_349724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC88, 0, sizeof(LOC88));
		LOC88[0] = copyString(tmp0);
		LOC88[1] = copyString(tmp1);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2295), ((NimStringDesc*) &TMP2296), LOC88, 2);
	}
	break;
	case ((NU8) 41):
	case ((NU8) 42):
	{
		renderaux_349734(d, n, result);
	}
	break;
	case ((NU8) 48):
	{
		{
			Rstnode334011* LOC95;
			NimStringDesc* LOC96;
			if (!!(((*d).target == ((NU8) 1)))) goto LA93;
			LOC95 = 0;
			LOC95 = lastson_334153(n);
			LOC96 = 0;
			LOC96 = addnodes_335073(LOC95);
			(*result) = resizeString((*result), LOC96->Sup.len + 0);
appendString((*result), LOC96);
		}
		LA93: ;
	}
	break;
	case ((NU8) 49):
	{
		{
			Rstnode334011* LOC102;
			NimStringDesc* LOC103;
			if (!((*d).target == ((NU8) 1))) goto LA100;
			LOC102 = 0;
			LOC102 = lastson_334153(n);
			LOC103 = 0;
			LOC103 = addnodes_335073(LOC102);
			(*result) = resizeString((*result), LOC103->Sup.len + 0);
appendString((*result), LOC103);
		}
		LA100: ;
	}
	break;
	case ((NU8) 45):
	case ((NU8) 46):
	{
		renderimage_356013(d, n, result);
	}
	break;
	case ((NU8) 47):
	{
		rendercodeblock_357033(d, n, result);
	}
	break;
	case ((NU8) 50):
	{
		rendercontainer_357458(d, n, result);
	}
	break;
	case ((NU8) 62):
	case ((NU8) 52):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2533), ((NimStringDesc*) &TMP2533), result);
	}
	break;
	case ((NU8) 40):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2206), ((NimStringDesc*) &TMP2206), result);
	}
	break;
	case ((NU8) 53):
	{
		NimStringDesc* tmp0;
		NimStringDesc* tmp1;
		TY195306 LOC110;
		tmp0 = copyString(((NimStringDesc*) &TMP2206));
		tmp1 = copyString(((NimStringDesc*) &TMP2206));
		renderrsttoout_349724(d, (*n).sons->data[((NI) 0)], (&tmp0));
		renderrsttoout_349724(d, (*n).sons->data[((NI) 1)], (&tmp1));
		memset((void*)LOC110, 0, sizeof(LOC110));
		LOC110[0] = copyString(tmp0);
		LOC110[1] = copyString(tmp1);
		dispa_349689((*d).target, result, ((NimStringDesc*) &TMP2494), ((NimStringDesc*) &TMP2495), LOC110, 2);
	}
	break;
	case ((NU8) 54):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2534), ((NimStringDesc*) &TMP2535), result);
	}
	break;
	case ((NU8) 55):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2536), ((NimStringDesc*) &TMP2537), result);
	}
	break;
	case ((NU8) 57):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2538), ((NimStringDesc*) &TMP2539), result);
	}
	break;
	case ((NU8) 58):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2540), ((NimStringDesc*) &TMP2290), result);
	}
	break;
	case ((NU8) 59):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2541), ((NimStringDesc*) &TMP2542), result);
	}
	break;
	case ((NU8) 60):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2543), ((NimStringDesc*) &TMP2539), result);
	}
	break;
	case ((NU8) 56):
	{
		renderindexterm_350068(d, n, result);
	}
	break;
	case ((NU8) 61):
	{
		renderaux_349776(d, n, ((NimStringDesc*) &TMP2548), ((NimStringDesc*) &TMP2549), result);
	}
	break;
	case ((NU8) 63):
	{
		rendersmiley_356279(d, n, result);
	}
	break;
	case ((NU8) 64):
	{
		NimStringDesc* LOC121;
		LOC121 = 0;
		LOC121 = esc_349553((*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*) &TMP2206)));
		renderrsttoout_349724(d, (*n).sons->data[((NI) 0)], (&(*d).meta[(((NU8) 1))- 0]));
	}
	break;
	}
	}BeforeRet: ;
}
N_NIMCALL(void, TMP5016)(void* p, NI op) {
	TY349035* a;
	NI LOC1;
	a = (TY349035*)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_349096)(Rstgenerator349016* g, NU8 target, Stringtableobj148212* config, NimStringDesc* filename, NU8 options, Findfilehandler335023 findfile, Msghandler335021 msghandler) {
	TY122218 fileparts;
	NimStringDesc* s;
	unsureAsgnRef((void**) (&(*g).config), config);
	(*g).target = target;
	unsureAsgnRef((void**) (&(*g).tocpart), (TY349035*) newSeq((&NTI349035), 0));
	unsureAsgnRef((void**) (&(*g).filename), copyString(filename));
	(*g).splitafter = ((NI) 20);
	unsureAsgnRef((void**) (&(*g).theindex), copyString(((NimStringDesc*) &TMP2206)));
	(*g).options = options;
	(*g).findfile = findfile;
	unsureAsgnRef((void**) (&(*g).currentsection), copyString(((NimStringDesc*) &TMP2206)));
	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*) &TMP5020))) goto LA3;
		LOC5 = 0;
		LOC5 = rawNewString(fileparts.Field1->Sup.len + 7);
appendString(LOC5, ((NimStringDesc*) &TMP5021));
appendString(LOC5, fileparts.Field1);
		unsureAsgnRef((void**) (&(*g).currentsection), LOC5);
	}
	LA3: ;
	inittable_349124(((NI) 64), (&(*g).seenindexterms));
	(*g).msghandler = msghandler;
	s = getordefault_149020(config, ((NimStringDesc*) &TMP5022));
	{
		if (!!(((s) && (s)->Sup.len == 0))) goto LA8;
		(*g).splitafter = nsuParseInt(s);
	}
	LA8: ;
	{
		NU8 i_349423;
		NI res_349427;
		i_349423 = 0;
		res_349427 = ((NI) 0);
		{
			while (1) {
				if (!(res_349427 <= ((NI) 4))) goto LA12;
				i_349423 = ((NU8) (res_349427));
				unsureAsgnRef((void**) (&(*g).meta[(i_349423)- 0]), copyString(((NimStringDesc*) &TMP2206)));
				res_349427 += ((NI) 1);
			} LA12: ;
		}
	}
}

N_NIMCALL(void, rendertocentry_355962)(Rstgenerator349016* d, Tocentry349012 e, NimStringDesc** result) {
	TY195306 LOC1;
	memset((void*)LOC1, 0, sizeof(LOC1));
	LOC1[0] = copyString(e.refname);
	LOC1[1] = copyString(e.header);
	dispa_349689((*d).target, result, ((NimStringDesc*) &TMP5101), ((NimStringDesc*) &TMP5102), LOC1, 2);
}

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

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

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

N_NIMCALL(NIM_BOOL, isdocumentationtitle_350979)(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_349845)(NimStringDesc* text) {
	NimStringDesc* result;
	NimStringDesc* LOC1;
	NimStringDesc* LOC2;
	result = 0;
	LOC1 = 0;
	LOC1 = nsuReplaceStr(text, ((NimStringDesc*) &TMP2218), ((NimStringDesc*) &TMP2217));
	LOC2 = 0;
	LOC2 = nsuReplaceStr(LOC1, ((NimStringDesc*) &TMP2216), ((NimStringDesc*) &TMP2215));
	result = nsuReplaceStr(LOC2, ((NimStringDesc*) &TMP2214), ((NimStringDesc*) &TMP2213));
	return result;
}

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

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

N_NIMCALL(NI, hash_350447)(Indexentry350397 x) {
	NI result;
	NI LOC1;
	NI LOC2;
	NimStringDesc* LOC3;
	NI LOC4;
	NimStringDesc* LOC5;
	NI LOC6;
	result = 0;
	LOC1 = 0;
	LOC1 = hash_145848(x.keyword);
	LOC2 = 0;
	LOC2 = hash_145848(x.link);
	result = HEX21HEX26_145013(LOC1, LOC2);
	LOC3 = 0;
	LOC3 = or_349713(x.linktitle, ((NimStringDesc*) &TMP2206));
	LOC4 = 0;
	LOC4 = hash_145848(LOC3);
	result = HEX21HEX26_145013(result, LOC4);
	LOC5 = 0;
	LOC5 = or_349713(x.linkdesc, ((NimStringDesc*) &TMP2206));
	LOC6 = 0;
	LOC6 = hash_145848(LOC5);
	result = HEX21HEX26_145013(result, LOC6);
	result = HEX21HEX24_145042(result);
	return result;
}

N_NIMCALL(void, readindexdir_353501)(NimStringDesc* dir, TY353504* Result) {
	NI L;
	TY354105 LOC91;
	unsureAsgnRef((void**) (&(*Result).Field0), (TY132408*) newSeq((&NTI132408), 0));
	inittable_353529(((NI) 32), (&(*Result).Field2));
	unsureAsgnRef((void**) (&(*Result).Field1), (TY353507*) newSeq((&NTI353507), ((NI) 15000)));
	(*Result).Field1 = (TY353507*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Indexentry350397), ((NI) 0));
	L = ((NI) 0);
	{
		NU8 kind_353636;
		NimStringDesc* path_353637;
		Win32finddata112219 f_355493;
		NI h_355495;
		NimStringDesc* LOC2;
		kind_353636 = 0;
		path_353637 = 0;
		memset((void*)(&f_355493), 0, sizeof(f_355493));
		LOC2 = 0;
		LOC2 = HEX2F_121890(dir, ((NimStringDesc*) &TMP5175));
		h_355495 = findfirstfile_125416(LOC2, (&f_355493));
		{
			if (!!((h_355495 == ((NI) -1)))) goto LA5;
			{
				while (1) {
					NU8 k_355497;
					k_355497 = ((NU8) 0);
					{
						NIM_BOOL LOC11;
						NimStringDesc* xx_355499;
						LOC11 = 0;
						LOC11 = skipfinddata_125437((&f_355493));
						if (!!(LOC11)) goto LA12;
						{
							if (!!(((NI32)(f_355493.dwfileattributes & ((NI32) 16)) == ((NI32) 0)))) goto LA16;
							k_355497 = ((NU8) 2);
						}
						LA16: ;
						{
							if (!!(((NI32)(f_355493.dwfileattributes & ((NI32) 1024)) == ((NI32) 0)))) goto LA20;
							k_355497 = (NU8)(k_355497 + ((NI) 1));
						}
						LA20: ;
						{
							NimStringDesc* LOC26;
							if (!NIM_FALSE) goto LA24;
							LOC26 = 0;
							LOC26 = HEX24_85487(((NI16*) ((&f_355493.cfilename[(((NI) 0))- 0]))));
							xx_355499 = nosextractFilename(LOC26);
						}
						goto LA22;
						LA24: ;
						{
							NimStringDesc* LOC28;
							NimStringDesc* LOC29;
							LOC28 = 0;
							LOC28 = HEX24_85487(((NI16*) ((&f_355493.cfilename[(((NI) 0))- 0]))));
							LOC29 = 0;
							LOC29 = nosextractFilename(LOC28);
							xx_355499 = HEX2F_121890(dir, LOC29);
						}
						LA22: ;
						kind_353636 = k_355497;
						path_353637 = xx_355499;
						{
							NIM_BOOL LOC32;
							TY353507* fileentries;
							Indexentry350397 title;
							NI F;
							LOC32 = 0;
							LOC32 = (kind_353636 == ((NU8) 0));
							if (!(LOC32)) goto LA33;
							LOC32 = nsuEndsWith(path_353637, ((NimStringDesc*) &TMP5176));
							LA33: ;
							if (!LOC32) goto LA34;
							fileentries = 0;
							memset((void*)(&title), 0, sizeof(title));
							F = ((NI) 0);
							fileentries = (TY353507*) newSeq((&NTI353507), ((NI) 500));
							fileentries = (TY353507*) setLengthSeq(&(fileentries)->Sup, sizeof(Indexentry350397), ((NI) 0));
							{
								NimStringDesc* line_353672;
								FILE* f_355478;
								NimStringDesc* res_355480;
								line_353672 = 0;
								f_355478 = open_16817(path_353637, ((NU8) 0), ((NI) 8000));
								res_355480 = rawNewString(((NI) 80));
								{
									while (1) {
										NIM_BOOL LOC39;
										LOC39 = 0;
										LOC39 = readline_16919(f_355478, (&res_355480));
										if (!LOC39) goto LA38;
										line_353672 = res_355480;
										{
											NI s;
											s = nsuFindChar(line_353672, 9, ((NI) 0));
											{
												if (!(s < ((NI) 0))) goto LA43;
												goto LA40;
											}
											LA43: ;
											fileentries = (TY353507*) setLengthSeq(&(fileentries)->Sup, sizeof(Indexentry350397), ((NI) ((NI)(F + ((NI) 1)))));
											asgnRefNoCycle((void**) (&fileentries->data[F].keyword), copyStrLast(line_353672, ((NI) 0), (NI)(s - ((NI) 1))));
											asgnRefNoCycle((void**) (&fileentries->data[F].link), copyStr(line_353672, (NI)(s + ((NI) 1))));
											{
												NIM_BOOL LOC47;
												LOC47 = 0;
												LOC47 = title.keyword == 0;
												if (!(LOC47)) goto LA48;
												LOC47 = isdocumentationtitle_350979(fileentries->data[F].link);
												LA48: ;
												if (!LOC47) goto LA49;
												title.keyword = copyString(fileentries->data[F].keyword);
												title.link = copyString(fileentries->data[F].link);
											}
											LA49: ;
											{
												NI LOC53;
												TY132408* extracols;
												NimStringDesc* LOC56;
												LOC53 = 0;
												LOC53 = nsuFindChar(fileentries->data[F].link, 9, ((NI) 0));
												if (!(((NI) 0) < LOC53)) goto LA54;
												extracols = nsuSplitChar(fileentries->data[F].link, 9);
												LOC56 = 0;
												LOC56 = fileentries->data[F].link; fileentries->data[F].link = copyStringRC1(extracols->data[((NI) 0)]);
												if (LOC56) nimGCunrefNoCycle(LOC56);
												asgnRefNoCycle((void**) (&fileentries->data[F].linktitle), unquoteindexcolumn_349845(extracols->data[((NI) 1)]));
												asgnRefNoCycle((void**) (&fileentries->data[F].linkdesc), unquoteindexcolumn_349845(extracols->data[((NI) 2)]));
											}
											goto LA51;
											LA54: ;
											{
												NimStringDesc* LOC58;
												NimStringDesc* LOC59;
												LOC58 = 0;
												LOC58 = fileentries->data[F].linktitle; fileentries->data[F].linktitle = copyStringRC1(NIM_NIL);
												if (LOC58) nimGCunrefNoCycle(LOC58);
												LOC59 = 0;
												LOC59 = fileentries->data[F].linkdesc; fileentries->data[F].linkdesc = copyStringRC1(NIM_NIL);
												if (LOC59) nimGCunrefNoCycle(LOC59);
											}
											LA51: ;
											F += ((NI) 1);
										} LA40: ;
									} LA38: ;
								}
								fclose(f_355478);
							}
							{
								TY122218 LOC80;
								NimStringDesc* LOC81;
								if (!title.keyword == 0) goto LA62;
								{
									NI i_353828;
									NI HEX3Atmp_355484;
									NI res_355487;
									i_353828 = 0;
									HEX3Atmp_355484 = 0;
									HEX3Atmp_355484 = (F - 1);
									res_355487 = ((NI) 0);
									{
										while (1) {
											if (!(res_355487 <= HEX3Atmp_355484)) goto LA66;
											i_353828 = res_355487;
											{
												NimStringDesc* toc;
												NimStringDesc* LOC76;
												NimStringDesc* LOC77;
												NimStringDesc* LOC78;
												NimStringDesc* LOC79;
												toc = fileentries->data[i_353828].linktitle;
												{
													NIM_BOOL LOC70;
													NIM_BOOL LOC71;
													LOC70 = 0;
													LOC71 = 0;
													LOC71 = !(toc == 0);
													if (!(LOC71)) goto LA72;
													LOC71 = (((NI) 0) < (toc ? toc->Sup.len : 0));
													LA72: ;
													LOC70 = LOC71;
													if (!(LOC70)) goto LA73;
													LOC70 = ((NU8)(toc->data[((NI) 0)]) == (NU8)(32));
													LA73: ;
													if (!LOC70) goto LA74;
													goto LA67;
												}
												LA74: ;
												(*Result).Field1 = (TY353507*) setLengthSeq(&((*Result).Field1)->Sup, sizeof(Indexentry350397), ((NI) ((NI)(L + ((NI) 1)))));
												LOC76 = 0;
												LOC76 = (*Result).Field1->data[L].keyword; (*Result).Field1->data[L].keyword = copyStringRC1(fileentries->data[i_353828].keyword);
												if (LOC76) nimGCunrefNoCycle(LOC76);
												LOC77 = 0;
												LOC77 = (*Result).Field1->data[L].link; (*Result).Field1->data[L].link = copyStringRC1(fileentries->data[i_353828].link);
												if (LOC77) nimGCunrefNoCycle(LOC77);
												LOC78 = 0;
												LOC78 = (*Result).Field1->data[L].linktitle; (*Result).Field1->data[L].linktitle = copyStringRC1(fileentries->data[i_353828].linktitle);
												if (LOC78) nimGCunrefNoCycle(LOC78);
												LOC79 = 0;
												LOC79 = (*Result).Field1->data[L].linkdesc; (*Result).Field1->data[L].linkdesc = copyStringRC1(fileentries->data[i_353828].linkdesc);
												if (LOC79) nimGCunrefNoCycle(LOC79);
												L += ((NI) 1);
											} LA67: ;
											res_355487 += ((NI) 1);
										} LA66: ;
									}
								}
								memset((void*)(&LOC80), 0, sizeof(LOC80));
								nossplitFile(path_353637, (&LOC80));
								(*Result).Field0 = (TY132408*) incrSeqV2(&((*Result).Field0)->Sup, sizeof(NimStringDesc*));
								LOC81 = 0;
								LOC81 = (*Result).Field0->data[(*Result).Field0->Sup.len]; (*Result).Field0->data[(*Result).Field0->Sup.len] = copyStringRC1(LOC80.Field1);
								if (LOC81) nimGCunrefNoCycle(LOC81);
								++(*Result).Field0->Sup.len;
							}
							goto LA60;
							LA62: ;
							{
								NimStringDesc* LOC83;
								NI LOC84;
								NimStringDesc* LOC85;
								LOC83 = 0;
								LOC84 = 0;
								LOC84 = len_353860((*Result).Field2);
								LOC85 = 0;
								LOC85 = nimIntToStr(LOC84);
								LOC83 = rawNewString(LOC85->Sup.len + 8);
appendString(LOC83, ((NimStringDesc*) &TMP5177));
appendString(LOC83, LOC85);
								title.linktitle = LOC83;
								HEX5BHEX5DHEX3D_353872((&(*Result).Field2), title, fileentries);
							}
							LA60: ;
						}
						LA34: ;
					}
					LA12: ;
					{
						NI32 LOC88;
						LOC88 = 0;
						LOC88 = Dl_112248(h_355495, (&f_355493));
						if (!(LOC88 == ((NI32) 0))) goto LA89;
						goto LA7;
					}
					LA89: ;
				}
			} LA7: ;
			Dl_112404(h_355495);
		}
		LA5: ;
	}
	memset((void*)(&LOC91), 0, sizeof(LOC91));
	LOC91.ClPrc = ((TMP5180) (cmp_6577)); LOC91.ClEnv = NIM_NIL;
	sort_354098((*Result).Field0->data, (*Result).Field0->Sup.len, LOC91, ((NU8) 1));
}

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

N_NIMCALL(void, HEX3CHEX2D_350815)(Indexentry350397* a, Indexentry350397 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_350436)(Indexentry350397 a, Indexentry350397 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_352796)(Table350410 docs) {
	NimStringDesc* result_352799;
	TY353507* titles;
	TY353507* result_352803;
	TY352027 LOC14;
	TY132408* chunks;
	NimStringDesc* LOC20;
	NimStringDesc* LOC21;
	result_352799 = 0;
	result_352799 = copyString(((NimStringDesc*) &TMP5181));
	result_352803 = (TY353507*) newSeq((&NTI353507), 0);
	{
		Indexentry350397 x_352807;
		memset((void*)(&x_352807), 0, sizeof(x_352807));
		{
			NI h_353395;
			NI HEX3Atmp_353397;
			NI res_353399;
			h_353395 = 0;
			HEX3Atmp_353397 = 0;
			HEX3Atmp_353397 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_353399 = ((NI) 0);
			{
				while (1) {
					if (!(res_353399 <= HEX3Atmp_353397)) goto LA4;
					h_353395 = res_353399;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_172281(docs.data->data[h_353395].Field0);
						if (!LOC7) goto LA8;
						x_352807.keyword = docs.data->data[h_353395].Field1.keyword;
						x_352807.link = docs.data->data[h_353395].Field1.link;
						x_352807.linktitle = docs.data->data[h_353395].Field1.linktitle;
						x_352807.linkdesc = docs.data->data[h_353395].Field1.linkdesc;
						result_352803 = (TY353507*) incrSeqV2(&(result_352803)->Sup, sizeof(Indexentry350397));
						LOC10 = 0;
						LOC10 = result_352803->data[result_352803->Sup.len].keyword; result_352803->data[result_352803->Sup.len].keyword = copyStringRC1(x_352807.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_352803->data[result_352803->Sup.len].link; result_352803->data[result_352803->Sup.len].link = copyStringRC1(x_352807.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_352803->data[result_352803->Sup.len].linktitle; result_352803->data[result_352803->Sup.len].linktitle = copyStringRC1(x_352807.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_352803->data[result_352803->Sup.len].linkdesc; result_352803->data[result_352803->Sup.len].linkdesc = copyStringRC1(x_352807.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
						++result_352803->Sup.len;
					}
					LA8: ;
					res_353399 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_352803, (&NTI353507));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP5184) (cmp_350436)); LOC14.ClEnv = NIM_NIL;
	sort_352020(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	chunks = (TY132408*) newSeq((&NTI132408), 0);
	{
		Indexentry350397 title_353377;
		NI i_353406;
		NI L_353408;
		memset((void*)(&title_353377), 0, sizeof(title_353377));
		i_353406 = ((NI) 0);
		L_353408 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC18;
				NimStringDesc* LOC19;
				if (!(i_353406 < L_353408)) goto LA17;
				title_353377.keyword = titles->data[i_353406].keyword;
				title_353377.link = titles->data[i_353406].link;
				title_353377.linktitle = titles->data[i_353406].linktitle;
				title_353377.linkdesc = titles->data[i_353406].linkdesc;
				LOC18 = 0;
				LOC18 = rawNewString(title_353377.link->Sup.len + title_353377.keyword->Sup.len + 15);
appendString(LOC18, ((NimStringDesc*) &TMP5185));
appendString(LOC18, title_353377.link);
appendString(LOC18, ((NimStringDesc*) &TMP5186));
appendString(LOC18, title_353377.keyword);
appendString(LOC18, ((NimStringDesc*) &TMP5187));
				chunks = (TY132408*) 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_353406 += ((NI) 1);
			} LA17: ;
		}
	}
	LOC20 = 0;
	LOC21 = 0;
	LOC21 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP5188));
	LOC20 = rawNewString(LOC21->Sup.len + 5);
appendString(LOC20, LOC21);
appendString(LOC20, ((NimStringDesc*) &TMP5189));
	result_352799 = resizeString(result_352799, LOC20->Sup.len + 0);
appendString(result_352799, LOC20);
	return result_352799;
}

N_NIMCALL(NimStringDesc*, generatemodulejumps_353436)(TY132408* modules) {
	NimStringDesc* result;
	TY132408* chunks;
	NimStringDesc* LOC6;
	NimStringDesc* LOC7;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP5191));
	chunks = (TY132408*) newSeq((&NTI132408), 0);
	{
		NimStringDesc* name_353468;
		NI i_353483;
		NI L_353485;
		name_353468 = 0;
		i_353483 = ((NI) 0);
		L_353485 = (modules ? modules->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				NimStringDesc* LOC5;
				if (!(i_353483 < L_353485)) goto LA3;
				name_353468 = modules->data[i_353483];
				LOC4 = 0;
				LOC4 = rawNewString(name_353468->Sup.len + name_353468->Sup.len + 20);
appendString(LOC4, ((NimStringDesc*) &TMP5185));
appendString(LOC4, name_353468);
appendString(LOC4, ((NimStringDesc*) &TMP5192));
appendString(LOC4, name_353468);
appendString(LOC4, ((NimStringDesc*) &TMP5187));
				chunks = (TY132408*) 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_353483 += ((NI) 1);
			} LA3: ;
		}
	}
	LOC6 = 0;
	LOC7 = 0;
	LOC7 = nsuJoinSep(chunks->data, chunks->Sup.len, ((NimStringDesc*) &TMP5188));
	LOC6 = rawNewString(LOC7->Sup.len + 5);
appendString(LOC6, LOC7);
appendString(LOC6, ((NimStringDesc*) &TMP5189));
	result = resizeString(result, LOC6->Sup.len + 0);
appendString(result, LOC6);
	return result;
}
N_NIMCALL(void, TMP5196)(void* p, NI op) {
	TY351074* a;
	NI LOC1;
	a = (TY351074*)p;
	LOC1 = 0;
	for (LOC1 = 0; LOC1 < a->Sup.len; LOC1++) {
	nimGCvisit((void*)a->data[LOC1].Field1, op);
	}
}

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

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

N_NIMCALL(void, striptoclevel_350989)(NimStringDesc* s, TY351075* Result) {
	Slice92171 LOC8;
	{
		NI c_351014;
		NI HEX3Atmp_351034;
		NI res_351037;
		c_351014 = 0;
		HEX3Atmp_351034 = 0;
		HEX3Atmp_351034 = ((s ? s->Sup.len : 0) - 1);
		res_351037 = ((NI) 0);
		{
			while (1) {
				if (!(res_351037 <= HEX3Atmp_351034)) goto LA3;
				c_351014 = res_351037;
				(*Result).Field0 = c_351014;
				{
					if (!!(((NU8)(s->data[c_351014]) == (NU8)(32)))) goto LA6;
					goto LA1;
				}
				LA6: ;
				res_351037 += ((NI) 1);
			} LA3: ;
		}
	} LA1: ;
	LOC8 = HEX2EHEX2E_108290((*Result).Field0, ((s ? s->Sup.len : 0) - 1));
	unsureAsgnRef((void**) (&(*Result).Field1), HEX5BHEX5D_92164(s, LOC8));
}

N_NIMCALL(NimStringDesc*, indenttolevel_351056)(NI* level, NI newlevel) {
	NimStringDesc* result;
{	result = 0;
	result = copyString(((NimStringDesc*) &TMP2206));
	{
		if (!((*level) == newlevel)) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		if (!((*level) < newlevel)) goto LA7;
		result = nsuRepeatStr(((NimStringDesc*) &TMP5198), ((NI) ((NI)(newlevel - (*level)))));
	}
	goto LA5;
	LA7: ;
	{
		result = nsuRepeatStr(((NimStringDesc*) &TMP5199), ((NI) ((NI)((*level) - newlevel))));
	}
	LA5: ;
	(*level) = newlevel;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationtoc_351068)(TY353507* entries) {
	NimStringDesc* result;
	NimStringDesc* titleref;
	TY351074* levels;
	NI L;
	NI level;
	NimStringDesc* LOC23;
	NimStringDesc* LOC24;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2206));
	titleref = 0;
	levels = 0;
	L = ((NI) 0);
	level = ((NI) 1);
	levels = (TY351074*) newSeq((&NTI351074), ((NI) ((entries ? entries->Sup.len : 0))));
	{
		Indexentry350397 entry_351211;
		NI i_351406;
		NI L_351408;
		memset((void*)(&entry_351211), 0, sizeof(entry_351211));
		i_351406 = ((NI) 0);
		L_351408 = (entries ? entries->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* LOC4;
				TY351075 LOC5;
				NI rawlevel;
				NimStringDesc* rawtext;
				if (!(i_351406 < L_351408)) goto LA3;
				entry_351211.keyword = entries->data[i_351406].keyword;
				entry_351211.link = entries->data[i_351406].link;
				entry_351211.linktitle = entries->data[i_351406].linktitle;
				entry_351211.linkdesc = entries->data[i_351406].linkdesc;
				LOC4 = 0;
				LOC4 = or_349713(entry_351211.linktitle, entry_351211.keyword);
				memset((void*)(&LOC5), 0, sizeof(LOC5));
				striptoclevel_350989(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_351211.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_351406 += ((NI) 1);
			} LA3: ;
		}
	}
	result = copyString(((NimStringDesc*) &TMP5197));
	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_350979(link);
				if (!LOC17) goto LA18;
				titleref = copyString(link);
			}
			goto LA15;
			LA18: ;
			{
				NimStringDesc* LOC21;
				NimStringDesc* LOC22;
				LOC21 = 0;
				LOC21 = indenttolevel_351056((&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 + 21);
appendString(LOC22, ((NimStringDesc*) &TMP5200));
appendString(LOC22, link);
appendString(LOC22, ((NimStringDesc*) &TMP5186));
appendString(LOC22, levels->data[L].Field1);
appendString(LOC22, ((NimStringDesc*) &TMP5201));
				result = resizeString(result, LOC22->Sup.len + 0);
appendString(result, LOC22);
			}
			LA15: ;
			L += ((NI) 1);
		} LA14: ;
	}
	LOC23 = 0;
	LOC24 = 0;
	LOC24 = indenttolevel_351056((&level), ((NI) 1));
	LOC23 = rawNewString(LOC24->Sup.len + 7);
appendString(LOC23, LOC24);
appendString(LOC23, ((NimStringDesc*) &TMP5202));
	result = resizeString(result, LOC23->Sup.len + 0);
appendString(result, LOC23);
	return result;
}

N_NIMCALL(NimStringDesc*, generatedocumentationindex_351431)(Table350410 docs) {
	NimStringDesc* result_351434;
	TY353507* titles;
	TY353507* result_351438;
	TY352027 LOC14;
	result_351434 = 0;
	result_351434 = copyString(((NimStringDesc*) &TMP2206));
	result_351438 = (TY353507*) newSeq((&NTI353507), 0);
	{
		Indexentry350397 x_351442;
		memset((void*)(&x_351442), 0, sizeof(x_351442));
		{
			NI h_352756;
			NI HEX3Atmp_352758;
			NI res_352760;
			h_352756 = 0;
			HEX3Atmp_352758 = 0;
			HEX3Atmp_352758 = (docs.data ? (docs.data->Sup.len-1) : -1);
			res_352760 = ((NI) 0);
			{
				while (1) {
					if (!(res_352760 <= HEX3Atmp_352758)) goto LA4;
					h_352756 = res_352760;
					{
						NIM_BOOL LOC7;
						NimStringDesc* LOC10;
						NimStringDesc* LOC11;
						NimStringDesc* LOC12;
						NimStringDesc* LOC13;
						LOC7 = 0;
						LOC7 = isfilled_172281(docs.data->data[h_352756].Field0);
						if (!LOC7) goto LA8;
						x_351442.keyword = docs.data->data[h_352756].Field1.keyword;
						x_351442.link = docs.data->data[h_352756].Field1.link;
						x_351442.linktitle = docs.data->data[h_352756].Field1.linktitle;
						x_351442.linkdesc = docs.data->data[h_352756].Field1.linkdesc;
						result_351438 = (TY353507*) incrSeqV2(&(result_351438)->Sup, sizeof(Indexentry350397));
						LOC10 = 0;
						LOC10 = result_351438->data[result_351438->Sup.len].keyword; result_351438->data[result_351438->Sup.len].keyword = copyStringRC1(x_351442.keyword);
						if (LOC10) nimGCunrefNoCycle(LOC10);
						LOC11 = 0;
						LOC11 = result_351438->data[result_351438->Sup.len].link; result_351438->data[result_351438->Sup.len].link = copyStringRC1(x_351442.link);
						if (LOC11) nimGCunrefNoCycle(LOC11);
						LOC12 = 0;
						LOC12 = result_351438->data[result_351438->Sup.len].linktitle; result_351438->data[result_351438->Sup.len].linktitle = copyStringRC1(x_351442.linktitle);
						if (LOC12) nimGCunrefNoCycle(LOC12);
						LOC13 = 0;
						LOC13 = result_351438->data[result_351438->Sup.len].linkdesc; result_351438->data[result_351438->Sup.len].linkdesc = copyStringRC1(x_351442.linkdesc);
						if (LOC13) nimGCunrefNoCycle(LOC13);
						++result_351438->Sup.len;
					}
					LA8: ;
					res_352760 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	genericSeqAssign((&titles), result_351438, (&NTI353507));
	memset((void*)(&LOC14), 0, sizeof(LOC14));
	LOC14.ClPrc = ((TMP5194) (cmp_350436)); LOC14.ClEnv = NIM_NIL;
	sort_352020(titles->data, titles->Sup.len, LOC14, ((NU8) 1));
	{
		Indexentry350397 title_352681;
		NI i_352766;
		NI L_352768;
		memset((void*)(&title_352681), 0, sizeof(title_352681));
		i_352766 = ((NI) 0);
		L_352768 = (titles ? titles->Sup.len : 0);
		{
			while (1) {
				NimStringDesc* toclist;
				TY353507* LOC18;
				NimStringDesc* LOC19;
				if (!(i_352766 < L_352768)) goto LA17;
				title_352681.keyword = titles->data[i_352766].keyword;
				title_352681.link = titles->data[i_352766].link;
				title_352681.linktitle = titles->data[i_352766].linktitle;
				title_352681.linkdesc = titles->data[i_352766].linkdesc;
				LOC18 = 0;
				LOC18 = getordefault_352683(docs, title_352681);
				toclist = generatedocumentationtoc_351068(LOC18);
				LOC19 = 0;
				LOC19 = rawNewString(title_352681.link->Sup.len + title_352681.keyword->Sup.len + toclist->Sup.len + 32);
appendString(LOC19, ((NimStringDesc*) &TMP5203));
appendString(LOC19, title_352681.link);
appendString(LOC19, ((NimStringDesc*) &TMP5186));
appendString(LOC19, title_352681.keyword);
appendString(LOC19, ((NimStringDesc*) &TMP5201));
appendString(LOC19, toclist);
appendString(LOC19, ((NimStringDesc*) &TMP5202));
				result_351434 = resizeString(result_351434, LOC19->Sup.len + 0);
appendString(result_351434, LOC19);
				i_352766 += ((NI) 1);
			} LA17: ;
		}
	}
	return result_351434;
}

N_NIMCALL(void, sortindex_350826)(Indexentry350397* 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_350852;
				NI HEX3Atmp_350863;
				NI res_350866;
				i_350852 = 0;
				HEX3Atmp_350863 = 0;
				HEX3Atmp_350863 = (NI)(n - ((NI) 1));
				res_350866 = h;
				{
					while (1) {
						Indexentry350397 v;
						NI j;
						if (!(res_350866 <= HEX3Atmp_350863)) goto LA11;
						i_350852 = res_350866;
						memset((void*)(&v), 0, sizeof(v));
						HEX3CHEX2D_350815((&v), a[i_350852]);
						j = i_350852;
						{
							while (1) {
								NI LOC14;
								LOC14 = 0;
								LOC14 = cmp_350436(a[(NI)(j - h)], v);
								if (!(((NI) 0) <= LOC14)) goto LA13;
								HEX3CHEX2D_350815((&a[j]), a[(NI)(j - h)]);
								j = (NI)(j - h);
								{
									if (!(j < h)) goto LA17;
									goto LA12;
								}
								LA17: ;
							} LA13: ;
						} LA12: ;
						HEX3CHEX2D_350815((&a[j]), v);
						res_350866 += ((NI) 1);
					} LA11: ;
				}
			}
			{
				if (!(h == ((NI) 1))) goto LA21;
				goto LA7;
			}
			LA21: ;
		}
	} LA7: ;
}

N_NIMCALL(NimStringDesc*, generatesymbolindex_350903)(TY353507* symbols) {
	NimStringDesc* result;
	NI i;
	result = 0;
	result = copyString(((NimStringDesc*) &TMP2206));
	i = ((NI) 0);
	{
		while (1) {
			NimStringDesc* keyword;
			NimStringDesc* cleanedkeyword;
			Slice92171 LOC3;
			TY195306 LOC4;
			NI j;
			if (!(i < (symbols ? symbols->Sup.len : 0))) goto LA2;
			keyword = symbols->data[i].keyword;
			LOC3 = HEX2EHEX2E_108290(((NI) 1), (NI)((keyword ? (keyword->Sup.len-1) : -1) - ((NI) 1)));
			cleanedkeyword = HEX5BHEX5D_92164(keyword, LOC3);
			memset((void*)LOC4, 0, sizeof(LOC4));
			LOC4[0] = copyString(keyword);
			LOC4[1] = copyString(cleanedkeyword);
			nsuAddf((&result), ((NimStringDesc*) &TMP5205), 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*) &TMP2206));
					}
					LA14: ;
					{
						TY195293 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*) &TMP5206), LOC23, 3);
					}
					goto LA19;
					LA21: ;
					{
						TY195306 LOC25;
						memset((void*)LOC25, 0, sizeof(LOC25));
						LOC25[0] = copyString(url);
						LOC25[1] = copyString(text);
						nsuAddf((&result), ((NimStringDesc*) &TMP5207), LOC25, 2);
					}
					LA19: ;
					j += ((NI) 1);
				} LA6: ;
			}
			result = resizeString(result, 12);
appendString(result, ((NimStringDesc*) &TMP5208));
			i = j;
		} LA2: ;
	}
	return result;
}

N_NIMCALL(NimStringDesc*, mergeindexes_355541)(NimStringDesc* dir) {
	NimStringDesc* result;
	TY353504 LOC1;
	TY132408* modules;
	TY353507* symbols;
	Table350410 docs;
	result = 0;
	memset((void*)(&LOC1), 0, sizeof(LOC1));
	readindexdir_353501(dir, (&LOC1));
	modules = 0;
	genericSeqAssign((&modules), LOC1.Field0, (&NTI132408));
	symbols = 0;
	genericSeqAssign((&symbols), LOC1.Field1, (&NTI353507));
	memset((void*)(&docs), 0, sizeof(docs));
	genericSeqAssign((&docs.data), LOC1.Field2.data, (&NTI350413));
	docs.counter = LOC1.Field2.counter;
	result = copyString(((NimStringDesc*) &TMP2206));
	{
		NI LOC4;
		NimStringDesc* LOC7;
		LOC4 = 0;
		LOC4 = len_353860(docs);
		if (!(((NI) 0) < LOC4)) goto LA5;
		LOC7 = 0;
		LOC7 = generatedocumentationjumps_352796(docs);
		result = resizeString(result, LOC7->Sup.len + 0);
appendString(result, LOC7);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP5190));
	}
	LA5: ;
	{
		NimStringDesc* LOC12;
		if (!(((NI) 0) < (modules ? modules->Sup.len : 0))) goto LA10;
		LOC12 = 0;
		LOC12 = generatemodulejumps_353436(modules);
		result = resizeString(result, LOC12->Sup.len + 0);
appendString(result, LOC12);
		result = resizeString(result, 5);
appendString(result, ((NimStringDesc*) &TMP5190));
	}
	LA10: ;
	{
		NI LOC15;
		NimStringDesc* LOC18;
		LOC15 = 0;
		LOC15 = len_353860(docs);
		if (!(((NI) 0) < LOC15)) goto LA16;
		result = resizeString(result, 30);
appendString(result, ((NimStringDesc*) &TMP5193));
		LOC18 = 0;
		LOC18 = generatedocumentationindex_351431(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_350826(symbols->data, symbols->Sup.len);
		result = resizeString(result, 22);
appendString(result, ((NimStringDesc*) &TMP5204));
		LOC23 = 0;
		LOC23 = generatesymbolindex_350903(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_349489; splitter_349489 = copyStringRC1(((NimStringDesc*) &TMP984));
	if (LOC1) nimGCunrefNoCycle(LOC1);
}

NIM_EXTERNC N_NOINLINE(void, docutils_rstgenDatInit000)(void) {
static TNimNode* TMP5011[14];
static TNimNode* TMP5012[2];
NI TMP5014;
static char* NIM_CONST TMP5013[2] = {
"outHtml", 
"outLatex"};
static TNimNode* TMP5015[3];
static TNimNode* TMP5172[4];
static TNimNode* TMP5195[2];
static TNimNode TMP976[30];
NTI349016.size = sizeof(Rstgenerator349016);
NTI349016.kind = 17;
NTI349016.base = (&NTI4011);
TMP5011[0] = &TMP976[1];
NTI349010.size = sizeof(NU8);
NTI349010.kind = 14;
NTI349010.base = 0;
NTI349010.flags = 3;
for (TMP5014 = 0; TMP5014 < 2; TMP5014++) {
TMP976[TMP5014+2].kind = 1;
TMP976[TMP5014+2].offset = TMP5014;
TMP976[TMP5014+2].name = TMP5013[TMP5014];
TMP5012[TMP5014] = &TMP976[TMP5014+2];
}
TMP976[4].len = 2; TMP976[4].kind = 2; TMP976[4].sons = &TMP5012[0];
NTI349010.node = &TMP976[4];
TMP976[1].kind = 1;
TMP976[1].offset = offsetof(Rstgenerator349016, target);
TMP976[1].typ = (&NTI349010);
TMP976[1].name = "target";
TMP5011[1] = &TMP976[5];
TMP976[5].kind = 1;
TMP976[5].offset = offsetof(Rstgenerator349016, config);
TMP976[5].typ = (&NTI148214);
TMP976[5].name = "config";
TMP5011[2] = &TMP976[6];
TMP976[6].kind = 1;
TMP976[6].offset = offsetof(Rstgenerator349016, splitafter);
TMP976[6].typ = (&NTI108);
TMP976[6].name = "splitAfter";
TMP5011[3] = &TMP976[7];
TMP976[7].kind = 1;
TMP976[7].offset = offsetof(Rstgenerator349016, listingcounter);
TMP976[7].typ = (&NTI108);
TMP976[7].name = "listingCounter";
TMP5011[4] = &TMP976[8];
NTI349012.size = sizeof(Tocentry349012);
NTI349012.kind = 18;
NTI349012.base = 0;
NTI349012.flags = 2;
TMP5015[0] = &TMP976[10];
TMP976[10].kind = 1;
TMP976[10].offset = offsetof(Tocentry349012, n);
TMP976[10].typ = (&NTI334007);
TMP976[10].name = "n";
TMP5015[1] = &TMP976[11];
TMP976[11].kind = 1;
TMP976[11].offset = offsetof(Tocentry349012, refname);
TMP976[11].typ = (&NTI149);
TMP976[11].name = "refname";
TMP5015[2] = &TMP976[12];
TMP976[12].kind = 1;
TMP976[12].offset = offsetof(Tocentry349012, header);
TMP976[12].typ = (&NTI149);
TMP976[12].name = "header";
TMP976[9].len = 3; TMP976[9].kind = 2; TMP976[9].sons = &TMP5015[0];
NTI349012.node = &TMP976[9];
NTI349035.size = sizeof(TY349035*);
NTI349035.kind = 24;
NTI349035.base = (&NTI349012);
NTI349035.flags = 2;
NTI349035.marker = TMP5016;
TMP976[8].kind = 1;
TMP976[8].offset = offsetof(Rstgenerator349016, tocpart);
TMP976[8].typ = (&NTI349035);
TMP976[8].name = "tocPart";
TMP5011[5] = &TMP976[13];
TMP976[13].kind = 1;
TMP976[13].offset = offsetof(Rstgenerator349016, hastoc);
TMP976[13].typ = (&NTI138);
TMP976[13].name = "hasToc";
TMP5011[6] = &TMP976[14];
TMP976[14].kind = 1;
TMP976[14].offset = offsetof(Rstgenerator349016, theindex);
TMP976[14].typ = (&NTI149);
TMP976[14].name = "theIndex";
TMP5011[7] = &TMP976[15];
TMP976[15].kind = 1;
TMP976[15].offset = offsetof(Rstgenerator349016, options);
TMP976[15].typ = (&NTI335015);
TMP976[15].name = "options";
TMP5011[8] = &TMP976[16];
TMP976[16].kind = 1;
TMP976[16].offset = offsetof(Rstgenerator349016, findfile);
TMP976[16].typ = (&NTI335023);
TMP976[16].name = "findFile";
TMP5011[9] = &TMP976[17];
TMP976[17].kind = 1;
TMP976[17].offset = offsetof(Rstgenerator349016, msghandler);
TMP976[17].typ = (&NTI335021);
TMP976[17].name = "msgHandler";
TMP5011[10] = &TMP976[18];
TMP976[18].kind = 1;
TMP976[18].offset = offsetof(Rstgenerator349016, filename);
TMP976[18].typ = (&NTI149);
TMP976[18].name = "filename";
TMP5011[11] = &TMP976[19];
NTI349045.size = sizeof(TY349045);
NTI349045.kind = 16;
NTI349045.base = (&NTI149);
NTI349045.flags = 2;
TMP976[19].kind = 1;
TMP976[19].offset = offsetof(Rstgenerator349016, meta);
TMP976[19].typ = (&NTI349045);
TMP976[19].name = "meta";
TMP5011[12] = &TMP976[20];
TMP976[20].kind = 1;
TMP976[20].offset = offsetof(Rstgenerator349016, currentsection);
TMP976[20].typ = (&NTI149);
TMP976[20].name = "currentSection";
TMP5011[13] = &TMP976[21];
TMP976[21].kind = 1;
TMP976[21].offset = offsetof(Rstgenerator349016, seenindexterms);
TMP976[21].typ = (&NTI349053);
TMP976[21].name = "seenIndexTerms";
TMP976[0].len = 14; TMP976[0].kind = 2; TMP976[0].sons = &TMP5011[0];
NTI349016.node = &TMP976[0];
NTI350397.size = sizeof(Indexentry350397);
NTI350397.kind = 18;
NTI350397.base = 0;
NTI350397.flags = 2;
TMP5172[0] = &TMP976[23];
TMP976[23].kind = 1;
TMP976[23].offset = offsetof(Indexentry350397, keyword);
TMP976[23].typ = (&NTI149);
TMP976[23].name = "keyword";
TMP5172[1] = &TMP976[24];
TMP976[24].kind = 1;
TMP976[24].offset = offsetof(Indexentry350397, link);
TMP976[24].typ = (&NTI149);
TMP976[24].name = "link";
TMP5172[2] = &TMP976[25];
TMP976[25].kind = 1;
TMP976[25].offset = offsetof(Indexentry350397, linktitle);
TMP976[25].typ = (&NTI149);
TMP976[25].name = "linkTitle";
TMP5172[3] = &TMP976[26];
TMP976[26].kind = 1;
TMP976[26].offset = offsetof(Indexentry350397, linkdesc);
TMP976[26].typ = (&NTI149);
TMP976[26].name = "linkDesc";
TMP976[22].len = 4; TMP976[22].kind = 2; TMP976[22].sons = &TMP5172[0];
NTI350397.node = &TMP976[22];
NTI353507.size = sizeof(TY353507*);
NTI353507.kind = 24;
NTI353507.base = (&NTI350397);
NTI353507.flags = 2;
NTI353507.marker = TMP5173;
NTI351075.size = sizeof(TY351075);
NTI351075.kind = 18;
NTI351075.base = 0;
NTI351075.flags = 2;
TMP5195[0] = &TMP976[28];
TMP976[28].kind = 1;
TMP976[28].offset = offsetof(TY351075, Field0);
TMP976[28].typ = (&NTI108);
TMP976[28].name = "Field0";
TMP5195[1] = &TMP976[29];
TMP976[29].kind = 1;
TMP976[29].offset = offsetof(TY351075, Field1);
TMP976[29].typ = (&NTI149);
TMP976[29].name = "Field1";
TMP976[27].len = 2; TMP976[27].kind = 2; TMP976[27].sons = &TMP5195[0];
NTI351075.node = &TMP976[27];
NTI351074.size = sizeof(TY351074*);
NTI351074.kind = 24;
NTI351074.base = (&NTI351075);
NTI351074.flags = 2;
NTI351074.marker = TMP5196;
}

