/* Generated by Nim Compiler v2.2.10 */
/* Compiled for: MacOSX, arm64, clang */
/* Command for C compiler:
   clang -c  -w -ferror-limit=3 -fno-strict-aliasing -pthread -isysroot /Applications/Xcode_16.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -target arm64-apple-darwin24.2.0 -O3   -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/lib -I/Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/src -o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@plexbase.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@plexbase.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.h>
#include <math.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
typedef struct tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw;
typedef struct tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ;
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct TNimTypeV2 {
	void* destructor;
	NI size;
	NI16 align;
	NI16 depth;
	NU32* display;
	void* traceImpl;
	void* typeInfoV1;
	NI flags;
	void* vTable[SEQ_DECL_SIZE];
};
struct RootObj {
	TNimTypeV2* m_type;
};
struct tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw {
	RootObj Sup;
	NI bufpos;
	NimStringV2 buf;
	tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* input;
	NI lineNumber;
	NI sentinel;
	NI lineStart;
	NI offsetBase;
	tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars;
};
struct tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ {
	NI a;
	NI b;
};
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u95)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___pureZstreams_u789)(tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ** dest_p0, tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* src_p1, NIM_BOOL cyclic_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2760)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_u16)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
static N_INLINE(void, moveMem__system_u1759)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(NI, readDataStr__pureZstreams_u84)(tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* s_p0, NimStringV2* buffer_p1, tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ slice_p2);
static N_INLINE(tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ, dotdot___stdZstrbasics_u48)(NI a_p0, NI b_p1);
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_u2493)(NimStringV2* s_p0);
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2);
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0);
static N_INLINE(NF, abs__system_u5188)(NF x_p0);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_u132)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0);
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_u78)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, NI pos_p1);
N_LIB_PRIVATE N_NIMCALL(void, close__pureZstreams_u57)(tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* s_p0);
static const struct {
  NI cap; NIM_CHAR data[33+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_2 = { 33 | NIM_STRLIT_FLAG, "lexbase.nim(140, 9) `bufLen > 0` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_3 = {33, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_2};
static const struct {
  NI cap; NIM_CHAR data[35+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_4 = { 35 | NIM_STRLIT_FLAG, "lexbase.nim(141, 9) `input != nil` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_5 = {35, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_4};
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_8 = { 49 | NIM_STRLIT_FLAG, "lexbase.nim(54, 9) `L.sentinel + 1 <= L.buf.len` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_9 = {49, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_8};
static const struct {
  NI cap; NIM_CHAR data[33+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_12 = { 33 | NIM_STRLIT_FLAG, "lexbase.nim(56, 9) `toCopy >= 0` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_13 = {33, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_12};
static const struct {
  NI cap; NIM_CHAR data[36+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_21 = { 36 | NIM_STRLIT_FLAG, "lexbase.nim(78, 13) `s < L.buf.len` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_22 = {36, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_21};
static const struct {
  NI cap; NIM_CHAR data[41+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_31 = { 41 | NIM_STRLIT_FLAG, "lexbase.nim(110, 9) `L.buf[pos] == \'\\r\'` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_32 = {41, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_31};
static const struct {
  NI cap; NIM_CHAR data[39+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_34 = { 39 | NIM_STRLIT_FLAG, "lexbase.nim(97, 9) `pos <= L.sentinel` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_35 = {39, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_34};
static const struct {
  NI cap; NIM_CHAR data[41+1];
} TM__k6p5NxDJat9aTyZxfZjCDJQ_38 = { 41 | NIM_STRLIT_FLAG, "lexbase.nim(121, 9) `L.buf[pos] == \'\\n\'` " };
static const NimStringV2 TM__k6p5NxDJat9aTyZxfZjCDJQ_39 = {41, (NimStrPayload*)&TM__k6p5NxDJat9aTyZxfZjCDJQ_38};
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) - (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ (NI)((NU64) ~(b_p1))));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) + (NU64)(((NU) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (((NI)0) <= (NI)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (((NI)0) <= (NI)(r_1 ^ b_p1));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
static N_INLINE(void, moveMem__system_u1759)(void* dest_p0, void* source_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memmove(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ, dotdot___stdZstrbasics_u48)(NI a_p0, NI b_p1) {
	tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ result;
	result.a = a_p0;
	result.b = b_p1;
	return result;
}
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = !(((*s_p0).p == ((NimStrPayload*) NIM_NIL)));
		if (!(T3_)) goto LA4_;
		T3_ = ((NI)((*(*s_p0).p).cap & ((NI)IL64(4611686018427387904))) == ((NI)IL64(4611686018427387904)));
LA4_: ;
		if (!T3_) goto LA5_;
		nimPrepareStrMutationImpl__system_u2493(s_p0);
	}
LA5_: ;
}
static N_INLINE(NF, toFloat__system_u1705)(NI i_p0) {
	NF result;
	result = ((NF) (i_p0));
	return result;
}
static N_INLINE(NF, abs__system_u5188)(NF x_p0) {
	NF result;
	result = (NF)0;
	result = fabs(x_p0);
	return result;
}
static N_INLINE(NIM_BOOL, nimMulInt)(NI a_p0, NI b_p1, NI* res_p2) {
	NIM_BOOL result;
	NI r_1;
	NF floatProd_1;
	NF T1_;
	NF T2_;
	NF resAsFloat_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI) ((NU)((NU64)(((NU) (a_p0))) * (NU64)(((NU) (b_p1))))));
	T1_ = (NF)0;
	T1_ = toFloat__system_u1705(a_p0);
	T2_ = (NF)0;
	T2_ = toFloat__system_u1705(b_p1);
	floatProd_1 = ((NF)(T1_) * (NF)(T2_));
	resAsFloat_1 = toFloat__system_u1705(r_1);
	{
		if (!(resAsFloat_1 == floatProd_1)) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA3_;
LA5_: ;
	{
		{
			NF T10_;
			NF T11_;
			T10_ = (NF)0;
			T10_ = abs__system_u5188(((NF)(resAsFloat_1) - (NF)(floatProd_1)));
			T11_ = (NF)0;
			T11_ = abs__system_u5188(floatProd_1);
			if (!(((NF)(32.0) * (NF)(T10_)) <= T11_)) goto LA12_;
			(*res_p2) = r_1;
		}
		goto LA8_;
LA12_: ;
		{
			result = NIM_TRUE;
		}
LA8_: ;
	}
LA3_: ;
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_u16)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0) {
	NI charsRead_1;
	NI toCopy_1;
	NI s_1;
	NI oldBufLen_1;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_10;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_11;
	tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* T14_;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_15;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_16;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_17;
	tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ T15_;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_18;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	charsRead_1 = (NI)0;
	toCopy_1 = (NI)0;
	s_1 = (NI)0;
	oldBufLen_1 = (NI)0;
	{
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_7;
		if (nimAddInt((*L_p0).sentinel, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_7)) { raiseOverflow(); goto BeforeRet_;
		};
		if (!!(((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_7) <= (*L_p0).buf.len))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_9);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	if (nimAddInt((*L_p0).sentinel, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_10)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimSubInt((*L_p0).buf.len, (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_10), &TM__k6p5NxDJat9aTyZxfZjCDJQ_11)) { raiseOverflow(); goto BeforeRet_;
	};
	toCopy_1 = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_11);
	{
		if (!!((((NI)0) <= toCopy_1))) goto LA7_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_13);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	{
		void* T13_;
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_14;
		if (!(((NI)0) < toCopy_1)) goto LA11_;
		if (((NI)0) < 0 || ((NI)0) >= (*L_p0).buf.len){ raiseIndexError2(((NI)0),(*L_p0).buf.len-1); goto BeforeRet_;
		}
		T13_ = (void*)0;
		T13_ = ((void*) ((&(*L_p0).buf.p->data[((NI)0)])));
		if (nimAddInt((*L_p0).sentinel, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_14)) { raiseOverflow(); goto BeforeRet_;
		};
		if ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_14) < 0 || (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_14) >= (*L_p0).buf.len){ raiseIndexError2((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_14),(*L_p0).buf.len-1); goto BeforeRet_;
		}
		if ((toCopy_1) < ((NI)0) || (toCopy_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(toCopy_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
		}
		moveMem__system_u1759(T13_, ((void*) ((&(*L_p0).buf.p->data[(NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_14)]))), (toCopy_1));
	}
LA11_: ;
	T14_ = NIM_NIL;
	T14_ = (*L_p0).input;
	if (nimAddInt(toCopy_1, (*L_p0).sentinel, &TM__k6p5NxDJat9aTyZxfZjCDJQ_15)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimAddInt((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_15), ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_16)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimSubInt((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_16), ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_17)) { raiseOverflow(); goto BeforeRet_;
	};
	T15_ = dotdot___stdZstrbasics_u48(toCopy_1, (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_17));
	charsRead_1 = readDataStr__pureZstreams_u84(T14_, (&(*L_p0).buf), T15_);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	if (nimAddInt(toCopy_1, charsRead_1, &TM__k6p5NxDJat9aTyZxfZjCDJQ_18)) { raiseOverflow(); goto BeforeRet_;
	};
	s_1 = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_18);
	{
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_19;
		if (nimAddInt((*L_p0).sentinel, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_19)) { raiseOverflow(); goto BeforeRet_;
		};
		if (!(charsRead_1 < (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_19))) goto LA18_;
		if (s_1 < 0 || s_1 >= (*L_p0).buf.len){ raiseIndexError2(s_1,(*L_p0).buf.len-1); goto BeforeRet_;
		}
		nimPrepareStrMutationV2((&(*L_p0).buf));
		(*L_p0).buf.p->data[s_1] = 0;
		(*L_p0).sentinel = s_1;
	}
	goto LA16_;
LA18_: ;
	{
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_20;
		if (nimSubInt(s_1, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_20)) { raiseOverflow(); goto BeforeRet_;
		};
		s_1 = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_20);
		{
			while (1) {
				{
					if (!!((s_1 < (*L_p0).buf.len))) goto LA25_;
					failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_22);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA25_: ;
				{
					while (1) {
						NIM_BOOL T29_;
						NI TM__k6p5NxDJat9aTyZxfZjCDJQ_23;
						T29_ = (NIM_BOOL)0;
						T29_ = (((NI)0) <= s_1);
						if (!(T29_)) goto LA30_;
						if (s_1 < 0 || s_1 >= (*L_p0).buf.len){ raiseIndexError2(s_1,(*L_p0).buf.len-1); goto BeforeRet_;
						}
						T29_ = !((((*L_p0).refillChars[(NU)((((NU8)((*L_p0).buf.p->data[s_1]))))>>3] &(1U<<((NU)((((NU8)((*L_p0).buf.p->data[s_1]))))&7U)))!=0));
LA30_: ;
						if (!T29_) goto LA28;
						if (nimSubInt(s_1, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_23)) { raiseOverflow(); goto BeforeRet_;
						};
						s_1 = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_23);
					} LA28: ;
				}
				{
					if (!(((NI)0) <= s_1)) goto LA33_;
					(*L_p0).sentinel = s_1;
					goto LA21;
				}
				goto LA31_;
LA33_: ;
				{
					NI TM__k6p5NxDJat9aTyZxfZjCDJQ_24;
					tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* T36_;
					NI TM__k6p5NxDJat9aTyZxfZjCDJQ_25;
					tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ T37_;
					NI TM__k6p5NxDJat9aTyZxfZjCDJQ_28;
					oldBufLen_1 = (*L_p0).buf.len;
					if (nimMulInt((*L_p0).buf.len, ((NI)2), &TM__k6p5NxDJat9aTyZxfZjCDJQ_24)) { raiseOverflow(); goto BeforeRet_;
					};
					if (((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_24)) < ((NI)0) || ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_24)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_24), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
					}
					setLengthStrV2((&(*L_p0).buf), ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_24)));
					T36_ = NIM_NIL;
					T36_ = (*L_p0).input;
					if (nimSubInt((*L_p0).buf.len, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_25)) { raiseOverflow(); goto BeforeRet_;
					};
					T37_ = dotdot___stdZstrbasics_u48(oldBufLen_1, (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_25));
					charsRead_1 = readDataStr__pureZstreams_u84(T36_, (&(*L_p0).buf), T37_);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						NI TM__k6p5NxDJat9aTyZxfZjCDJQ_26;
						NI TM__k6p5NxDJat9aTyZxfZjCDJQ_27;
						if (!(charsRead_1 < oldBufLen_1)) goto LA40_;
						if (nimAddInt(oldBufLen_1, charsRead_1, &TM__k6p5NxDJat9aTyZxfZjCDJQ_26)) { raiseOverflow(); goto BeforeRet_;
						};
						if ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_26) < 0 || (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_26) >= (*L_p0).buf.len){ raiseIndexError2((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_26),(*L_p0).buf.len-1); goto BeforeRet_;
						}
						nimPrepareStrMutationV2((&(*L_p0).buf));
						(*L_p0).buf.p->data[(NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_26)] = 0;
						if (nimAddInt(oldBufLen_1, charsRead_1, &TM__k6p5NxDJat9aTyZxfZjCDJQ_27)) { raiseOverflow(); goto BeforeRet_;
						};
						(*L_p0).sentinel = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_27);
						goto LA21;
					}
LA40_: ;
					if (nimSubInt((*L_p0).buf.len, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_28)) { raiseOverflow(); goto BeforeRet_;
					};
					s_1 = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_28);
				}
LA31_: ;
			}
		} LA21: ;
	}
LA16_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_u132)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0) {
{	{
		NIM_BOOL T3_;
		NIM_BOOL T4_;
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_29;
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_30;
		T3_ = (NIM_BOOL)0;
		T4_ = (NIM_BOOL)0;
		if (((NI)0) < 0 || ((NI)0) >= (*L_p0).buf.len){ raiseIndexError2(((NI)0),(*L_p0).buf.len-1); goto BeforeRet_;
		}
		T4_ = ((NU8)((*L_p0).buf.p->data[((NI)0)]) == (NU8)(239));
		if (!(T4_)) goto LA5_;
		if (((NI)1) < 0 || ((NI)1) >= (*L_p0).buf.len){ raiseIndexError2(((NI)1),(*L_p0).buf.len-1); goto BeforeRet_;
		}
		T4_ = ((NU8)((*L_p0).buf.p->data[((NI)1)]) == (NU8)(187));
LA5_: ;
		T3_ = T4_;
		if (!(T3_)) goto LA6_;
		if (((NI)2) < 0 || ((NI)2) >= (*L_p0).buf.len){ raiseIndexError2(((NI)2),(*L_p0).buf.len-1); goto BeforeRet_;
		}
		T3_ = ((NU8)((*L_p0).buf.p->data[((NI)2)]) == (NU8)(191));
LA6_: ;
		if (!T3_) goto LA7_;
		if (nimAddInt((*L_p0).bufpos, ((NI)3), &TM__k6p5NxDJat9aTyZxfZjCDJQ_29)) { raiseOverflow(); goto BeforeRet_;
		};
		(*L_p0).bufpos = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_29);
		if (nimAddInt((*L_p0).lineStart, ((NI)3), &TM__k6p5NxDJat9aTyZxfZjCDJQ_30)) { raiseOverflow(); goto BeforeRet_;
		};
		(*L_p0).lineStart = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_30);
	}
LA7_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, open__pureZlexbase_u144)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ* input_p1, NI bufLen_p2, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars_p3) {
	NimStringV2 T9_;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_6;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		if (!!((((NI)0) < bufLen_p2))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_3);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	{
		if (!!(!((input_p1 == ((tyObject_StreamObj__bsqueMN9aCOGm2aNaHkuxoQ*) NIM_NIL))))) goto LA7_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_5);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	eqcopy___pureZstreams_u789(&(*L_p0).input, input_p1, NIM_TRUE);
	(*L_p0).bufpos = ((NI)0);
	(*L_p0).offsetBase = ((NI)0);
	nimCopyMem((void*)(*L_p0).refillChars, (NIM_CONST void*)refillChars_p3, 32);
	if ((bufLen_p2) < ((NI)0) || (bufLen_p2) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(bufLen_p2, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	T9_.len = 0; T9_.p = NIM_NIL;
	T9_ = mnewString((bufLen_p2));
	eqsink___system_u2760((&(*L_p0).buf), T9_);
	if (nimSubInt(bufLen_p2, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_6)) { raiseOverflow(); goto BeforeRet_;
	};
	(*L_p0).sentinel = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_6);
	(*L_p0).lineStart = ((NI)0);
	(*L_p0).lineNumber = ((NI)1);
	fillBuffer__pureZlexbase_u16(L_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	skipUtf8Bom__pureZlexbase_u132(L_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_u78)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, NI pos_p1) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!!((pos_p1 <= (*L_p0).sentinel))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_35);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	{
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_36;
		if (!(pos_p1 < (*L_p0).sentinel)) goto LA7_;
		if (nimAddInt(pos_p1, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_36)) { raiseOverflow(); goto BeforeRet_;
		};
		result = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_36);
	}
	goto LA5_;
LA7_: ;
	{
		NI TM__k6p5NxDJat9aTyZxfZjCDJQ_37;
		fillBuffer__pureZlexbase_u16(L_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (nimAddInt((*L_p0).offsetBase, pos_p1, &TM__k6p5NxDJat9aTyZxfZjCDJQ_37)) { raiseOverflow(); goto BeforeRet_;
		};
		(*L_p0).offsetBase = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_37);
		(*L_p0).bufpos = ((NI)0);
		result = ((NI)0);
	}
LA5_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleCR__pureZlexbase_u91)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, NI pos_p1) {
	NI result;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_33;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (pos_p1 < 0 || pos_p1 >= (*L_p0).buf.len){ raiseIndexError2(pos_p1,(*L_p0).buf.len-1); goto BeforeRet_;
		}
		if (!!(((NU8)((*L_p0).buf.p->data[pos_p1]) == (NU8)(13)))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_32);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	if (nimAddInt((*L_p0).lineNumber, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_33)) { raiseOverflow(); goto BeforeRet_;
	};
	(*L_p0).lineNumber = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_33);
	result = fillBaseLexer__pureZlexbase_u78(L_p0, pos_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (result < 0 || result >= (*L_p0).buf.len){ raiseIndexError2(result,(*L_p0).buf.len-1); goto BeforeRet_;
		}
		if (!((NU8)((*L_p0).buf.p->data[result]) == (NU8)(10))) goto LA7_;
		result = fillBaseLexer__pureZlexbase_u78(L_p0, result);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	(*L_p0).lineStart = result;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleLF__pureZlexbase_u105)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, NI pos_p1) {
	NI result;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_40;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (pos_p1 < 0 || pos_p1 >= (*L_p0).buf.len){ raiseIndexError2(pos_p1,(*L_p0).buf.len-1); goto BeforeRet_;
		}
		if (!!(((NU8)((*L_p0).buf.p->data[pos_p1]) == (NU8)(10)))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__k6p5NxDJat9aTyZxfZjCDJQ_39);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	if (nimAddInt((*L_p0).lineNumber, ((NI)1), &TM__k6p5NxDJat9aTyZxfZjCDJQ_40)) { raiseOverflow(); goto BeforeRet_;
	};
	(*L_p0).lineNumber = (NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_40);
	result = fillBaseLexer__pureZlexbase_u78(L_p0, pos_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*L_p0).lineStart = result;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, getColNumber__pureZlexbase_u163)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0, NI pos_p1) {
	NI result;
	NI TM__k6p5NxDJat9aTyZxfZjCDJQ_41;
{	result = (NI)0;
	if (nimSubInt(pos_p1, (*L_p0).lineStart, &TM__k6p5NxDJat9aTyZxfZjCDJQ_41)) { raiseOverflow(); goto BeforeRet_;
	};
	if ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_41) == (IL64(-9223372036854775807) - IL64(1))){ raiseOverflow(); goto BeforeRet_;
	}
	result = ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_41) > 0? ((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_41)) : -((NI)(TM__k6p5NxDJat9aTyZxfZjCDJQ_41)));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, close__pureZlexbase_u14)(tyObject_BaseLexer__uXaqyrqvlVgJisQ4nTlfBw* L_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	close__pureZstreams_u57((*L_p0).input);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
