/* Generated by Nim Compiler v2.2.10 */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.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_TLLStream__FoDsO8lsQbcCVaLehnuOYg tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A;
typedef struct tyObject_GcEnv__HccVszwojlCZRN46BE9cG8w tyObject_GcEnv__HccVszwojlCZRN46BE9cG8w;
typedef struct tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg;
typedef struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q tyTuple__N4J9cV4JZGem3ljqqj5rT0Q;
typedef struct tyObject_CellSeq__IHvIqxITv1yMjJj8lwLrhg tyObject_CellSeq__IHvIqxITv1yMjJj8lwLrhg;
typedef struct tyTuple__DTRsWi2kgTewbhN2TT5mbA tyTuple__DTRsWi2kgTewbhN2TT5mbA;
typedef struct tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
typedef NU8 tyEnum_FileMode__YkEVJbjDa9aPvYTBr8yiUWg;
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;
};
typedef NU8 tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ;
typedef struct {
N_NIMCALL_PTR(NI, ClP_0) (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, void* buf_p1, NI bufLen_p2, void* ClE_0);
void* ClE_0;
} tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg {
	RootObj Sup;
	tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ kind;
	FILE* f;
	NimStringV2 s;
	NI rd;
	NI wr;
	NI lineOffset;
	tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ repl;
	tyProc__HzVCwACFYM9cx9aV62PdjtuA onPrompt;
};
struct tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A {
	NI rc;
	NI rootIdx;
};
struct tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg {
	NI len;
	NI cap;
	tyTuple__N4J9cV4JZGem3ljqqj5rT0Q* d;
};
struct tyObject_CellSeq__IHvIqxITv1yMjJj8lwLrhg {
	NI len;
	NI cap;
	tyTuple__DTRsWi2kgTewbhN2TT5mbA* d;
};
struct tyObject_GcEnv__HccVszwojlCZRN46BE9cG8w {
	tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg traceStack;
	tyObject_CellSeq__IHvIqxITv1yMjJj8lwLrhg toFree;
	NI freed;
	NI touched;
	NI edges;
	NI rcSum;
	NIM_BOOL keepThreshold;
};
struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q {
	void** Field0;
	TNimTypeV2* Field1;
};
typedef N_CLOSURE_PTR(void, TM__ml9aueblxGz9aYsRLKvPmpow_4) (void);
typedef N_CLOSURE_PTR(NI, TM__ml9aueblxGz9aYsRLKvPmpow_5) (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, void* buf_p1, NI bufLen_p2);
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
typedef NimStringV2 tyArray__E9cjy83smb5N4sXLGk0xt3w[22];
struct tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ {
	NI a;
	NI b;
};
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__llstream_u551)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___llstream_u57)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u805)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3533)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u2691)(NimStringV2 dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___llstream_u69)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* dest_p0, void* env_p1);
static N_INLINE(void, nimTraceRefDyn)(void* q_p0, void* env_p1);
static N_INLINE(void, add__system_u3054)(tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg* s_p0, void** c_p1, TNimTypeV2* t_p2);
N_LIB_PRIVATE N_NIMCALL(void, resize__system_u3062)(tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg* s_p0);
static N_INLINE(NI, pluspercent___system_u785)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, open__stdZsyncio_u414)(FILE** f_p0, NimStringV2 filename_p1, tyEnum_FileMode__YkEVJbjDa9aPvYTBr8yiUWg mode_p2, NI bufSize_p3);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___llstream_u123)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg** dest_p0, tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* src_p1);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimIncRefCyclic)(void* p_p0, NIM_BOOL cyclic_p1);
static N_INLINE(void, copyMem__system_u1742)(void* dest_p0, void* source_p1, NI size_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NI, readBuffer__stdZsyncio_u165)(FILE* f_p0, void* buffer_p1, NI len_p2);
N_LIB_PRIVATE N_NIMCALL(void, close__stdZsyncio_u269)(FILE* f_p0);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1);
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s_p0, NI addLen_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, readLine__stdZsyncio_u292)(FILE* f_p0, NimStringV2* line_p1);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(void, write__stdZsyncio_u254)(FILE* f_p0, NimStringV2 s_p1);
N_LIB_PRIVATE N_NIMCALL(NI, writeBuffer__stdZsyncio_u196)(FILE* f_p0, void* buffer_p1, NI len_p2);
N_LIB_PRIVATE N_NIMCALL(void, llStreamWrite__llstream_u511)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, NimStringV2 data_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqdup___llstream_u160)(tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ src_p0, NIM_BOOL cyclic_p1, tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ* Result);
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__system_u2172)(void* a_p0, int v_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(void, eqdup___llstream_u192)(tyProc__HzVCwACFYM9cx9aV62PdjtuA src_p0, NIM_BOOL cyclic_p1, tyProc__HzVCwACFYM9cx9aV62PdjtuA* Result);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2700)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_NIMCALL(NimStringV2, rawNewString)(NI cap_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, readLineFromStdin__llstream_u216)(NimStringV2 prompt_p0, NimStringV2* line_p1);
N_LIB_PRIVATE N_NIMCALL(void, flushFile__stdZsyncio_u279)(FILE* f_p0);
static N_INLINE(void, quit__system_u7992)(NI errorcode_p0);
N_LIB_PRIVATE N_NIMCALL(NI, countTriples__llstream_u428)(NimStringV2 s_p0);
static N_INLINE(NIM_BOOL, continueLine__llstream_u420)(NimStringV2 line_p0, NIM_BOOL inTripleString_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWith__llstream_u220)(NimStringV2 x_p0, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw s_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithLineContinuationToken__llstream_u331)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithIdent__llstream_u241)(NimStringV2 s_p0, NimStringV2 subs_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, eqIdent__llstream_u237)(NimStringV2 a_p0, NimStringV2 bNormalized_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nimIdentNormalize__pureZstrutils_u124)(NimStringV2 s_p0);
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a_p0, NimStringV2 b_p1);
static N_INLINE(NIM_BOOL, equalMem__system_u1750)(void* a_p0, void* b_p1, NI size_p2);
static N_INLINE(int, nimCmpMem)(void* a_p0, void* b_p1, NI size_p2);
static N_INLINE(NimStringV2, X5BX5D___llstream_u284)(NimStringV2 s_p0, tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ x_p1);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_u2430)(NimStringV2* s_p0);
static N_INLINE(tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ, dotdot___llstream_u246)(NI a_p0, NI b_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, containsObjectOf__llstream_u314)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, nsuRFindChar)(NimStringV2 s_p0, NIM_CHAR sub_p1, NI start_p2, NI last_p3);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithIdent__llstream_u304)(NimStringV2 s_p0, NimStringV2 subs_p1, NI* endIdx_p2);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, continuesWithIdent__llstream_u299)(NimStringV2 s_p0, NimStringV2 subs_p1, NI start_p2);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, substr__system_u8649)(NimStringV2 s_p0, NI first_p1, NI last_p2);
N_LIB_PRIVATE TNimTypeV2 NTIv2__FoDsO8lsQbcCVaLehnuOYg_;
static NIM_CONST tyProc__HzVCwACFYM9cx9aV62PdjtuA TM__ml9aueblxGz9aYsRLKvPmpow_3 = {NIM_NIL,NIM_NIL};
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_6 = { 1 | NIM_STRLIT_FLAG, "\012" };
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_7 = {1, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_6};
static const struct {
  NI cap; NIM_CHAR data[0+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_8 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_9 = {0, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_8};
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_10 = {0, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_8};
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_11 = {1, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_6};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_12 = { 4 | NIM_STRLIT_FLAG, ">>> " };
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_13 = {4, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_12};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_14 = { 4 | NIM_STRLIT_FLAG, "... " };
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_15 = {4, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_14};
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_16 = {1, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_6};
static NIM_CONST tySet_tyChar__nmiMWKVIe46vacnhAFrQvw TM__ml9aueblxGz9aYsRLKvPmpow_17 = {
0x00, 0x00, 0x00, 0x00, 0x7a, 0xbc, 0x00, 0xf4,
0x01, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x50,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
;
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_18 = { 3 | NIM_STRLIT_FLAG, "let" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_19 = { 3 | NIM_STRLIT_FLAG, "var" };
static const struct {
  NI cap; NIM_CHAR data[5+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_20 = { 5 | NIM_STRLIT_FLAG, "const" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_21 = { 4 | NIM_STRLIT_FLAG, "type" };
static const struct {
  NI cap; NIM_CHAR data[6+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_22 = { 6 | NIM_STRLIT_FLAG, "object" };
static const struct {
  NI cap; NIM_CHAR data[5+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_23 = { 5 | NIM_STRLIT_FLAG, "tuple" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_24 = { 3 | NIM_STRLIT_FLAG, "div" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_25 = { 3 | NIM_STRLIT_FLAG, "mod" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_26 = { 3 | NIM_STRLIT_FLAG, "shl" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_27 = { 3 | NIM_STRLIT_FLAG, "shr" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_28 = { 2 | NIM_STRLIT_FLAG, "in" };
static const struct {
  NI cap; NIM_CHAR data[5+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_29 = { 5 | NIM_STRLIT_FLAG, "notin" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_30 = { 2 | NIM_STRLIT_FLAG, "is" };
static const struct {
  NI cap; NIM_CHAR data[5+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_31 = { 5 | NIM_STRLIT_FLAG, "isnot" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_32 = { 3 | NIM_STRLIT_FLAG, "not" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_33 = { 2 | NIM_STRLIT_FLAG, "of" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_34 = { 2 | NIM_STRLIT_FLAG, "as" };
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_35 = { 4 | NIM_STRLIT_FLAG, "from" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_36 = { 2 | NIM_STRLIT_FLAG, ".." };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_37 = { 3 | NIM_STRLIT_FLAG, "and" };
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_38 = { 2 | NIM_STRLIT_FLAG, "or" };
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__ml9aueblxGz9aYsRLKvPmpow_39 = { 3 | NIM_STRLIT_FLAG, "xor" };
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_40 = {2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_33};
static const NimStringV2 TM__ml9aueblxGz9aYsRLKvPmpow_41 = {6, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_22};
N_LIB_PRIVATE NIM_CONST tyArray__E9cjy83smb5N4sXLGk0xt3w LineContinuationTokens__llstream_u236 = {{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_18},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_19},
{5, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_20},
{4, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_21},
{6, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_22},
{5, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_23},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_24},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_25},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_26},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_27},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_28},
{5, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_29},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_30},
{5, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_31},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_32},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_33},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_34},
{4, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_35},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_36},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_37},
{2, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_38},
{3, (NimStrPayload*)&TM__ml9aueblxGz9aYsRLKvPmpow_39}}
;
static NIM_CONST NU32 TM__ml9aueblxGz9aYsRLKvPmpow_2[2] = {3701606400, 2162965248};
N_LIB_PRIVATE TNimTypeV2 NTIv2__FoDsO8lsQbcCVaLehnuOYg_ = {.destructor = (void*)rttiDestroy__llstream_u551, .size = sizeof(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), .align = (NI16) NIM_ALIGNOF(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), .depth = 1, .display = TM__ml9aueblxGz9aYsRLKvPmpow_2, .traceImpl = (void*)eqtrace___llstream_u69, .flags = 0};
extern NIM_BOOL nimInErrorMode__system_u4179;
static N_INLINE(NI, minuspercent___system_u805)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU32)(((NU) (x_p0))) - (NU32)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
	NIM_BOOL result;
	result = NIM_FALSE;
	{
		tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A* cell_1;
		NI T5_;
		if (!!((p_p0 == NIM_NIL))) goto LA3_;
		T5_ = (NI)0;
		T5_ = minuspercent___system_u805(((NI) (ptrdiff_t) (p_p0)), ((NI)8));
		cell_1 = ((tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A*) (T5_));
		{
			if (!((NI)((*cell_1).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
			result = NIM_TRUE;
		}
		goto LA6_;
LA8_: ;
		{
			(*cell_1).rc = minuspercent___system_u805((*cell_1).rc, ((NI)16));
		}
LA6_: ;
		rememberCycle__system_u3533(result, cell_1, (*((TNimTypeV2**) (p_p0))));
	}
LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___llstream_u57)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).onPrompt.ClE_0);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).onPrompt.ClE_0);
	}
LA4_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = nimDecRefIsLastCyclicDyn((*dest_p0).repl.ClE_0);
		if (!T8_) goto LA9_;
		nimDestroyAndDispose((*dest_p0).repl.ClE_0);
	}
LA9_: ;
	eqdestroy___system_u2691((*dest_p0).s);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__llstream_u551)(void* dest_p0) {
	eqdestroy___llstream_u57((&(*((tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) (dest_p0)))));
}
static N_INLINE(NI, pluspercent___system_u785)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU32)(((NU) (x_p0))) + (NU32)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(void, add__system_u3054)(tyObject_CellSeq__gW9aeWLFbrNaeUKXqxYBXhg* s_p0, void** c_p1, TNimTypeV2* t_p2) {
	void** colontmp_;
	TNimTypeV2* colontmp__2;
	{
		if (!((*s_p0).cap <= (*s_p0).len)) goto LA3_;
		resize__system_u3062(s_p0);
	}
LA3_: ;
	colontmp_ = c_p1;
	colontmp__2 = t_p2;
	(*s_p0).d[(*s_p0).len].Field0 = colontmp_;
	(*s_p0).d[(*s_p0).len].Field1 = colontmp__2;
	(*s_p0).len = pluspercent___system_u785((*s_p0).len, ((NI)1));
}
static N_INLINE(void, nimTraceRefDyn)(void* q_p0, void* env_p1) {
	void** p_1;
	p_1 = ((void**) (q_p0));
	{
		tyObject_GcEnv__HccVszwojlCZRN46BE9cG8w* j_1;
		if (!!(((*p_1) == NIM_NIL))) goto LA3_;
		j_1 = ((tyObject_GcEnv__HccVszwojlCZRN46BE9cG8w*) (env_p1));
		add__system_u3054((&(*j_1).traceStack), p_1, (*((TNimTypeV2**) ((*p_1)))));
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___llstream_u69)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* dest_p0, void* env_p1) {
	nimTraceRefDyn((&(*dest_p0).repl.ClE_0), env_p1);
	nimTraceRefDyn((&(*dest_p0).onPrompt.ClE_0), env_p1);
}
N_LIB_PRIVATE N_NIMCALL(void, eqsink___llstream_u123)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg** dest_p0, tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* src_p1) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* colontmp_;
	colontmp_ = (*dest_p0);
	(*dest_p0) = src_p1;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn(colontmp_);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose(colontmp_);
	}
LA4_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4179);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*, llStreamOpen__llstream_u136)(NimStringV2 filename_p0, tyEnum_FileMode__YkEVJbjDa9aPvYTBr8yiUWg mode_p1) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* result;
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = NIM_NIL;
	T1_ = (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) nimNewObj(sizeof(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), NIM_ALIGNOF(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg));
	(*T1_).Sup.m_type = (&NTIv2__FoDsO8lsQbcCVaLehnuOYg_);
	(*T1_).kind = ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2);
	result = T1_;
	{
		NIM_BOOL T4_;
		T4_ = (NIM_BOOL)0;
		T4_ = open__stdZsyncio_u414(&(*result).f, filename_p0, mode_p1, ((NI)-1));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(T4_)) goto LA5_;
		eqsink___llstream_u123(&result, ((tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) NIM_NIL));
	}
LA5_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(void, nimIncRefCyclic)(void* p_p0, NIM_BOOL cyclic_p1) {
	tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A* h_1;
	NI T1_;
	T1_ = (NI)0;
	T1_ = minuspercent___system_u805(((NI) (ptrdiff_t) (p_p0)), ((NI)8));
	h_1 = ((tyObject_RefHeader__GDnGTjNyvwISJbkIvAst3A*) (T1_));
	(*h_1).rc = pluspercent___system_u785((*h_1).rc, ((NI)16));
}
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___llstream_u115)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg** dest_p0, tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* src_p1, NIM_BOOL cyclic_p2) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* colontmp_;
	colontmp_ = (*dest_p0);
	{
		if (!src_p1) goto LA3_;
		nimIncRefCyclic(src_p1, cyclic_p2);
	}
LA3_: ;
	(*dest_p0) = src_p1;
	{
		NIM_BOOL T7_;
		T7_ = (NIM_BOOL)0;
		T7_ = nimDecRefIsLastCyclicDyn(colontmp_);
		if (!T7_) goto LA8_;
		nimDestroyAndDispose(colontmp_);
	}
LA8_: ;
}
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(void, copyMem__system_u1742)(void* dest_p0, void* source_p1, NI size_p2) {
	nimCopyMem(dest_p0, source_p1, size_p2);
}
N_LIB_PRIVATE N_NIMCALL(NI, llStreamRead__llstream_u469)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, void* buf_p1, NI bufLen_p2) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	switch ((*s_p0).kind) {
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)0):
	{
		result = ((NI)0);
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1):
	{
		result = ((bufLen_p2 <= (NI)((*s_p0).s.len - (*s_p0).rd)) ? bufLen_p2 : (NI)((*s_p0).s.len - (*s_p0).rd));
		{
			if (!(((NI)0) < result)) goto LA5_;
			copyMem__system_u1742(buf_p1, ((void*) ((&(*s_p0).s.p->data[(NI)(((NI)0) + (*s_p0).rd)]))), (result));
			(*s_p0).rd += result;
		}
LA5_: ;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2):
	{
		result = readBuffer__stdZsyncio_u165((*s_p0).f, buf_p1, (bufLen_p2));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3):
	{
		{
			if (!!(((*s_p0).onPrompt.ClP_0 == TM__ml9aueblxGz9aYsRLKvPmpow_3.ClP_0 && (*s_p0).onPrompt.ClE_0 == TM__ml9aueblxGz9aYsRLKvPmpow_3.ClE_0))) goto LA11_;
			(*s_p0).onPrompt.ClE_0? (*s_p0).onPrompt.ClP_0((*s_p0).onPrompt.ClE_0):((TM__ml9aueblxGz9aYsRLKvPmpow_4)((*s_p0).onPrompt.ClP_0))();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA11_: ;
		result = (*s_p0).repl.ClE_0? (*s_p0).repl.ClP_0(s_p0, buf_p1, bufLen_p2, (*s_p0).repl.ClE_0):((TM__ml9aueblxGz9aYsRLKvPmpow_5)((*s_p0).repl.ClP_0))(s_p0, buf_p1, bufLen_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, llStreamClose__llstream_u214)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	switch ((*s_p0).kind) {
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)0):
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1):
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3):
	{
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2):
	{
		close__stdZsyncio_u269((*s_p0).f);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___llstream_u112)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn(dest_p0);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose(dest_p0);
	}
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*, llStreamOpen__llstream_u133)(FILE* f_p0) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* result;
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* T1_;
	T1_ = NIM_NIL;
	T1_ = (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) nimNewObj(sizeof(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), NIM_ALIGNOF(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg));
	(*T1_).Sup.m_type = (&NTIv2__FoDsO8lsQbcCVaLehnuOYg_);
	(*T1_).kind = ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2);
	(*T1_).f = f_p0;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*, llStreamOpen__llstream_u32)(NimStringV2 data_p0) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* result;
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* T1_;
	NimStringV2 blitTmp_1;
	T1_ = NIM_NIL;
	T1_ = (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) nimNewObj(sizeof(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), NIM_ALIGNOF(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg));
	(*T1_).Sup.m_type = (&NTIv2__FoDsO8lsQbcCVaLehnuOYg_);
	(*T1_).kind = ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1);
	blitTmp_1 = data_p0;
	(*T1_).s = blitTmp_1;
	result = T1_;
	return result;
}
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1) {
	prepareAdd(s_p0, ((NI)1));
	(*(*s_p0).p).data[(*s_p0).len] = c_p1;
	(*s_p0).len += ((NI)1);
	(*(*s_p0).p).data[(*s_p0).len] = 0;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, llStreamReadLine__llstream_u487)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, NimStringV2* line_p1) {
	NIM_BOOL result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	setLengthStrV2((&(*line_p1)), ((NI)0));
	switch ((*s_p0).kind) {
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)0):
	{
		result = NIM_TRUE;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1):
	{
		NIM_BOOL T12_;
		{
			while (1) {
				if (!((*s_p0).rd < (*s_p0).s.len)) goto LA4;
				switch (((NU8)((*s_p0).s.p->data[(*s_p0).rd]))) {
				case 13:
				{
					(*s_p0).rd += ((NI)1);
					{
						if (!((NU8)((*s_p0).s.p->data[(*s_p0).rd]) == (NU8)(10))) goto LA8_;
						(*s_p0).rd += ((NI)1);
					}
LA8_: ;
					goto LA3;
				}
				break;
				case 10:
				{
					(*s_p0).rd += ((NI)1);
					goto LA3;
				}
				break;
				default:
				{
					nimAddCharV1((&(*line_p1)), (*s_p0).s.p->data[(*s_p0).rd]);
					(*s_p0).rd += ((NI)1);
				}
				break;
				}
			} LA4: ;
		} LA3: ;
		T12_ = (NIM_BOOL)0;
		T12_ = (((NI)0) < (*line_p1).len);
		if (T12_) goto LA13_;
		T12_ = ((*s_p0).rd < (*s_p0).s.len);
LA13_: ;
		result = T12_;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2):
	{
		result = readLine__stdZsyncio_u292((*s_p0).f, line_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3):
	{
		result = readLine__stdZsyncio_u292(stdin, line_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*, eqdup___llstream_u119)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* src_p0, NIM_BOOL cyclic_p1) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* result;
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* colontmp_;
	result = NIM_NIL;
	colontmp_ = result;
	result = src_p0;
	{
		if (!src_p0) goto LA3_;
		nimIncRefCyclic(src_p0, cyclic_p1);
	}
LA3_: ;
	return result;
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
	{
		if (!(((NI)0) < src_p1.len)) goto LA3_;
		copyMem__system_u1742(((void*) ((&(*(*dest_p0).p).data[(*dest_p0).len]))), ((void*) ((&(*src_p1.p).data[((NI)0)]))), (src_p1.len));
		(*dest_p0).len += src_p1.len;
		(*(*dest_p0).p).data[(*dest_p0).len] = 0;
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, llStreamWrite__llstream_u511)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, NimStringV2 data_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	switch ((*s_p0).kind) {
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)0):
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3):
	{
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1):
	{
		prepareAdd((&(*s_p0).s), data_p1.len + 0);
appendString((&(*s_p0).s), data_p1);
		(*s_p0).wr += data_p1.len;
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2):
	{
		write__stdZsyncio_u254((*s_p0).f, data_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWith__llstream_u220)(NimStringV2 x_p0, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw s_p1) {
	NIM_BOOL result;
	NI i_1;
	i_1 = (NI)(x_p0.len - ((NI)1));
	{
		while (1) {
			NIM_BOOL T3_;
			T3_ = (NIM_BOOL)0;
			T3_ = (((NI)0) <= i_1);
			if (!(T3_)) goto LA4_;
			T3_ = ((NU8)(x_p0.p->data[i_1]) == (NU8)(32));
LA4_: ;
			if (!T3_) goto LA2;
			i_1 -= ((NI)1);
		} LA2: ;
	}
	{
		NIM_BOOL T7_;
		T7_ = (NIM_BOOL)0;
		T7_ = (((NI)0) <= i_1);
		if (!(T7_)) goto LA8_;
		T7_ = ((s_p1[(NU)((((NU8)(x_p0.p->data[i_1]))))>>3] &(1U<<((NU)((((NU8)(x_p0.p->data[i_1]))))&7U)))!=0);
LA8_: ;
		if (!T7_) goto LA9_;
		result = NIM_TRUE;
	}
	goto LA5_;
LA9_: ;
	{
		result = NIM_FALSE;
	}
LA5_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, llStreamWrite__llstream_u522)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, NIM_CHAR data_p1) {
	NIM_CHAR c_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	c_1 = (NIM_CHAR)0;
	switch ((*s_p0).kind) {
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)0):
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3):
	{
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)1):
	{
		nimAddCharV1((&(*s_p0).s), data_p1);
		(*s_p0).wr += ((NI)1);
	}
	break;
	case ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)2):
	{
		NI T4_;
		c_1 = data_p1;
		T4_ = (NI)0;
		T4_ = writeBuffer__stdZsyncio_u196((*s_p0).f, ((void*) ((&c_1))), ((NI)1));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(void)(T4_);
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___llstream_u109)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg** dest_p0) {
	(*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(void, llStreamWriteln__llstream_u519)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, NimStringV2 data_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	llStreamWrite__llstream_u511(s_p0, data_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	llStreamWrite__llstream_u511(s_p0, TM__ml9aueblxGz9aYsRLKvPmpow_7);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(void, nimSetMem__system_u2172)(void* a_p0, int v_p1, NI size_p2) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
	nimSetMem__system_u2172(p_p0, ((int)0), size_p1);
}
N_LIB_PRIVATE N_NIMCALL(void, eqdup___llstream_u160)(tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ src_p0, NIM_BOOL cyclic_p1, tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ* Result) {
	void* colontmp_;
	nimZeroMem((void*)Result, sizeof(tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ));
	colontmp_ = (*Result).ClE_0;
	(*Result).ClE_0 = src_p0.ClE_0;
	(*Result).ClP_0 = src_p0.ClP_0;
	{
		if (!src_p0.ClE_0) goto LA3_;
		nimIncRefCyclic(src_p0.ClE_0, cyclic_p1);
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdup___llstream_u192)(tyProc__HzVCwACFYM9cx9aV62PdjtuA src_p0, NIM_BOOL cyclic_p1, tyProc__HzVCwACFYM9cx9aV62PdjtuA* Result) {
	void* colontmp_;
	nimZeroMem((void*)Result, sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
	colontmp_ = (*Result).ClE_0;
	(*Result).ClE_0 = src_p0.ClE_0;
	(*Result).ClP_0 = src_p0.ClP_0;
	{
		if (!src_p0.ClE_0) goto LA3_;
		nimIncRefCyclic(src_p0.ClE_0, cyclic_p1);
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*, llStreamOpenStdIn__llstream_u146)(tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ r_p0, tyProc__HzVCwACFYM9cx9aV62PdjtuA onPrompt_p1) {
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* result;
	tyProc__WBr0JFZ9bbIGwzgqNYcBJtQ colontmpD_;
	tyProc__HzVCwACFYM9cx9aV62PdjtuA colontmpD__2;
	tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* T1_;
	T1_ = NIM_NIL;
	T1_ = (tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg*) nimNewObj(sizeof(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg), NIM_ALIGNOF(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg));
	(*T1_).Sup.m_type = (&NTIv2__FoDsO8lsQbcCVaLehnuOYg_);
	(*T1_).kind = ((tyEnum_TLLStreamKind__zJDOAevuyfVWFMJ82eilbQ)3);
	(*T1_).s = TM__ml9aueblxGz9aYsRLKvPmpow_9;
	(*T1_).lineOffset = ((NI)-1);
	eqdup___llstream_u160(r_p0, NIM_TRUE, (&colontmpD_));
	(*T1_).repl.ClE_0 = colontmpD_.ClE_0;
	(*T1_).repl.ClP_0 = colontmpD_.ClP_0;
	eqdup___llstream_u192(onPrompt_p1, NIM_TRUE, (&colontmpD__2));
	(*T1_).onPrompt.ClE_0 = colontmpD__2.ClE_0;
	(*T1_).onPrompt.ClP_0 = colontmpD__2.ClP_0;
	result = T1_;
	return result;
}
static N_INLINE(void, quit__system_u7992)(NI errorcode_p0) {
	{
		if (!(errorcode_p0 < ((NI)-128))) goto LA3_;
		exit(((int)-128));
	}
	goto LA1_;
LA3_: ;
	{
		if (!(((NI)127) < errorcode_p0)) goto LA6_;
		exit(((int)127));
	}
	goto LA1_;
LA6_: ;
	{
		exit(((int) (errorcode_p0)));
	}
LA1_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, readLineFromStdin__llstream_u216)(NimStringV2 prompt_p0, NimStringV2* line_p1) {
	NIM_BOOL result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	write__stdZsyncio_u254(stdout, prompt_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	flushFile__stdZsyncio_u279(stdout);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = readLine__stdZsyncio_u292(stdin, line_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!!(result)) goto LA3_;
		write__stdZsyncio_u254(stdout, TM__ml9aueblxGz9aYsRLKvPmpow_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		quit__system_u7992(((NI)0));
	}
LA3_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, countTriples__llstream_u428)(NimStringV2 s_p0) {
	NI result;
	NI i_1;
	result = ((NI)0);
	i_1 = ((NI)0);
	{
		while (1) {
			if (!((NI)(i_1 + ((NI)2)) < s_p0.len)) goto LA2;
			{
				NIM_BOOL T5_;
				NIM_BOOL T6_;
				T5_ = (NIM_BOOL)0;
				T6_ = (NIM_BOOL)0;
				T6_ = ((NU8)(s_p0.p->data[i_1]) == (NU8)(34));
				if (!(T6_)) goto LA7_;
				T6_ = ((NU8)(s_p0.p->data[(NI)(i_1 + ((NI)1))]) == (NU8)(34));
LA7_: ;
				T5_ = T6_;
				if (!(T5_)) goto LA8_;
				T5_ = ((NU8)(s_p0.p->data[(NI)(i_1 + ((NI)2))]) == (NU8)(34));
LA8_: ;
				if (!T5_) goto LA9_;
				result += ((NI)1);
				i_1 += ((NI)2);
			}
LA9_: ;
			i_1 += ((NI)1);
		} LA2: ;
	}
	return result;
}
static N_INLINE(int, nimCmpMem)(void* a_p0, void* b_p1, NI size_p2) {
	int result;
	result = memcmp(a_p0, b_p1, ((size_t) (size_p2)));
	return result;
}
static N_INLINE(NIM_BOOL, equalMem__system_u1750)(void* a_p0, void* b_p1, NI size_p2) {
	NIM_BOOL result;
	int T1_;
	T1_ = (int)0;
	T1_ = nimCmpMem(a_p0, b_p1, size_p2);
	result = (T1_ == ((NI32)0));
	return result;
}
static N_INLINE(NIM_BOOL, eqStrings)(NimStringV2 a_p0, NimStringV2 b_p1) {
	NIM_BOOL result;
	NI alen_1;
	NI blen_1;
{	result = NIM_FALSE;
	alen_1 = a_p0.len;
	blen_1 = b_p1.len;
	{
		if (!(alen_1 == blen_1)) goto LA3_;
		{
			if (!(alen_1 == ((NI)0))) goto LA7_;
			result = NIM_TRUE;
			goto BeforeRet_;
		}
LA7_: ;
		result = equalMem__system_u1750(((void*) ((&a_p0.p->data[((NI)0)]))), ((void*) ((&b_p1.p->data[((NI)0)]))), (alen_1));
		goto BeforeRet_;
	}
LA3_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, eqIdent__llstream_u237)(NimStringV2 a_p0, NimStringV2 bNormalized_p1) {
	NIM_BOOL result;
	NimStringV2 colontmpD_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	colontmpD_ = nimIdentNormalize__pureZstrutils_u124(a_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = eqStrings(colontmpD_, bNormalized_p1);
	eqdestroy___system_u2691(colontmpD_);
	}BeforeRet_: ;
	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)1073741824)) == ((NI)1073741824));
LA4_: ;
		if (!T3_) goto LA5_;
		nimPrepareStrMutationImpl__system_u2430(s_p0);
	}
LA5_: ;
}
static N_INLINE(NimStringV2, X5BX5D___llstream_u284)(NimStringV2 s_p0, tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ x_p1) {
	NimStringV2 result;
	NI a_1;
	NI L_1;
	result.len = 0; result.p = NIM_NIL;
	a_1 = (NI)(s_p0.len - x_p1.a);
	L_1 = (NI)((NI)((NI)(s_p0.len - x_p1.b) - a_1) + ((NI)1));
	result = mnewString((L_1));
	{
		NI i_1;
		NI i_2;
		i_1 = (NI)0;
		i_2 = ((NI)0);
		{
			while (1) {
				if (!(i_2 < L_1)) goto LA3;
				i_1 = i_2;
				nimPrepareStrMutationV2((&result));
				result.p->data[i_1] = s_p0.p->data[(NI)(i_1 + a_1)];
				i_2 += ((NI)1);
			} LA3: ;
		}
	}
	return result;
}
static N_INLINE(tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ, dotdot___llstream_u246)(NI a_p0, NI b_p1) {
	tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ result;
	result.a = a_p0;
	result.b = b_p1;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithIdent__llstream_u241)(NimStringV2 s_p0, NimStringV2 subs_p1) {
	NIM_BOOL result;
	NimStringV2 colontmpD_;
	NI le_1;
	tyObject_HSlice__Voqjvz88r4pPzKdea9cDhiQ T6_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	le_1 = subs_p1.len;
	{
		if (!(s_p0.len < le_1)) goto LA4_;
		result = NIM_FALSE;
		eqdestroy___system_u2691(colontmpD_);
		goto BeforeRet_;
	}
LA4_: ;
	T6_ = dotdot___llstream_u246(le_1, ((NI)1));
	colontmpD_ = X5BX5D___llstream_u284(s_p0, T6_);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	result = eqIdent__llstream_u237(colontmpD_, subs_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	{
		LA1_:;
	}
	{
		eqdestroy___system_u2691(colontmpD_);
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, continuesWithIdent__llstream_u299)(NimStringV2 s_p0, NimStringV2 subs_p1, NI start_p2) {
	NIM_BOOL result;
	NimStringV2 colontmpD_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	colontmpD_ = substr__system_u8649(s_p0, start_p2, (NI)(start_p2 + (subs_p1.len-1)));
	result = eqIdent__llstream_u237(colontmpD_, subs_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	eqdestroy___system_u2691(colontmpD_);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithIdent__llstream_u304)(NimStringV2 s_p0, NimStringV2 subs_p1, NI* endIdx_p2) {
	NIM_BOOL result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	(*endIdx_p2) -= subs_p1.len;
	result = continuesWithIdent__llstream_u299(s_p0, subs_p1, (NI)((*endIdx_p2) + ((NI)1)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, containsObjectOf__llstream_u314)(NimStringV2 x_p0) {
	NIM_BOOL result;
	NI idx_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	idx_1 = nsuRFindChar(x_p0, 32, ((NI)0), ((NI)-1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!(idx_1 == ((NI)-1))) goto LA3_;
		goto BeforeRet_;
	}
LA3_: ;
	{
		while (1) {
			if (!((NU8)(x_p0.p->data[idx_1]) == (NU8)(32))) goto LA6;
			idx_1 -= ((NI)1);
		} LA6: ;
	}
	result = endsWithIdent__llstream_u304(x_p0, TM__ml9aueblxGz9aYsRLKvPmpow_40, (&idx_1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!!(result)) goto LA9_;
		goto BeforeRet_;
	}
LA9_: ;
	{
		while (1) {
			if (!((NU8)(x_p0.p->data[idx_1]) == (NU8)(32))) goto LA12;
			idx_1 -= ((NI)1);
		} LA12: ;
	}
	result = endsWithIdent__llstream_u304(x_p0, TM__ml9aueblxGz9aYsRLKvPmpow_41, (&idx_1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!!(result)) goto LA15_;
		goto BeforeRet_;
	}
LA15_: ;
	result = NIM_TRUE;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, endsWithLineContinuationToken__llstream_u331)(NimStringV2 x_p0) {
	NIM_BOOL result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = NIM_FALSE;
	{
		NimStringV2 tok_1;
		NI i_1;
		tok_1.len = 0; tok_1.p = NIM_NIL;
		i_1 = ((NI)0);
		{
			while (1) {
				tok_1 = LineContinuationTokens__llstream_u236[(i_1)- 0];
				{
					NIM_BOOL T6_;
					T6_ = (NIM_BOOL)0;
					T6_ = endsWithIdent__llstream_u241(x_p0, tok_1);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!T6_) goto LA7_;
					result = NIM_TRUE;
					goto BeforeRet_;
				}
LA7_: ;
				{
					if (!(((NI)21) <= i_1)) goto LA11_;
					goto LA2;
				}
LA11_: ;
				i_1 += ((NI)1);
			}
		} LA2: ;
	}
	result = containsObjectOf__llstream_u314(x_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, continueLine__llstream_u420)(NimStringV2 line_p0, NIM_BOOL inTripleString_p1) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	NIM_BOOL T3_;
	NIM_BOOL T5_;
	NIM_BOOL T6_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = inTripleString_p1;
	if (T1_) goto LA2_;
	T3_ = (NIM_BOOL)0;
	T3_ = (((NI)0) < line_p0.len);
	if (!(T3_)) goto LA4_;
	T5_ = (NIM_BOOL)0;
	T6_ = (NIM_BOOL)0;
	T6_ = ((NU8)(line_p0.p->data[((NI)0)]) == (NU8)(32));
	if (T6_) goto LA7_;
	T6_ = endsWith__llstream_u220(line_p0, TM__ml9aueblxGz9aYsRLKvPmpow_17);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
LA7_: ;
	T5_ = T6_;
	if (T5_) goto LA8_;
	T5_ = endsWithLineContinuationToken__llstream_u331(line_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
LA8_: ;
	T3_ = T5_;
LA4_: ;
	T1_ = T3_;
LA2_: ;
	result = T1_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, llReadFromStdin__llstream_u142)(tyObject_TLLStream__FoDsO8lsQbcCVaLehnuOYg* s_p0, void* buf_p1, NI bufLen_p2) {
	NI result;
	NimStringV2 line_1;
	NI triples_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	line_1.len = 0; line_1.p = NIM_NIL;
	eqsink___system_u2700((&(*s_p0).s), TM__ml9aueblxGz9aYsRLKvPmpow_10);
	(*s_p0).rd = ((NI)0);
	line_1 = rawNewString(((NI)120));
	triples_1 = ((NI)0);
	{
		while (1) {
			NimStringV2 colontmpD_;
			NimStringV2 colontmpD__2;
			NI T16_;
			colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
			colontmpD__2.len = 0; colontmpD__2.p = NIM_NIL;
			{
				NimStringV2 T7_;
				NIM_BOOL T13_;
				T7_.len = 0; T7_.p = NIM_NIL;
				{
					if (!((*s_p0).s.len == ((NI)0))) goto LA10_;
					colontmpD_ = TM__ml9aueblxGz9aYsRLKvPmpow_13;
					T7_ = colontmpD_;
				}
				goto LA8_;
LA10_: ;
				{
					colontmpD__2 = TM__ml9aueblxGz9aYsRLKvPmpow_15;
					T7_ = colontmpD__2;
				}
LA8_: ;
				T13_ = (NIM_BOOL)0;
				T13_ = readLineFromStdin__llstream_u216(T7_, (&line_1));
				if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
				if (!!(T13_)) goto LA14_;
				quit__system_u7992(((NI)0));
			}
LA14_: ;
			prepareAdd((&(*s_p0).s), line_1.len + 0);
appendString((&(*s_p0).s), line_1);
			prepareAdd((&(*s_p0).s), 1);
appendString((&(*s_p0).s), TM__ml9aueblxGz9aYsRLKvPmpow_16);
			T16_ = (NI)0;
			T16_ = countTriples__llstream_u428(line_1);
			if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
			triples_1 += T16_;
			{
				NIM_BOOL T19_;
				T19_ = (NIM_BOOL)0;
				T19_ = continueLine__llstream_u420(line_1, ((NI)(triples_1 & ((NI)1)) == ((NI)1)));
				if (NIM_UNLIKELY(*nimErr_)) goto LA4_;
				if (!!(T19_)) goto LA20_;
				eqdestroy___system_u2691(colontmpD__2);
				eqdestroy___system_u2691(colontmpD_);
				goto LA2;
			}
LA20_: ;
			{
				LA4_:;
			}
			{
				eqdestroy___system_u2691(colontmpD__2);
				eqdestroy___system_u2691(colontmpD_);
			}
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		}
	} LA2: ;
	(*s_p0).lineOffset += ((NI)1);
	result = ((bufLen_p2 <= (NI)((*s_p0).s.len - (*s_p0).rd)) ? bufLen_p2 : (NI)((*s_p0).s.len - (*s_p0).rd));
	{
		if (!(((NI)0) < result)) goto LA26_;
		copyMem__system_u1742(buf_p1, ((void*) ((&(*s_p0).s.p->data[(*s_p0).rd]))), (result));
		(*s_p0).rd += result;
	}
LA26_: ;
	{
		LA1_:;
	}
	{
		eqdestroy___system_u2691(line_1);
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
