/* 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_TContext__C9bB2okDBl3OKGUBiY5k5Ug tyObject_TContext__C9bB2okDBl3OKGUBiY5k5Ug;
typedef struct tyObject_IdentCachecolonObjectType___TzLHS09bRH9a0TYLs39cqcNaw tyObject_IdentCachecolonObjectType___TzLHS09bRH9a0TYLs39cqcNaw;
typedef struct tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w;
typedef struct tyTuple__POdQNEM9bqRXZxVjuyaP2MQ tyTuple__POdQNEM9bqRXZxVjuyaP2MQ;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;

/* section: NIM_merge_TYPES */
typedef N_NIMCALL_PTR(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, tyProc__RcJNn9bSvWdJgUmA1O6sbHA) (tyObject_TContext__C9bB2okDBl3OKGUBiY5k5Ug* c, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct tyTuple__POdQNEM9bqRXZxVjuyaP2MQ {
NimStringDesc* Field0;
NimStringDesc* Field1;
NimStringDesc* Field2;
tyProc__RcJNn9bSvWdJgUmA1O6sbHA Field3;
};
typedef tyTuple__POdQNEM9bqRXZxVjuyaP2MQ tyArray__hieh1IEVE9bl3WbZwL0hYdA[2];

/* 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);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, iterToProcImpl__btx5NTZO5L9a6BLvqVh3UTw)(tyObject_TContext__C9bB2okDBl3OKGUBiY5k5Ug* c, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw*, semLocals__UZKPH7X5GcC9bXeyF6OaeNg)(tyObject_TContext__C9bB2okDBl3OKGUBiY5k5Ug* c, tyObject_TNode__bROa11lyF5vxEN9aYNbHmhw* n);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, pluginMatches__J9a0UG4F39czom3NeeNDFTow)(tyObject_IdentCachecolonObjectType___TzLHS09bRH9a0TYLs39cqcNaw* ic, tyTuple__POdQNEM9bqRXZxVjuyaP2MQ* p, tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w* s);

/* section: NIM_merge_DATA */
STRING_LITERAL(TM__iLzrQjTMtHjOSlNDU8lfsw_2, "stdlib", 6);
STRING_LITERAL(TM__iLzrQjTMtHjOSlNDU8lfsw_3, "system", 6);
STRING_LITERAL(TM__iLzrQjTMtHjOSlNDU8lfsw_4, "iterToProc", 10);
STRING_LITERAL(TM__iLzrQjTMtHjOSlNDU8lfsw_5, "locals", 6);
N_LIB_PRIVATE NIM_CONST tyArray__hieh1IEVE9bl3WbZwL0hYdA plugins__6px53mvNYhxS9cwAd6iLcwg = {{((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_2),
((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_3),
((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_4),
iterToProcImpl__btx5NTZO5L9a6BLvqVh3UTw}
,
{((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_2),
((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_3),
((NimStringDesc*) &TM__iLzrQjTMtHjOSlNDU8lfsw_5),
semLocals__UZKPH7X5GcC9bXeyF6OaeNg}
}
;

/* 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_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyProc__RcJNn9bSvWdJgUmA1O6sbHA, getPlugin__CPe4POy5nrj1aG8wD32ycw)(tyObject_IdentCachecolonObjectType___TzLHS09bRH9a0TYLs39cqcNaw* ic, tyObject_TSym__JpsEh5i1AcKChGYbg7aV4w* fn) {
	tyProc__RcJNn9bSvWdJgUmA1O6sbHA result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyProc__RcJNn9bSvWdJgUmA1O6sbHA)0;
	{
		tyTuple__POdQNEM9bqRXZxVjuyaP2MQ p;
		NI i;
		nimZeroMem((void*)(&p), sizeof(tyTuple__POdQNEM9bqRXZxVjuyaP2MQ));
		i = ((NI) 0);
		{
			if (!(((NI) (i)) <= ((NI) 1))) goto LA4_;
			{
				while (1) {
					p.Field0 = copyString(plugins__6px53mvNYhxS9cwAd6iLcwg[(i)- 0].Field0);
					p.Field1 = copyString(plugins__6px53mvNYhxS9cwAd6iLcwg[(i)- 0].Field1);
					p.Field2 = copyString(plugins__6px53mvNYhxS9cwAd6iLcwg[(i)- 0].Field2);
					p.Field3 = plugins__6px53mvNYhxS9cwAd6iLcwg[(i)- 0].Field3;
					{
						NIM_BOOL T10_;
						T10_ = (NIM_BOOL)0;
						T10_ = pluginMatches__J9a0UG4F39czom3NeeNDFTow(ic, (&p), fn);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						if (!T10_) goto LA11_;
						result = p.Field3;
						goto BeforeRet_;
					}
					LA11_: ;
					{
						if (!(((NI) 1) <= ((NI) (i)))) goto LA15_;
						goto LA6;
					}
					LA15_: ;
					i += ((NI) 1);
				}
			} LA6: ;
		}
		LA4_: ;
	}
	result = NIM_NIL;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
