/* Generated by Nim Compiler v1.6.14 */
#define NIM_INTBITS 64

#include "nimbase.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
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef NU8 tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ;
typedef NU8 tyEnum_TNimKind__pspQAsqJLrw3jEKBD9bxmyQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w;
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__pspQAsqJLrw3jEKBD9bxmyQ kind;
tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw;
struct TNimNode {
tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
N_LIB_PRIVATE N_NIMCALL(NIM_CHAR, nsuToLowerAsciiChar)(NIM_CHAR c);
N_LIB_PRIVATE TNimType NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_;
N_LIB_PRIVATE N_NIMCALL(tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ, prefixMatch__prefixmatches_10)(NimStringDesc* p, NimStringDesc* s) {
	tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ result;
	NI i;
{	result = (tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ)0;
	{
		if (!((s ? s->Sup.len : 0) < (p ? p->Sup.len : 0))) goto LA3_;
		result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 0);
		goto BeforeRet_;
	}
	LA3_: ;
	i = ((NI) 0);
	{
		while (1) {
			if (!(i < (s ? s->Sup.len : 0))) goto LA6;
			{
				if (!((NU8)(s->data[i]) == (NU8)(95))) goto LA9_;
				i += ((NI) 1);
			}
			LA9_: ;
			{
				NIM_BOOL T13_;
				NIM_CHAR T15_;
				NIM_CHAR T16_;
				NI ii;
				NI jj;
				T13_ = (NIM_BOOL)0;
				T13_ = (i < (s ? s->Sup.len : 0));
				if (!(T13_)) goto LA14_;
				T15_ = (NIM_CHAR)0;
				T15_ = nsuToLowerAsciiChar(s->data[i]);
				T16_ = (NIM_CHAR)0;
				T16_ = nsuToLowerAsciiChar(p->data[((NI) 0)]);
				T13_ = ((NU8)(T15_) == (NU8)(T16_));
				LA14_: ;
				if (!T13_) goto LA17_;
				ii = (NI)(i + ((NI) 1));
				jj = ((NI) 1);
				{
					while (1) {
						NIM_BOOL T21_;
						T21_ = (NIM_BOOL)0;
						T21_ = (ii < (s ? s->Sup.len : 0));
						if (!(T21_)) goto LA22_;
						T21_ = (jj < (p ? p->Sup.len : 0));
						LA22_: ;
						if (!T21_) goto LA20;
						{
							if (!((NU8)(p->data[jj]) == (NU8)(95))) goto LA25_;
							jj += ((NI) 1);
						}
						LA25_: ;
						{
							if (!((NU8)(s->data[ii]) == (NU8)(95))) goto LA29_;
							ii += ((NI) 1);
						}
						LA29_: ;
						{
							NIM_CHAR T33_;
							NIM_CHAR T34_;
							T33_ = (NIM_CHAR)0;
							T33_ = nsuToLowerAsciiChar(s->data[ii]);
							T34_ = (NIM_CHAR)0;
							T34_ = nsuToLowerAsciiChar(p->data[jj]);
							if (!!(((NU8)(T33_) == (NU8)(T34_)))) goto LA35_;
							goto LA19;
						}
						LA35_: ;
						ii += ((NI) 1);
						jj += ((NI) 1);
					} LA20: ;
				} LA19: ;
				{
					if (!((p ? p->Sup.len : 0) <= jj)) goto LA39_;
					{
						if (!(i == ((NI) 0))) goto LA43_;
						result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 3);
						goto BeforeRet_;
					}
					goto LA41_;
					LA43_: ;
					{
						result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 2);
						goto BeforeRet_;
					}
					LA41_: ;
				}
				LA39_: ;
			}
			LA17_: ;
			i += ((NI) 1);
		} LA6: ;
	}
	{
		NIM_CHAR T48_;
		NIM_CHAR T49_;
		NI j;
		T48_ = (NIM_CHAR)0;
		T48_ = nsuToLowerAsciiChar(s->data[((NI) 0)]);
		T49_ = (NIM_CHAR)0;
		T49_ = nsuToLowerAsciiChar(p->data[((NI) 0)]);
		if (!((NU8)(T48_) == (NU8)(T49_))) goto LA50_;
		i = ((NI) 1);
		j = ((NI) 1);
		{
			while (1) {
				if (!(i < (s ? s->Sup.len : 0))) goto LA53;
				{
					NIM_BOOL T56_;
					T56_ = (NIM_BOOL)0;
					T56_ = (i < (NI)((s ? s->Sup.len : 0) - ((NI) 1)));
					if (!(T56_)) goto LA57_;
					T56_ = ((NU8)(s->data[i]) == (NU8)(95));
					LA57_: ;
					if (!T56_) goto LA58_;
					{
						NIM_BOOL T62_;
						NIM_CHAR T64_;
						NIM_CHAR T65_;
						T62_ = (NIM_BOOL)0;
						T62_ = (j < (p ? p->Sup.len : 0));
						if (!(T62_)) goto LA63_;
						T64_ = (NIM_CHAR)0;
						T64_ = nsuToLowerAsciiChar(p->data[j]);
						T65_ = (NIM_CHAR)0;
						T65_ = nsuToLowerAsciiChar(s->data[(NI)(i + ((NI) 1))]);
						T62_ = ((NU8)(T64_) == (NU8)(T65_));
						LA63_: ;
						if (!T62_) goto LA66_;
						j += ((NI) 1);
					}
					goto LA60_;
					LA66_: ;
					{
						result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 0);
						goto BeforeRet_;
					}
					LA60_: ;
				}
				LA58_: ;
				{
					NIM_BOOL T71_;
					NIM_BOOL T72_;
					T71_ = (NIM_BOOL)0;
					T72_ = (NIM_BOOL)0;
					T72_ = (i < (s ? s->Sup.len : 0));
					if (!(T72_)) goto LA73_;
					T72_ = (((NU8)(s->data[i])) >= ((NU8)(65)) && ((NU8)(s->data[i])) <= ((NU8)(90)));
					LA73_: ;
					T71_ = T72_;
					if (!(T71_)) goto LA74_;
					T71_ = !((((NU8)(s->data[(NI)(i - ((NI) 1))])) >= ((NU8)(65)) && ((NU8)(s->data[(NI)(i - ((NI) 1))])) <= ((NU8)(90))));
					LA74_: ;
					if (!T71_) goto LA75_;
					{
						NIM_BOOL T79_;
						NIM_CHAR T81_;
						NIM_CHAR T82_;
						T79_ = (NIM_BOOL)0;
						T79_ = (j < (p ? p->Sup.len : 0));
						if (!(T79_)) goto LA80_;
						T81_ = (NIM_CHAR)0;
						T81_ = nsuToLowerAsciiChar(p->data[j]);
						T82_ = (NIM_CHAR)0;
						T82_ = nsuToLowerAsciiChar(s->data[i]);
						T79_ = ((NU8)(T81_) == (NU8)(T82_));
						LA80_: ;
						if (!T79_) goto LA83_;
						j += ((NI) 1);
					}
					goto LA77_;
					LA83_: ;
					{
						result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 0);
						goto BeforeRet_;
					}
					LA77_: ;
				}
				LA75_: ;
				i += ((NI) 1);
			} LA53: ;
		}
		{
			if (!((p ? p->Sup.len : 0) <= j)) goto LA88_;
			result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 1);
			goto BeforeRet_;
		}
		goto LA86_;
		LA88_: ;
		{
			result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 0);
			goto BeforeRet_;
		}
		LA86_: ;
	}
	LA50_: ;
	result = ((tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ) 0);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, atmprefixmatchesdotnim_DatInit000)(void) {
static TNimNode* TM__xyuxIF9aCxFKzZet1F6nhpA_2_4[4];
NI TM__xyuxIF9aCxFKzZet1F6nhpA_4;
static char* NIM_CONST TM__xyuxIF9aCxFKzZet1F6nhpA_3[4] = {
"None", 
"Abbrev", 
"Substr", 
"Prefix"};
static TNimNode TM__xyuxIF9aCxFKzZet1F6nhpA_0[5];
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.size = sizeof(tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ);
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.align = NIM_ALIGNOF(tyEnum_PrefixMatch__Y9cGLq2K6rNefjjqfIC9bauQ);
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.kind = 14;
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.base = 0;
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.flags = 3;
for (TM__xyuxIF9aCxFKzZet1F6nhpA_4 = 0; TM__xyuxIF9aCxFKzZet1F6nhpA_4 < 4; TM__xyuxIF9aCxFKzZet1F6nhpA_4++) {
TM__xyuxIF9aCxFKzZet1F6nhpA_0[TM__xyuxIF9aCxFKzZet1F6nhpA_4+0].kind = 1;
TM__xyuxIF9aCxFKzZet1F6nhpA_0[TM__xyuxIF9aCxFKzZet1F6nhpA_4+0].offset = TM__xyuxIF9aCxFKzZet1F6nhpA_4;
TM__xyuxIF9aCxFKzZet1F6nhpA_0[TM__xyuxIF9aCxFKzZet1F6nhpA_4+0].name = TM__xyuxIF9aCxFKzZet1F6nhpA_3[TM__xyuxIF9aCxFKzZet1F6nhpA_4];
TM__xyuxIF9aCxFKzZet1F6nhpA_2_4[TM__xyuxIF9aCxFKzZet1F6nhpA_4] = &TM__xyuxIF9aCxFKzZet1F6nhpA_0[TM__xyuxIF9aCxFKzZet1F6nhpA_4+0];
}
TM__xyuxIF9aCxFKzZet1F6nhpA_0[4].len = 4; TM__xyuxIF9aCxFKzZet1F6nhpA_0[4].kind = 2; TM__xyuxIF9aCxFKzZet1F6nhpA_0[4].sons = &TM__xyuxIF9aCxFKzZet1F6nhpA_2_4[0];
NTIprefixmatch__Y9cGLq2K6rNefjjqfIC9bauQ_.node = &TM__xyuxIF9aCxFKzZet1F6nhpA_0[4];
}

