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

/* 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 tyTuple__nlLlqVveYUlcdyx2e2bPTw tyTuple__nlLlqVveYUlcdyx2e2bPTw;
typedef struct tyTuple__9cqHuynYNPU9avbszh3XtBAg tyTuple__9cqHuynYNPU9avbszh3XtBAg;

/* section: NIM_merge_TYPES */
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw;
struct tyTuple__nlLlqVveYUlcdyx2e2bPTw {
NimStringDesc* Field0;
tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw Field1;
NimStringDesc* Field2;
NimStringDesc* Field3;
NimStringDesc* Field4;
NI Field5;
};
typedef NU8 tyEnum_TTypeKind__9a3YiReNVD0IJHWFKgXRe9ag;
struct tyTuple__9cqHuynYNPU9avbszh3XtBAg {
NimStringDesc* Field0;
tyEnum_TTypeKind__9a3YiReNVD0IJHWFKgXRe9ag Field1;
};

/* section: NIM_merge_PROC_HEADERS */
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
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);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted__45fPtFhY4FavRaYwDhRfuA)(NimStringDesc** s, NimStringDesc* x);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted__sCg9bHpRxLXpSphc63mtWdw)(NimStringDesc** s, tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw x);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted__wRMAZHpaipmaQ037ptRATQ)(NimStringDesc** s, NI x);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted__2NPdL9cn8CBwngwsy2yb9bcg)(NimStringDesc** s, tyEnum_TTypeKind__9a3YiReNVD0IJHWFKgXRe9ag x);

/* section: NIM_merge_DATA */
STRING_LITERAL(TM__n49a9aYp5BrbXv9a6OCpJYm0g_2, "(", 1);
STRING_LITERAL(TM__n49a9aYp5BrbXv9a6OCpJYm0g_3, ", ", 2);
STRING_LITERAL(TM__n49a9aYp5BrbXv9a6OCpJYm0g_4, ",", 1);
STRING_LITERAL(TM__n49a9aYp5BrbXv9a6OCpJYm0g_5, ")", 1);

/* section: NIM_merge_PROCS */
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_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___HBZb4pgGTJ0NuRxlEYFytw)(tyTuple__nlLlqVveYUlcdyx2e2bPTw* x) {
	NimStringDesc* result;
	NI count;
	result = (NimStringDesc*)0;
	result = copyString(((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_2));
	count = ((NI) 0);
	{
		if (!(((NI) 0) < count)) goto LA3_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA3_: ;
	count += ((NI) 1);
	addQuoted__45fPtFhY4FavRaYwDhRfuA((&result), (*x).Field0);
	{
		if (!(((NI) 0) < count)) goto LA7_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA7_: ;
	count += ((NI) 1);
	addQuoted__sCg9bHpRxLXpSphc63mtWdw((&result), (*x).Field1);
	{
		if (!(((NI) 0) < count)) goto LA11_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA11_: ;
	count += ((NI) 1);
	addQuoted__45fPtFhY4FavRaYwDhRfuA((&result), (*x).Field2);
	{
		if (!(((NI) 0) < count)) goto LA15_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA15_: ;
	count += ((NI) 1);
	addQuoted__45fPtFhY4FavRaYwDhRfuA((&result), (*x).Field3);
	{
		if (!(((NI) 0) < count)) goto LA19_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA19_: ;
	count += ((NI) 1);
	addQuoted__45fPtFhY4FavRaYwDhRfuA((&result), (*x).Field4);
	{
		if (!(((NI) 0) < count)) goto LA23_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA23_: ;
	count += ((NI) 1);
	addQuoted__wRMAZHpaipmaQ037ptRATQ((&result), (*x).Field5);
	{
		if (!(count == ((NI) 1))) goto LA27_;
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_4));
	}
	LA27_: ;
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_5));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___XSFzZuEhhtAqOvJ5uRr9cuA)(tyTuple__9cqHuynYNPU9avbszh3XtBAg x) {
	NimStringDesc* result;
	NI count;
	result = (NimStringDesc*)0;
	result = copyString(((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_2));
	count = ((NI) 0);
	{
		if (!(((NI) 0) < count)) goto LA3_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA3_: ;
	count += ((NI) 1);
	addQuoted__45fPtFhY4FavRaYwDhRfuA((&result), x.Field0);
	{
		if (!(((NI) 0) < count)) goto LA7_;
		result = resizeString(result, 2);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_3));
	}
	LA7_: ;
	count += ((NI) 1);
	addQuoted__2NPdL9cn8CBwngwsy2yb9bcg((&result), x.Field1);
	{
		if (!(count == ((NI) 1))) goto LA11_;
		result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_4));
	}
	LA11_: ;
	result = resizeString(result, 1);
appendString(result, ((NimStringDesc*) &TM__n49a9aYp5BrbXv9a6OCpJYm0g_5));
	return result;
}
