/* 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 tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw;
typedef struct tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ tyObject_TType__v9ae2Dpu13OW2ZJ2U9bNMd9cQ;
typedef struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w;
typedef struct tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA tyObject_TIdent__GufRQq9c0miSybX3zBD4tyA;
typedef struct tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ tySequence__ehmV9bTklH2Gt9cXHV9c0HLeQ;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q;

/* section: NIM_merge_TYPES */
typedef NU8 tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyObject_TLineInfo__WGx4rAexNXnczy1Avn646Q {
NU16 line;
NI16 col;
NI32 fileIndex;
};
typedef NU32 tySet_tyEnum_TNodeFlag__jyh9acXHkhZANSSvPIY7ZLg;
typedef NU8 tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
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;
};
typedef NU8 tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
typedef tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* tyArray__cypz0nHJsd9cnKgpO7fP5hQ[1];
struct tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q {
NI64 seconds;
NI nanosecond;
};

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

/* section: NIM_merge_PROC_HEADERS */
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
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(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, newTree__FpOm4fidh9bWdkMa1BMRJkQ)(tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw** children, NI childrenLen_0);
N_LIB_PRIVATE N_NIMCALL(void, add__P8dDSotTW25BkfbyspojGg)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* father, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* son);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__N0ltfTCE2Mj4nr8HqFbJ9cQ)(NimStringDesc* a);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, newStrNode__zLcHGdlEbBYFtoCoan9agkg)(tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind, NimStringDesc* strVal);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__KZ9a9bTgdOw1aWV8EscFxiGA)(NI a);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, newIntNode__zcNs9blLGYB6i9aGKob9bpzRw)(tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind, NI64 intVal);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, newNode__PMZ27S9ai4FB3gXOMDXvwsQ)(tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw kind);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__lzHzqNvA37Tzt69cUn2gqoA)(NI64 a);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__lPsOmqLsRkODU2dv9bS7i4Q)(NI a);

/* section: NIM_merge_DATA */
STRING_LITERAL(TM__Cx3HKQVn9adIHIP3IGqzKvw_2, "seconds", 7);
STRING_LITERAL(TM__Cx3HKQVn9adIHIP3IGqzKvw_3, "nanosecond", 10);

/* section: NIM_merge_VARS */
extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;

/* section: NIM_merge_PROCS */
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(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
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;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	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);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA, fromLit__e9bUTNbnzAFOnIlmlr8pdHQ)(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* a) {
	tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA));
	nimZeroMem((void*)(&result), sizeof(tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA));
	{
		tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* ai;
		ai = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
		{
			NI i;
			NI colontmp_;
			NI i_2;
			i = (NI)0;
			colontmp_ = (NI)0;
			colontmp_ = safeLen__P89cqdlERShb9alU3iC0yj8w_2ast(a);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			i_2 = ((NI) 0);
			{
				while (1) {
					if (!(i_2 < colontmp_)) goto LA4;
					i = i_2;
					ai = (*a)._kind_6.sons->data[i];
					result |= ((NU8)1)<<((((tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA) ((*ai)._kind_1.intVal))) & 7);
					i_2 += ((NI) 1);
				} LA4: ;
			}
		}
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__N0ltfTCE2Mj4nr8HqFbJ9cQ)(NimStringDesc* a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	result = newStrNode__zLcHGdlEbBYFtoCoan9agkg(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 20), a);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__KZ9a9bTgdOw1aWV8EscFxiGA)(NI a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	result = newIntNode__zcNs9blLGYB6i9aGKob9bpzRw(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 6), ((NI64) (a)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__DMaoEIGAr8AMJz2e1gXYjA)(tyTuple__XOVT24GHXwqiEj5GCsEGCA a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
	tyArray__cypz0nHJsd9cnKgpO7fP5hQ T1_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T2_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T3_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	nimZeroMem((void*)T1_, sizeof(tyArray__cypz0nHJsd9cnKgpO7fP5hQ));
	result = newTree__FpOm4fidh9bWdkMa1BMRJkQ(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 160), T1_, 0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T2_ = toLit__N0ltfTCE2Mj4nr8HqFbJ9cQ(a.Field0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(result, T2_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T3_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T3_ = toLit__KZ9a9bTgdOw1aWV8EscFxiGA(a.Field1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(result, T3_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__lzHzqNvA37Tzt69cUn2gqoA)(NI64 a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	result = newIntNode__zcNs9blLGYB6i9aGKob9bpzRw(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 6), ((NI64) (a)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__lPsOmqLsRkODU2dv9bS7i4Q)(NI a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	result = newIntNode__zcNs9blLGYB6i9aGKob9bpzRw(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 6), ((NI64) (a)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, toLit__LV9bmSfqNNIbUGH8kJv4pMw)(tyObject_Time__3y2ZpqsTJLqdZvpC9a0rU2Q a) {
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* result;
	tyArray__cypz0nHJsd9cnKgpO7fP5hQ T1_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T2_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* reti;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T3_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T4_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* reti_2;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T5_;
	tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* T6_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	nimZeroMem((void*)T1_, sizeof(tyArray__cypz0nHJsd9cnKgpO7fP5hQ));
	result = newTree__FpOm4fidh9bWdkMa1BMRJkQ(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 38), T1_, 0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T2_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T2_ = newNode__PMZ27S9ai4FB3gXOMDXvwsQ(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(result, T2_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	reti = newNode__PMZ27S9ai4FB3gXOMDXvwsQ(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 34));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T3_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T3_ = toLit__N0ltfTCE2Mj4nr8HqFbJ9cQ(((NimStringDesc*) &TM__Cx3HKQVn9adIHIP3IGqzKvw_2));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(reti, T3_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T4_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T4_ = toLit__lzHzqNvA37Tzt69cUn2gqoA(a.seconds);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(reti, T4_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(result, reti);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	reti_2 = newNode__PMZ27S9ai4FB3gXOMDXvwsQ(((tyEnum_TNodeKind__G4E4Gxe7oI2Cm03rkiOzQw) 34));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T5_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T5_ = toLit__N0ltfTCE2Mj4nr8HqFbJ9cQ(((NimStringDesc*) &TM__Cx3HKQVn9adIHIP3IGqzKvw_3));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(reti_2, T5_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T6_ = (tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*)0;
	T6_ = toLit__lPsOmqLsRkODU2dv9bS7i4Q(a.nanosecond);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(reti_2, T6_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	add__P8dDSotTW25BkfbyspojGg(result, reti_2);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
