/* Generated by Nim Compiler v1.4.0 */
/*   (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

/* section: NIM_merge_HEADERS */

#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

/* section: NIM_merge_FRAME_DEFINES */
#define nimfr_(x, y)
#define nimln_(x, y)

/* section: NIM_merge_FORWARD_TYPES */
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw;
typedef struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw;
typedef struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q;
typedef struct tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ;
typedef struct tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w;
typedef struct tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA;
typedef struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ;
typedef struct tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg;
typedef struct tySequence__shxop0zPIs5Ec3k71aCLuQ tySequence__shxop0zPIs5Ec3k71aCLuQ;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ;
typedef struct tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA;
typedef struct RootObj RootObj;

/* section: NIM_merge_TYPES */
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q {
NU16 line;
NI16 col;
NI32 fileIndex;
};
typedef NU32 tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg;
typedef NU8 tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw;
struct tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw {
tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ* typ;
tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q info;
tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg flags;
tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind;
union{
struct {NI64 intVal;
} _kind_1;
struct {NF floatVal;
} _kind_2;
struct {NimStringDesc* strVal;
} _kind_3;
struct {tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w* sym;
} _kind_4;
struct {tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA* ident;
} _kind_5;
struct {tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ* sons;
} _kind_6;
};
NimStringDesc* comment;
};
struct tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg {
tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf;
NI lineFirst;
tySequence__shxop0zPIs5Ec3k71aCLuQ* lines;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ {
NI16 a;
NI b;
};
struct RootObj {
TNimType* m_type;
};
typedef NU8 tyEnum_TokenClass__UcAPDGzMlzghdb9c8MB7mEw;
struct tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA {
  RootObj Sup;
tyEnum_TokenClass__UcAPDGzMlzghdb9c8MB7mEw kind;
NI start;
NI length;
NCSTRING buf;
NI pos;
tyEnum_TokenClass__UcAPDGzMlzghdb9c8MB7mEw state;
};
typedef NU8 tyEnum_SourceLanguage__LpbEPkKqvJ0VCa4hwZcOBQ;
typedef NimStringDesc* tyArray__b121gTFK3KCOh1bfQWQzTw[33];
typedef NimStringDesc* tyArray__Re75IspeoxXy2oCZHwcRrA[2];

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__shxop0zPIs5Ec3k71aCLuQ {
  TGenericSeq Sup;
  NIM_BOOL data[SEQ_DECL_SIZE];
};
struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ {
  TGenericSeq Sup;
  tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* data[SEQ_DECL_SIZE];
};

/* section: NIM_merge_PROC_HEADERS */
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, lastSon__UPSW0jLTX5qJL51YMUAHgw)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, lastNodeRec__emGvWyXayXzbQhEbiXfOmw)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
static N_INLINE(NI, safeLen__P89cqdlERShb9alU3iC0yj8w_2ast)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
static N_INLINE(NI, len__P89cqdlERShb9alU3iC0yj8wast)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(NI, numLines__x9aqxDAtGd57HztdSIhXLtQ)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, NI32 fileIdx);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(void, visitMultilineStrings__UkrGWVFn3gU9awGu9bKNoeYA)(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg* ldata, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tripleStrLitStartsAtNextLine__dp8rWnodF4AWuY4DLzCs9cg)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, sourceLine__b49bYNvmBdG6RP9cHaZGFhvQ)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q i);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuContinuesWith)(NimStringDesc* s, NimStringDesc* substr, NI start);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
N_LIB_PRIVATE N_NIMCALL(TGenericSeq*, setLengthSeqV2)(TGenericSeq* s, TNimType* typ, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, startOfLineInsideTriple__q9az7y68MFbFHyFLILVn8lQ)(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg ldata, NI line);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isInIndentationBlock__3riiuYZWGAAnUZT2Z1xPNg)(NimStringDesc* src, NI indent);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
static N_INLINE(NimStringDesc*, X5BX5D___a4Z6gq4Xc4C9c9cc1DxJWBTQsystem)(NimStringDesc* s, tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ x);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ, dotdot___TfqUL7ztnyuRYaf9cyQBp7Asystem)(NI16 a, NI b);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void, initGeneralTokenizer__mu4EAfPX69bUQs62cfYLXRA)(tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA* g, NimStringDesc* buf);
N_LIB_PRIVATE N_NIMCALL(void, getNextToken__9axtJQpZ5U9aGuyq519c9axprw)(tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA* g, tyEnum_SourceLanguage__LpbEPkKqvJ0VCa4hwZcOBQ lang);
N_LIB_PRIVATE N_NIMCALL(void, addEscaped__6C2AvGe9brWF3cZheLyMXgA)(NimStringDesc** result, NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, substr__2yh9cer0ymNRHlOOg8P7IuA)(NimStringDesc* s, NI first, NI last);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(void, nsuAddf)(NimStringDesc** s, NimStringDesc* formatstr, NimStringDesc** a, NI aLen_0);

/* section: NIM_merge_DATA */
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_2, "\"\"\"", 3);
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_3, "renderverbatim.nim(44, 12) `src.continuesWith(tripleQuote, col)"
"` ", 65);
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_4, "renderverbatim.nim(49, 16) `src.len == i` ", 42);
extern TNimType NTI__shxop0zPIs5Ec3k71aCLuQ_;
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_5, "\012", 1);
extern TNimType NTI__XJrmQSLLjVmugZQb54lVWA_;
extern NIM_CONST tyArray__b121gTFK3KCOh1bfQWQzTw tokenClassToStr__XoxGqeDe9c9bun9b5PoCUnzlg;
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_6, "\\span$1{$2}", 11);
STRING_LITERAL(TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_7, "<span class=\"$1\">$2</span>", 26);

/* section: NIM_merge_PROCS */
static N_INLINE(NI, len__P89cqdlERShb9alU3iC0yj8wast)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NI result;
	NI T1_;
	result = (NI)0;
	T1_ = ((*n)._kind_6.sons ? (*n)._kind_6.sons->Sup.len : 0);
	result = T1_;
	return result;
}
static N_INLINE(NI, safeLen__P89cqdlERShb9alU3iC0yj8w_2ast)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NI result;
	result = (NI)0;
	{
		if (!((*n).kind >= ((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 0) && (*n).kind <= ((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 23))) goto LA3_;
		result = ((NI) 0);
	}
	goto LA1_;
	LA3_: ;
	{
		result = len__P89cqdlERShb9alU3iC0yj8wast(n);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, lastNodeRec__emGvWyXayXzbQhEbiXfOmw)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	result = n;
	{
		while (1) {
			NI T3_;
			NI T4_;
			T3_ = (NI)0;
			T3_ = safeLen__P89cqdlERShb9alU3iC0yj8w_2ast(result);
			if (!(((NI) 0) < T3_)) goto LA2;
			T4_ = (NI)0;
			T4_ = len__P89cqdlERShb9alU3iC0yj8wast(result);
			result = (*result)._kind_6.sons->data[(NI)(T4_ - ((NI) 1))];
		} LA2: ;
	}
	return result;
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, tripleStrLitStartsAtNextLine__dp8rWnodF4AWuY4DLzCs9cg)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NIM_BOOL result;
	NimStringDesc* src;
	NI16 col;
	NI16 i;
	NIM_BOOL onlySpace;
{	result = (NIM_BOOL)0;
	src = sourceLine__b49bYNvmBdG6RP9cHaZGFhvQ(conf, (*n).info);
	col = (*n).info.col;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nsuContinuesWith(src, ((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_2), ((NI) (col)));
		if (!!(T3_)) goto LA4_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_3));
	}
	LA4_: ;
	i = (NI16)(col + ((NI16) 3));
	onlySpace = NIM_TRUE;
	{
		while (1) {
			{
				if (!((src ? src->Sup.len : 0) <= ((NI) (i)))) goto LA10_;
				{
					if (!!(((src ? src->Sup.len : 0) == ((NI) (i))))) goto LA14_;
					failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_4));
				}
				LA14_: ;
				result = onlySpace;
				goto BeforeRet_;
			}
			goto LA8_;
			LA10_: ;
			{
				NIM_BOOL T17_;
				NIM_BOOL T19_;
				T17_ = (NIM_BOOL)0;
				T17_ = nsuContinuesWith(src, ((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_2), ((NI) (i)));
				if (!(T17_)) goto LA18_;
				T19_ = (NIM_BOOL)0;
				T19_ = ((src ? src->Sup.len : 0) == ((NI) ((NI16)(i + ((NI16) 3)))));
				if (T19_) goto LA20_;
				T19_ = !(((NU8)(src->data[(NI16)(i + ((NI16) 3))]) == (NU8)(34)));
				LA20_: ;
				T17_ = T19_;
				LA18_: ;
				if (!T17_) goto LA21_;
				result = NIM_FALSE;
				goto BeforeRet_;
			}
			goto LA8_;
			LA21_: ;
			{
				if (!!(((NU8)(src->data[i]) == (NU8)(32)))) goto LA24_;
				onlySpace = NIM_FALSE;
			}
			goto LA8_;
			LA24_: ;
			LA8_: ;
			i += ((NI) 1);
		}
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, visitMultilineStrings__UkrGWVFn3gU9awGu9bKNoeYA)(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg* ldata, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NI cline;
	cline = (*ldata).lineFirst;
	switch ((*n).kind) {
	case ((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 22):
	{
		cline = ((NI) ((*n).info.line));
		{
			NIM_BOOL T4_;
			NI indexX60gensym11_;
			T4_ = (NIM_BOOL)0;
			T4_ = tripleStrLitStartsAtNextLine__dp8rWnodF4AWuY4DLzCs9cg((*ldata).conf, n);
			if (!T4_) goto LA5_;
			cline += ((NI) 1);
			indexX60gensym11_ = (NI)(cline - (*ldata).lineFirst);
			{
				NI T9_;
				T9_ = ((*ldata).lines ? (*ldata).lines->Sup.len : 0);
				if (!(T9_ < (NI)(indexX60gensym11_ + ((NI) 1)))) goto LA10_;
				unsureAsgnRef((void**) (&(*ldata).lines), (tySequence__shxop0zPIs5Ec3k71aCLuQ*) setLengthSeqV2(&((*ldata).lines)->Sup, (&NTI__shxop0zPIs5Ec3k71aCLuQ_), ((NI) ((NI)(indexX60gensym11_ + ((NI) 1))))));
			}
			LA10_: ;
			(*ldata).lines->data[indexX60gensym11_] = NIM_TRUE;
		}
		LA5_: ;
		{
			NIM_CHAR ai;
			NimStringDesc* colontmp_;
			NI i;
			NI L;
			ai = (NIM_CHAR)0;
			colontmp_ = (NimStringDesc*)0;
			colontmp_ = (*n)._kind_3.strVal;
			i = ((NI) 0);
			L = (colontmp_ ? colontmp_->Sup.len : 0);
			{
				while (1) {
					if (!(i < L)) goto LA14;
					ai = colontmp_->data[i];
					switch (((NU8)(ai))) {
					case 10:
					{
						NI indexX60gensym12_;
						cline += ((NI) 1);
						indexX60gensym12_ = (NI)(cline - (*ldata).lineFirst);
						{
							NI T18_;
							T18_ = ((*ldata).lines ? (*ldata).lines->Sup.len : 0);
							if (!(T18_ < (NI)(indexX60gensym12_ + ((NI) 1)))) goto LA19_;
							unsureAsgnRef((void**) (&(*ldata).lines), (tySequence__shxop0zPIs5Ec3k71aCLuQ*) setLengthSeqV2(&((*ldata).lines)->Sup, (&NTI__shxop0zPIs5Ec3k71aCLuQ_), ((NI) ((NI)(indexX60gensym12_ + ((NI) 1))))));
						}
						LA19_: ;
						(*ldata).lines->data[indexX60gensym12_] = NIM_TRUE;
					}
					break;
					default:
					{
					}
					break;
					}
					i += ((NI) 1);
				} LA14: ;
			}
		}
	}
	break;
	default:
	{
		{
			NI i_2;
			NI colontmp__2;
			NI i_3;
			i_2 = (NI)0;
			colontmp__2 = (NI)0;
			colontmp__2 = safeLen__P89cqdlERShb9alU3iC0yj8w_2ast(n);
			i_3 = ((NI) 0);
			{
				while (1) {
					if (!(i_3 < colontmp__2)) goto LA25;
					i_2 = i_3;
					visitMultilineStrings__UkrGWVFn3gU9awGu9bKNoeYA(ldata, (*n)._kind_6.sons->data[i_2]);
					i_3 += ((NI) 1);
				} LA25: ;
			}
		}
	}
	break;
	}
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, startOfLineInsideTriple__q9az7y68MFbFHyFLILVn8lQ)(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg ldata, NI line) {
	NIM_BOOL result;
	NI index;
	result = (NIM_BOOL)0;
	index = (NI)(line - ldata.lineFirst);
	{
		NI T3_;
		T3_ = (ldata.lines ? ldata.lines->Sup.len : 0);
		if (!(T3_ <= index)) goto LA4_;
		result = NIM_FALSE;
	}
	goto LA1_;
	LA4_: ;
	{
		result = ldata.lines->data[index];
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isInIndentationBlock__3riiuYZWGAAnUZT2Z1xPNg)(NimStringDesc* src, NI indent) {
	NIM_BOOL result;
{	result = (NIM_BOOL)0;
	{
		NI j;
		NI i;
		j = (NI)0;
		i = ((NI) 0);
		{
			while (1) {
				if (!(i < indent)) goto LA3;
				j = i;
				{
					if (!((src ? src->Sup.len : 0) <= j)) goto LA6_;
					result = NIM_TRUE;
					goto BeforeRet_;
				}
				LA6_: ;
				{
					if (!!(((NU8)(src->data[j]) == (NU8)(32)))) goto LA10_;
					result = NIM_FALSE;
					goto BeforeRet_;
				}
				LA10_: ;
				i += ((NI) 1);
			} LA3: ;
		}
	}
	result = NIM_TRUE;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		void* T5_;
		void* T6_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (void*)0;
		T5_ = ((void*) ((&(*dest).data[(*dest).Sup.len])));
		T6_ = (void*)0;
		T6_ = ((void*) ((*src).data));
		copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(T5_, T6_, ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
static N_INLINE(NimStringDesc*, X5BX5D___a4Z6gq4Xc4C9c9cc1DxJWBTQsystem)(NimStringDesc* s, tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ x) {
	NimStringDesc* result;
	NI a;
	NI L;
	result = (NimStringDesc*)0;
	a = ((NI) (x.a));
	L = (NI)((NI)((NI)((s ? s->Sup.len : 0) - x.b) - a) + ((NI) 1));
	result = mnewString(((NI) (L)));
	{
		NI i;
		NI i_2;
		i = (NI)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < L)) goto LA3;
				i = i_2;
				result->data[i] = s->data[(NI)(i + a)];
				i_2 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}
static N_INLINE(tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ, dotdot___TfqUL7ztnyuRYaf9cyQBp7Asystem)(NI16 a, NI b) {
	tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ result;
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ));
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ));
	result.a = a;
	result.b = b;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, extractRunnableExamplesSource__CT0AYtMqaaWjtLZ9cUvHsiw)(tyObject_ConfigRefcolonObjectType___LaK09ayL9alwKUad7rts0rTw* conf, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n) {
	NimStringDesc* result;
	tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q first;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T1_;
	tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q last;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T7_;
	tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q info;
	NI16 indent;
	NU16 numLines;
	NI T8_;
	NI lastNonemptyPos;
	tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg ldata;
	NI T9_;
	result = (NimStringDesc*)0;
	T1_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T1_ = lastSon__UPSW0jLTX5qJL51YMUAHgw(n);
	first = (*T1_).info;
	{
		if (!(first.line == (*(*n)._kind_6.sons->data[((NI) 0)]).info.line)) goto LA4_;
	}
	goto LA2_;
	LA4_: ;
	{
		first.line = (NU16)((NU16)((*(*n)._kind_6.sons->data[((NI) 0)]).info.line) + (NU16)(((NU16) 1)));
	}
	LA2_: ;
	T7_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T7_ = lastNodeRec__emGvWyXayXzbQhEbiXfOmw(n);
	last = (*T7_).info;
	info = first;
	indent = info.col;
	T8_ = (NI)0;
	T8_ = numLines__x9aqxDAtGd57HztdSIhXLtQ(conf, info.fileIndex);
	numLines = ((NU16) (T8_));
	lastNonemptyPos = ((NI) 0);
	nimZeroMem((void*)(&ldata), sizeof(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg));
	nimZeroMem((void*)(&ldata), sizeof(tyObject_LineData__W79a9bpfDJtmOKaRHvpAcCMg));
	ldata.lineFirst = ((NI) (first.line));
	ldata.conf = conf;
	T9_ = (NI)0;
	T9_ = len__P89cqdlERShb9alU3iC0yj8wast(n);
	visitMultilineStrings__UkrGWVFn3gU9awGu9bKNoeYA((&ldata), (*n)._kind_6.sons->data[(NI)(T9_ - ((NI) 1))]);
	result = ((NimStringDesc*) NIM_NIL);
	{
		NU16 line;
		NI res;
		line = (NU16)0;
		res = ((NI) (first.line));
		{
			while (1) {
				NimStringDesc* src;
				NIM_BOOL special;
				if (!(res <= ((NI) (numLines)))) goto LA12;
				line = ((NU16) (res));
				info.line = line;
				src = sourceLine__b49bYNvmBdG6RP9cHaZGFhvQ(conf, info);
				special = startOfLineInsideTriple__q9az7y68MFbFHyFLILVn8lQ(ldata, ((NI) (line)));
				{
					NIM_BOOL T15_;
					NIM_BOOL T16_;
					NIM_BOOL T19_;
					T15_ = (NIM_BOOL)0;
					T16_ = (NIM_BOOL)0;
					T16_ = ((NU16)(last.line) < (NU16)(line));
					if (!(T16_)) goto LA17_;
					T16_ = !(special);
					LA17_: ;
					T15_ = T16_;
					if (!(T15_)) goto LA18_;
					T19_ = (NIM_BOOL)0;
					T19_ = isInIndentationBlock__3riiuYZWGAAnUZT2Z1xPNg(src, ((NI) (indent)));
					T15_ = !(T19_);
					LA18_: ;
					if (!T15_) goto LA20_;
					goto LA10;
				}
				LA20_: ;
				{
					if (!((NU16)(first.line) < (NU16)(line))) goto LA24_;
					result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_5));
				}
				LA24_: ;
				{
					if (!special) goto LA28_;
					result = resizeString(result, (src ? src->Sup.len : 0) + 0);
appendString(result, src);
					lastNonemptyPos = (result ? result->Sup.len : 0);
				}
				goto LA26_;
				LA28_: ;
				{
					tyObject_HSlice__tWbbzDT29cxDfMvWataNEeQ T33_;
					NimStringDesc* T34_;
					if (!(((NI) (indent)) < (src ? src->Sup.len : 0))) goto LA31_;
					T33_ = dotdot___TfqUL7ztnyuRYaf9cyQBp7Asystem(indent, ((NI) 1));
					T34_ = (NimStringDesc*)0;
					T34_ = X5BX5D___a4Z6gq4Xc4C9c9cc1DxJWBTQsystem(src, T33_);
					result = resizeString(result, (T34_ ? T34_->Sup.len : 0) + 0);
appendString(result, T34_);
					lastNonemptyPos = (result ? result->Sup.len : 0);
				}
				goto LA26_;
				LA31_: ;
				LA26_: ;
				res += ((NI) 1);
			} LA12: ;
		}
	} LA10: ;
	result = setLengthStr(result, ((NI) (lastNonemptyPos)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, renderNimCode__iKaVLSux2ljcS3wu8Q8ylw)(NimStringDesc** result, NimStringDesc* code, NIM_BOOL isLatex) {
	tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA toknizr;
	NimStringDesc* buf;
	nimZeroMem((void*)(&toknizr), sizeof(tyObject_GeneralTokenizer__XJrmQSLLjVmugZQb54lVWA));
	toknizr.Sup.m_type = (&NTI__XJrmQSLLjVmugZQb54lVWA_);
	initGeneralTokenizer__mu4EAfPX69bUQs62cfYLXRA((&toknizr), code);
	buf = ((NimStringDesc*) NIM_NIL);
	{
		while (1) {
			getNextToken__9axtJQpZ5U9aGuyq519c9axprw((&toknizr), ((tyEnum_SourceLanguage__LpbEPkKqvJ0VCa4hwZcOBQ) 1));
			switch (toknizr.kind) {
			case ((tyEnum_TokenClass__UcAPDGzMlzghdb9c8MB7mEw) 0):
			{
				goto LA1;
			}
			break;
			default:
			{
				NI T5_;
				NimStringDesc* T6_;
				NimStringDesc* classX60gensym27_;
				buf = setLengthStr(buf, ((NI) 0));
				T5_ = (NI)0;
				T5_ = toknizr.start;
				T6_ = (NimStringDesc*)0;
				T6_ = substr__2yh9cer0ymNRHlOOg8P7IuA(code, T5_, (NI)((NI)(toknizr.length + toknizr.start) - ((NI) 1)));
				addEscaped__6C2AvGe9brWF3cZheLyMXgA((&buf), T6_);
				classX60gensym27_ = copyString(tokenClassToStr__XoxGqeDe9c9bun9b5PoCUnzlg[(toknizr.kind)- 0]);
				{
					tyArray__Re75IspeoxXy2oCZHwcRrA T11_;
					if (!isLatex) goto LA9_;
					nimZeroMem((void*)T11_, sizeof(tyArray__Re75IspeoxXy2oCZHwcRrA));
					T11_[0] = copyString(classX60gensym27_);
					T11_[1] = copyString(buf);
					nsuAddf(result, ((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_6), T11_, 2);
				}
				goto LA7_;
				LA9_: ;
				{
					tyArray__Re75IspeoxXy2oCZHwcRrA T13_;
					nimZeroMem((void*)T13_, sizeof(tyArray__Re75IspeoxXy2oCZHwcRrA));
					T13_[0] = copyString(classX60gensym27_);
					T13_[1] = copyString(buf);
					nsuAddf(result, ((NimStringDesc*) &TM__9bwZ0lZ4vtVZHDwmqgGHGOQ_7), T13_, 2);
				}
				LA7_: ;
			}
			break;
			}
		}
	} LA1: ;
}
